[Bug fortran/84506] New: INQUIRE(pos=) always sets pos=0 with -fdefault-integer-8
albandil at atlas dot cz
gcc-bugzilla@gcc.gnu.org
Wed Feb 21 22:12:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84506
Bug ID: 84506
Summary: INQUIRE(pos=) always sets pos=0 with
-fdefault-integer-8
Product: gcc
Version: 7.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: albandil at atlas dot cz
Target Milestone: ---
INQUIRE(pos=...) seems to set 'pos' to zero when the unit number is 64bit
integer. This can be illustrated on the following example, which writes four
characters to a stream file and then INQUIRES position:
program TestInquire
implicit none
integer :: iUnit, iPos
open(newunit=iunit, file='output.txt', access='stream',
position='append', form='unformatted')
write(iUnit) 'TEXT'
inquire(iUnit, pos=iPos)
print *, iPos
end program TestInquire
The expected output is '5', which can be obtained by compilation using the
command
gfortran -ffree-form -std=f2008 inquire.f -o inquire
However, when the following command is used to compile the program, the output
is '0':
gfortran -ffree-form -std=f2008 inquire.f -o inquire -fdefault-integer-8
Both 4-byte and 8-byte mode produce '5' when Intel Fortran Compiler 17.0.1 is
used,
ifort -free -stand=f08 inquire.f -o inquire
ifort -free -stand=f08 inquire.f -o inquire -i8
More information about the Gcc-bugs
mailing list