On x86_64, gfortran appears to miscompile the fopllowing program:

      program bug
      implicit none
      character*30 :: strg
      logical l

      strg = "false"
      read (strg,*,err=10) l
      print *,l
      stop

   10 print *,"error detected"
      end

[EMAIL PROTECTED]:~/tmp> gfortran -v test.f
Driving: gfortran -v test.f -lgfortranbegin -lgfortran -lm -shared-libgcc
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: /home/martin/software/gcc/configure --disable-multilib
--with-gmp=/home/martin/software/mygmp --with-mpfr=/home/martin/software/mympfr
--prefix=/home/martin/software/ugcc --enable-languages=c++,fortran
--enable-checking=release
Thread model: posix
gcc version 4.2.0 20060304 (experimental)
 /home/martin/software/ugcc/libexec/gcc/x86_64-unknown-linux-gnu/4.2.0/f951
test.f -ffixed-form -quiet -dumpbase test.f -mtune=generic -auxbase test
-version -I
/home/martin/software/ugcc/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/finclude -o
/tmp/cccZfkta.s
GNU F95 version 4.2.0 20060304 (experimental) (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.2.0 20060304 (experimental).
GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=128005
 as -V -Qy -o /tmp/cc6fIzRc.o /tmp/cccZfkta.s
GNU assembler version 2.16.91.0.2 (x86_64-suse-linux) using BFD version
2.16.91.0.2 20050720 (SuSE Linux)
 /home/martin/software/ugcc/libexec/gcc/x86_64-unknown-linux-gnu/4.2.0/collect2
--eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2
/usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o
/home/martin/software/ugcc/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/crtbegin.o
-L/home/martin/software/ugcc/lib/gcc/x86_64-unknown-linux-gnu/4.2.0
-L/home/martin/software/ugcc/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/../../../../lib64
-L/lib/../lib64 -L/usr/lib/../lib64
-L/home/martin/software/ugcc/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/../../..
/tmp/cc6fIzRc.o -lgfortranbegin -lgfortran -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
/home/martin/software/ugcc/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/crtend.o
/usr/lib/../lib64/crtn.o
[EMAIL PROTECTED]:~/tmp> ./a.out
At line 7 of file test.f
Fortran runtime error: End of file
[EMAIL PROTECTED]:~/tmp>

I would have expected the executable to write "F", or maybe "error detected",
which happens if the code is compiled with g77 or gfortran on i386.

I think this bug has been introduced during the last two weeks, but I'm not
absolutely certain.


-- 
           Summary: [gfortran] incorrect behaviour when reading a logical
                    variable from a string
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: martin at mpa-garching dot mpg dot de
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26554

Reply via email to