public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/61627] New: specification expression ICE with version 4.7.1 and 4.8.2, incorrect output with 4.4.7 and 4.9.0
@ 2014-06-27  4:45 harper at msor dot vuw.ac.nz
  2014-07-01 22:42 ` [Bug fortran/61627] " harper at msor dot vuw.ac.nz
  0 siblings, 1 reply; 2+ messages in thread
From: harper at msor dot vuw.ac.nz @ 2014-06-27  4:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61627

            Bug ID: 61627
           Summary: specification expression ICE with version 4.7.1 and
                    4.8.2, incorrect output with 4.4.7 and 4.9.0
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: harper at msor dot vuw.ac.nz

This 4-line Fortran program

  character(len('xyz')):: head1(2) = (/'a','b'/)
  character(3)         :: head2(2) = (/'x','y'/)
  write(*,*) head1,head2
  end program

gives an ICE with gfortran 4.7.1 or 4.8.2. It compiles and runs with gfortran
4.4.7 or 4.9.0 but gives what I believe to be wrong output: those compiler
versions treated head1 as being declared with length 1. G95 version 0.94, ifort
version 14.0.0 and Sun Fortran 8.6 all get it right, declaring head1 with
length 3.

With version 4.8.2 (same ICE message  with 4.7.1 except for varasm.c:4821):

cayley[~/Jfh] % gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /build/gcc/src/gcc-4.8-20131219/configure --prefix=/usr
--libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch
--disable-libssp --enable-gnu-unique-object --enable-linker-build-id
--enable-cloog-backend=isl --disable-cloog-version-check --enable-lto
--enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu
--disable-multilib --disable-werror --enable-checking=release
Thread model: posix
gcc version 4.8.2 20131219 (prerelease) (GCC) 
cayley[~/Jfh] % gfortran gfbug.f90
gfbug.f90:4:0: internal compiler error: in output_constructor_regular_field, at
varasm.c:4813
 end program
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> for instructions.
cayley[~/Jfh] % 

With 4.9.0 (same result with 4.4.7):

cayley[~/Jfh] % gf gfbug.f90
cayley[~/Jfh] % ./a.out
 abx  y  
cayley[~/Jfh] % 

It seems that head1 was declared with length 1 instead of len('xyz') which is
3;
I believe the 4.9.0 output should have been
   a  b  x  y 
which is what g95, Intel and Sun all gave.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug fortran/61627] specification expression ICE with version 4.7.1 and 4.8.2, incorrect output with 4.4.7 and 4.9.0
  2014-06-27  4:45 [Bug fortran/61627] New: specification expression ICE with version 4.7.1 and 4.8.2, incorrect output with 4.4.7 and 4.9.0 harper at msor dot vuw.ac.nz
@ 2014-07-01 22:42 ` harper at msor dot vuw.ac.nz
  0 siblings, 0 replies; 2+ messages in thread
From: harper at msor dot vuw.ac.nz @ 2014-07-01 22:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61627

--- Comment #2 from harper at msor dot vuw.ac.nz ---
My diagnosis of the gfortran 4.9.0 error was misleading. Len(head1) was not 1
as
I had thought but 3, so the wrong output may have been due to the
initialization or the write statement, as the following modified program (still
4 lines) and its output show. Version 4.8.2 still gives an ICE with the same
compile-time message.

cayley[~/Jfh] % cat gfbug2.f90
  character(len('xyz')):: head1(2) = (/'a','b'/)
  character(3)         :: head2(2) = (/'x','y'/)
  write(*,'(4A,2I2)') head1,head2,len(head1),len(head2)
end program
cayley[~/Jfh] % gf -v
Using built-in specs.
COLLECT_GCC=/local/scratch/gf/bin/gfortran
COLLECT_LTO_WRAPPER=/local/scratch/gf/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /local/scratch/gcc-4.9.0/configure --prefix=/local/scratch/gf
--enable-languages=c,fortran --disable-libada
--with-local-prefix=/local/scratch --with-gmp=/local/scratch
--with-mpc=/local/scratch/mpc-0.9
Thread model: posix
gcc version 4.9.0 (GCC) 
cayley[~/Jfh] % gf gfbug2.f90
cayley[~/Jfh] % ./a.out
abx  y   3 3
cayley[~/Jfh] %


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-07-01 22:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-27  4:45 [Bug fortran/61627] New: specification expression ICE with version 4.7.1 and 4.8.2, incorrect output with 4.4.7 and 4.9.0 harper at msor dot vuw.ac.nz
2014-07-01 22:42 ` [Bug fortran/61627] " harper at msor dot vuw.ac.nz

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).