- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
usually the Fortran runtime is supposed to provide a meaningful error message in the IOMSG variable after certain IO error conditions encountered (e.g. for input from the user, I report IOMSG back)
I wanted to share the following observation where the error message is empty despite an error occurred (in list-directed, internal read of a real number, upon encountering parentheses; compiled with ifort 19.0.3):
program p implicit none character(len=:), allocatable :: str real :: x character(len=99) :: iomsg integer :: iostat ! Case 1: iostat=24, iomsg="" str = "(1" x = 0.0; iostat = 0; iomsg = "" read(str, *, iostat=iostat, iomsg=iomsg) x print *, x, iostat, '"', trim(iomsg), '"' ! Case 2: iostat=59, iomsg="" str = "(1)" x = 0.0; iostat = 0; iomsg = "" read(str, *, iostat=iostat, iomsg=iomsg) x print *, x, iostat, '"', trim(iomsg), '"' end program
Is this supposed to be like that? Maybe this could be an improvement in future (@Intel)?
Gfortran reports "Bad real number in item 1 of list input" in both cases.
Also, according to https://software.intel.com/en-us/fortran-compiler-developer-guide-and-reference-list-of-run-time-error-messages, the value 24 is not even supposed to be assumed by the IOSTAT variable at all(?).
Kind regards,
Ferdinand
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you got a non-zero IOSTAT, IOMSG should have been filled in. If not, that's a bug.
You're also right that a READ should return -1 for IOSTAT on an EOF and not 24.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page