Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

loadtxt test occasionally fails #862

Open
minhqdao opened this issue Aug 15, 2024 · 2 comments
Open

loadtxt test occasionally fails #862

minhqdao opened this issue Aug 15, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@minhqdao
Copy link
Contributor

minhqdao commented Aug 15, 2024

Description

It's a little bit tricky to reproduce but the loadtxt test occasionally fails (maybe 10-20% of the time). Mostly, it happens in the CI with the combination ubuntu-latest/gcc/12/cmake:

159/324 Test #158: loadtxt ................................***Failed    0.01 sec
At line 171 of file /home/runner/work/stdlib/stdlib/build/src/stdlib_io.f90
Fortran runtime error: Bad value during floating point read

Error termination. Backtrace:
#0  0x7fafd0c23960 in ???
#1  0x7fafd0c244d9 in ???
#2  0x7fafd0e75aba in ???
#3  0x7fafd0e796b9 in ???
#4  0x7fafd0e7ae55 in ???
#5  0x7fafd0e77b7a in ???
#6  0x55e0c2cce272 in __stdlib_io_MOD_loadtxt_rsp
#7  0x55e0c2cc33c7 in MAIN__
#8  0x55e0c2cc345b in main

However, I've also seen it happening with intel and intel-classic:

157/324 Test #158: loadtxt ................................***Failed    0.01 sec
forrtl: severe (24): end-of-file during read, unit -129, file /home/runner/work/stdlib/stdlib/example/io/example.dat
Image              PC                Routine            Line        Source             
example_loadtxt    0000000000436426  Unknown               Unknown  Unknown
example_loadtxt    00000000004049DB  Unknown               Unknown  Unknown
example_loadtxt    000000000040423C  Unknown               Unknown  Unknown
example_loadtxt    00000000004041CD  Unknown               Unknown  Unknown
libc.so.6          00007F854EA29D90  Unknown               Unknown  Unknown
libc.so.6          00007F854EA29E40  __libc_start_main     Unknown  Unknown
example_loadtxt    00000000004040E5  Unknown               Unknown  Unknown

Expected Behaviour

Test reliably not failing.

Version of stdlib

master

Platform and Architecture

CI: Mostly ubuntu-latest, gcc-12, cmake, but also with other combinations, e.g. ifort

@minhqdao minhqdao added the bug Something isn't working label Aug 15, 2024
@chuckyvt
Copy link
Contributor

chuckyvt commented Sep 7, 2024

Note the following thread on the Fortran discourse has some similarities to this issues, however not sure they are related.

https://fortran-lang.discourse.group/t/why-am-i-getting-an-error-with-list-directed-read/8562

@perazz
Copy link
Member

perazz commented Sep 27, 2024

One possible explanation is that the loadtxt formats always require one space (1x) to be present after each entry:

fmt_ = optval(fmt, "(*"//FMT_REAL_${k1}$(1:len(FMT_REAL_${k1}$)-1)//",1x))")

this may trigger end-of-record or end-of-file exceptions i.e. if there is no such last space

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants