public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/40652] New: fortran io unit number specified in a short integer causes open to fail.
@ 2009-07-04 18:43 yaknai at yahoo dot com
2009-07-04 19:47 ` [Bug libfortran/40652] " jvdelisle at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: yaknai at yahoo dot com @ 2009-07-04 18:43 UTC (permalink / raw)
To: gcc-bugs
This problem appeared when code was recompiled after upgrading from
gcc/gfortran 4.2.4 to 4.3, and was isolated using gcc 4.4.0 on a GNU/Linux
Fedora 11 system (32bit intel).
$ gcc -v
Using built-in specs.
Target: i586-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --enable-plugin
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
--with-ppl --with-cloog --with-tune=generic --with-arch=i586
--build=i586-redhat-linux
Thread model: posix
gcc version 4.4.0 20090506 (Red Hat 4.4.0-4) (GCC)
Example fortran program which demonstrates the problem:
implicit none
integer*4 kmpi
integer*2 shortkmpi
integer ios
character test_file*10
kmpi=12
shortkmpi=kmpi
test_file='test.dat'
c open and write a test file on unit 12
open(kmpi, file=test_file, status='replace')
write(kmpi, *) 1
write(kmpi, *) 2
write(kmpi, *) 3
close(kmpi)
write(6,*) 'Try to open and read using integer for unit'
open(kmpi, file=test_file, status='old', iostat=ios)
if (ios .eq. 0) then
write(6,*) ' Successful open using integer unit. '
close(kmpi)
else
write(6,*) ' Error, failed to open file using integer unit'
endif
write(6,*)
write(6,*) 'Try to open and read using integer*2 for unit'
open(shortkmpi, file=test_file, status='old', iostat=ios)
if(ios .eq. 0) then
write(6,*) ' Successful open using integer*2 unit.'
close(shortkmpi)
else
write(6,*) ' Error, failed to open file using integer*2 unit'
endif
write(6,*)
write(6,*) 'Watch what happens to close() with integer*2 for unit'
open(kmpi, file=test_file, status='old', iostat=ios)
close(shortkmpi)
stop
end
$ gfortran -Wall -o opentest opentest.f
$ opentest
Try to open and read using integer for unit
Successful open using integer unit.
Try to open and read using integer*2 for unit
Error, failed to open file using integer*2 unit
Watch what happens to close() with integer*2 for unit
At line 41 of file opentest.f (unit = 8302168)
Fortran runtime error: Unit number in I/O statement too large
I then compiled gcc-4.2.4
$ gcc-42 -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.2.4/configure --program-suffix=-42
--enable-languages=c,c++,fortran
Thread model: posix
gcc version 4.2.4
$ gfortran-42 -Wall -o opentest-42 opentest.f
$ opentest-42
Try to open and read using integer for unit
Successful open using integer unit.
Try to open and read using integer*2 for unit
Successful open using integer*2 unit.
Watch what happens to close() with integer*2 for unit
Note that no unit number error occurs here.
----------------------------------------------
The message
At line 41 of file opentest.f (unit = 8302168)
Fortran runtime error: Unit number in I/O statement too large
might suggest that unit numbers stored in integer*2 are being accessed in the
fortran io library call as integer*4 ??
I did not find anything in the known bug list or release notes related to this.
--
Summary: fortran io unit number specified in a short integer
causes open to fail.
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libfortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: yaknai at yahoo dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40652
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug libfortran/40652] fortran io unit number specified in a short integer causes open to fail.
2009-07-04 18:43 [Bug libfortran/40652] New: fortran io unit number specified in a short integer causes open to fail yaknai at yahoo dot com
@ 2009-07-04 19:47 ` jvdelisle at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-07-04 19:47 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from jvdelisle at gcc dot gnu dot org 2009-07-04 19:47 -------
see PR40638 which was recently reported and fixed yesterday. There is a patch
in the PR
*** This bug has been marked as a duplicate of 40638 ***
--
jvdelisle at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
Summary| fortran io unit number |fortran io unit number
|specified in a short integer|specified in a short integer
|causes open to fail. |causes open to fail.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40652
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-07-04 19:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-04 18:43 [Bug libfortran/40652] New: fortran io unit number specified in a short integer causes open to fail yaknai at yahoo dot com
2009-07-04 19:47 ` [Bug libfortran/40652] " jvdelisle at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).