- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello. Here is a test program:
$ cat test_backspace.f90
program test_backspace
implicit none
integer a(4)
integer iostat
character c
open(unit=1, file="test_backspace.csv", status='old', action='read', &
position='rewind')
do
read(unit=1, fmt='(a)', advance='no', iostat=iostat) c
if (iostat /= 0) exit
end do
backspace(unit=1)
read(unit=1, fmt=*) a
close(unit=1)
print *, "a = ", a
end program test_backspace
And here is a test input file:
$ cat test_backspace.csv
3 6
-2 0
Execution fails with a recent version of the Intel compiler:
$ ifx --version
ifx (IFX) 2023.1.0 20230320
$ ifx test_backspace.f90
$ a.out
forrtl: severe (24): end-of-file during read, unit 1, file /gpfsssd/scratch/rech/lmd/rdzt899/test_backspace.csv
Please note that it works with an older version of the Intel compiler:
$ ifort --version
ifort (IFORT) 19.1.3.304
20200925
$ ifort test_backspace.f90
$ a.out
a = 3 6 -2 0
and it works with the GNU compiler:
$ gfortran --version
GNU Fortran (GCC) 11.3.1 20221121 (Red Hat 11.3.1-4)
Copyright (C) 2021 Free Software Foundation, Inc.
$ gfortran test_backspace.f90
$ a.out
a = 3 6 -2 0
I think this is a bug in the recent version of the Intel compiler. The last execution of the non-advancing read statement creates an end-of-record condition. The backspace should bring the position back to the beginning of the record. It does not (this can also be seen with a debugger).
Would you fix this bug?
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
$ ifx test_backspace.f90
$ ./a.out
a = 3 6 -2 0
$ ifx --version
ifx (IFX) 2024.2.0 20240602
Copyright (C) 1985-2024 Intel Corporation. All rights reserved.
Please upgrade to the latest 2024.2 ifx
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Already fixed.
D:\Projects>ifx t.f90
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2024.2.0 Build 20240602
Copyright (C) 1985 - 2024 Intel Corporation. All rights reserved.
Microsoft (R) Incremental Linker Version 14.40.33811.0
Copyright (C) Microsoft Corporation. All rights reserved.
-out:t.exe
-subsystem:console
t.obj
D:\Projects>t.exe
a = 3 6 -2 0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
$ ifx test_backspace.f90
$ ./a.out
a = 3 6 -2 0
$ ifx --version
ifx (IFX) 2024.2.0 20240602
Copyright (C) 1985-2024 Intel Corporation. All rights reserved.
Please upgrade to the latest 2024.2 ifx
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page