spurious failure of parse_header
in load_npy
due to no value assigned to an intent(out)
argument.
#706
Labels
bug
Something isn't working
Description
An example of
stdlib_io
,example_loadnpy
, terminated with an error when built using NAG Fortran with therelease
profile.Expected Behaviour
I expected the example to run and finish as successfully as it did under the following configurations:
debug
andrelease
profilesdebug
andrelease
profilesdebug
profileVersion of stdlib
31f5a8b
Platform and Architecture
Windows 10 22H2 64bit, gfortran 11.2 bundled with quickstart Fortran on Windows, Intel Fortran 2021.5.0, NAG Fortran 7.1 Build 7117, fpm 0.7.0 alpha
Additional Information
I print-debugged to determine the cause of this error, and I found that
parse_header
called inget_descriptor
is considered a failure becausestat
is 1.No error occurred in
parse_header
;stat
is always 0. However,stat
becomes 1 when returned toget_descriptor
.Several print statements reveal this strange behavior.
get_descriptor
parse_header
In
parse_header
,stat
is not assigned any value if no error occurs.stat
having the intent(out) attribute may become undefined according to the Fortran standard:I cannot say whether this behavior is a NAG Fortran's bug, but adding a statement
stat = 0
to specify that no error occurred inparse_header
avoids this spurious failure.+ stat = 0 end subroutine parse_header
The text was updated successfully, but these errors were encountered: