#!/bin/sh cat >bug.f <<\EOF FUNCTION TSL(PIN) ! EXTERNAL PPP ENTRY TSL1(PIN) IF (DBLE(TSL) .GT. PIN) TSL = 705.47 TSL= PPP(TSL) END EOF ( exec 2>&1 uname -a set -x gfortran --version gfortran -v -c -save-temps bug.f ls -ltrasd bug* echo ========================================= cat bug.i* echo ========================================= #cat bug.s echo ========================================= ) | tee -a $0 exit ######################################################################## CYGWIN_NT-5.1 electra 1.5.12(0.116/4/2) 2004-11-10 08:34 i686 unknown unknown Cygwin + gfortran --version GNU Fortran 95 (GCC) 4.2.0 20060420 (experimental) Copyright (C) 2006 Free Software Foundation, Inc. GNU Fortran comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of GNU Fortran under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING + gfortran -v -c -save-temps bug.f Using built-in specs. Target: i686-pc-cygwin Configured with: ../trunk/configure --prefix=/irun --with- mpfr=/usr/local/gmp --with-gmp=/usr/local/gmp --enable- languages=c,fortran --disable-bootstrap : (reconfigured) ../trunk/configure --prefix=/irun --with-mpfr=/usr/local/gmp --with- gmp=/usr/local/gmp --enable-languages=c,fortran --disable-bootstrap : (reconfigured) ../trunk/configure --prefix=/irun --with- mpfr=/usr/local/gmp --with-gmp=/usr/local/gmp --disable-bootstrap --enable-languages=c,fortran --no-create --no-recursion : (reconfigured) ../trunk/configure --prefix=/irun --with-mpfr=/usr/local/gmp --with- gmp=/usr/local/gmp --disable-bootstrap --enable-languages=c,fortran --no-create --no-recursion : (reconfigured) ../trunk/configure --prefix=/irun --with-mpfr=/usr/local/gmp --with-gmp=/usr/local/gmp --disable-bootstrap --enable-languages=c,fortran --no-create --no- recursion : (reconfigured) ../trunk/configure --prefix=/irun --with- mpfr=/usr/local/gmp --with-gmp=/usr/local/gmp --disable-bootstrap --enable-languages=c,fortran --no-create --no-recursion : (reconfigured) ../trunk/configure --prefix=/irun --with-mpfr=/usr/local/gmp --with- gmp=/usr/local/gmp --disable-bootstrap --enable-languages=c,fortran --no-create --no-recursion : (reconfigured) ../trunk/configure --prefix=/irun --with-mpfr=/usr/local/gmp --with-gmp=/usr/local/gmp --disable-bootstrap --enable-languages=c,fortran --no-create --no- recursion : (reconfigured) ../trunk/configure --prefix=/irun --with- mpfr=/usr/local/gmp --with-gmp=/usr/local/gmp --disable-bootstrap --enable-languages=c,fortran : (reconfigured) ../trunk/configure --prefix=/irun --with-mpfr=/usr/local/gmp --with-gmp=/usr/local/gmp --disable-bootstrap --enable-languages=c,fortran --no-create --no- recursion : (reconfigured) ../trunk/configure --prefix=/irun --with- mpfr=/usr/local/gmp --with-gmp=/usr/local/gmp --disable-bootstrap --enable-languages=c,fortran --enable-languages=c,fortran --no-create --no-recursion : (reconfigured) ../trunk/configure --prefix=/irun --with-mpfr=/usr/local/gmp --with-gmp=/usr/local/gmp --disable-bootstrap --enable-languages=c,fortran --enable-languages=c,fortran --no-create --no-recursion : (reconfigured) ../trunk/configure --prefix=/irun --with-mpfr=/usr/local/gmp --with-gmp=/usr/local/gmp --disable-bootstrap --enable-languages=c,fortran --enable-languages=c,fortran --no-create --no-recursion : (reconfigured) ../trunk/configure --prefix=/irun --with-mpfr=/usr/local/gmp --with-gmp=/usr/local/gmp --disable-bootstrap --enable-languages=c,fortran --enable-languages=c,fortran --no-create --no-recursion Thread model: single gcc version 4.2.0 20060420 (experimental) /usr/local/irun/bin/../libexec/gcc/i686-pc-cygwin/4.2.0/f951.exe bug.f -ffixed-form -quiet -dumpbase bug.f -mtune=generic -auxbase bug -version -I /usr/local/irun/bin/../lib/gcc/i686-pc-cygwin/4.2.0/finclude -o bug.s GNU F95 version 4.2.0 20060420 (experimental) (i686-pc-cygwin) compiled by GNU C version 3.2 20020927 (prerelease). GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 bug.f: In function 'master.0.tsl': bug.f:5: error: invalid operand to binary operator __result_master.0.tslD.917 bug.f:5: internal compiler error: verify_stmts failed Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. + ls -ltrasd bug.f bug.ksh bug.o bug.s bug1 1 -rw-r--r-- 1 urbanjs None 672 Dec 13 23:34 bug.ksh 1 -rw-r--r-- 1 urbanjs None 812 Feb 12 23:32 bug1 1 -rw-r--r-- 1 urbanjs None 537 May 8 00:44 bug.o 1 -rw-r--r-- 1 urbanjs None 139 May 8 00:52 bug.f 1 -rw-r--r-- 1 urbanjs None 557 May 8 00:52 bug.s + echo ========================================= ========================================= + cat bug.i* cat: bug.i*: No such file or directory + echo ========================================= ========================================= + echo ========================================= ========================================= urbanjs@electra ~ $
Created attachment 11400 [details] script that shows bug + output from running script
As far as I can tell it is a middle-end/gimplifier problem: real4 __result_master.0.tsl; real4 tsl.0 [value-expr: __result_master.0.tsl]; Unless the value expression should also be marked as TREE_ADDRESSABLE.
*** Bug 27889 has been marked as a duplicate of this bug. ***
I'm amazed that 27889 is a duplicate of this bug, although I agree that they have similar error messages. They happen in very different (and specific circumstances). FYI, the testcases from 27889 are: [on 4.1 at -O1 and higher] MODULE constraints_module REAL target CONTAINS SUBROUTINE init_constraint COMPLEX struc_fac CALL set_structure_factor RETURN CONTAINS SUBROUTINE set_structure_factor target = CONJG( struc_fac ) * struc_fac END SUBROUTINE set_structure_factor END SUBROUTINE init_constraint END MODULE constraints_module [on 4.2 at any optimization level] COMPLEX z CONTAINS SUBROUTINE foo z = z + z END SUBROUTINE foo END
(In reply to comment #4) > I'm amazed that 27889 is a duplicate of this bug, although I agree that they > have similar error messages. They happen in very different (and specific > circumstances). FYI, the testcases from 27889 are: The value handle is causing the regression but I will reopen that one as I found a C testcase and finding a C testcase for this bug is harder.
That one is annoying. Reduced testcase is: FUNCTION X() ENTRY X1 IF (X .GT. 0) CALL FOO(X) END The error message is: a.f: In function ‘master.0.x’: a.f:3: error: invalid operand to binary operator __result_master.0.xD.914 a.f:3: internal compiler error: verify_stmts failed And the original tree dump is: x () { return master.0.x (0); x1 () { return master.0.x (1); master.0.x (__entry) { real4 __result_master.0.x; real4 x.0 [value-expr: __result_master.0.x]; switch (__entry) { case 0:; goto L.2; case 1:; goto L.4; } L.2:; L.4:; if (x.0 > 0.0) { foo (&x.0); } else { (void) 0; } return __result_master.0.x; }
The gimplifier is going wrong. It first uses the value-expr and then forgets that can be addressable or maybe even worse we don't mark the result as addressable.
I think the following can workaround the middle-end problem: Index: trans-decl.c =================================================================== --- trans-decl.c (revision 117368) +++ trans-decl.c (working copy) @@ -1866,6 +1866,7 @@ TREE_PUBLIC (decl) = 0; TREE_USED (decl) = 1; GFC_DECL_RESULT (decl) = 1; + TREE_ADDRESSABLE (decl) = 1; layout_decl (decl, 0);
Subject: Bug number PR 27478 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-10/msg00098.html
Subject: Bug 27478 Author: fxcoudert Date: Tue Oct 3 13:44:09 2006 New Revision: 117396 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117396 Log: PR middle-end/27478 * trans-decl.c (gfc_get_fake_result_decl): Mark var as TREE_ADDRESSABLE. * gfortran.dg/entry_8.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/entry_8.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/trans-decl.c trunk/gcc/testsuite/ChangeLog
Will not be fixed in 4.2.0; retargeting at 4.2.1.
Change target milestone to 4.2.3, as 4.2.2 has been released.
4.2.3 is being released now, changing milestones of open bugs to 4.2.4.
4.2.4 is being released, changing milestones to 4.2.5.
Closing 4.2 branch. The patch actually went on trunk before 4.2 branched.