From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4361 invoked by alias); 27 Jun 2014 04:45:26 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 4335 invoked by uid 48); 27 Jun 2014 04:45:21 -0000 From: "harper at msor dot vuw.ac.nz" To: gcc-bugs@gcc.gnu.org Subject: [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 Date: Fri, 27 Jun 2014 04:45:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: harper at msor dot vuw.ac.nz X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-06/txt/msg02193.txt.bz2 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 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.