With recent trunk, gfortran incorrectly generates an error for the following standard code: INTEGER, PARAMETER :: K=1 INTEGER :: I I=TRANSFER(.TRUE.,K) SELECT CASE(I) CASE(TRANSFER(.TRUE.,K)) CASE(TRANSFER(.FALSE.,K)) CALL ABORT() CASE DEFAULT CALL ABORT() END SELECT I=TRANSFER(.FALSE.,K) SELECT CASE(I) CASE(TRANSFER(.TRUE.,K)) CALL ABORT() CASE(TRANSFER(.FALSE.,K)) CASE DEFAULT CALL ABORT() END SELECT END
With Target: powerpc-apple-darwin7, gcc version 4.3.0 20070216, plus patch for PR #30400, I have: [address=437ffffc pc=42343560] pr30881.f90:0: internal compiler error: Segmentation Fault Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions.
I cannot reproduce the ICE with 4.3.0 20070220/x86_64-unknown-linux-gnu. I get the following error: CASE(TRANSFER(.TRUE.,K)) 1 foo.f90:6.5: CASE(TRANSFER(.FALSE.,K)) 2 Error: CASE label at (1) overlaps with CASE label at (2) The file compiles correctly with NAGf95, g95 and ifort. (However, ifort calls wrongly the second abort.)
I also get the ICE on i686-linux. We get into compare_cases (resolve.c) and try to compare op1->high and op2->low, but both are functions and not constants, so the values in op1->high->value are meaningless, and comparing them yields random segfaults. If we get it past that point, we later ICE in gfc_conv_constant_to_tree, at fortran/trans-const.c:278 (because the expr is not an EXPR_CONSTANT). This will all be fixed when the simplifcation routine for TRANSFER is written.
(In reply to comment #3) > fortran/trans-const.c:278 (because the expr is not an EXPR_CONSTANT). This will > all be fixed when the simplifcation routine for TRANSFER is written. FX, You are correct - this is effectively PR18769. Paul
Subject: Bug 30881 Author: pault Date: Wed May 16 05:40:51 2007 New Revision: 124759 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124759 Log: 2007-05-16 Brooks Moses <brooks.moses@codesourcery.com> PR fortran/18769 PR fortran/30881 PR fortran/31194 PR fortran/31216 PR fortran/31427 * target-memory.c: New file. * target-memory.h: New file. * simplify.c: Add #include "target-memory.h". (gfc_simplify_transfer): Implement constant- folding for TRANSFER intrinsic. * Make-lang.in: Add dependencies on new target-memory.* files. 2007-05-16 Paul Thomas <pault@gcc.gnu.org> PR fortran/18769 PR fortran/30881 PR fortran/31194 PR fortran/31216 PR fortran/31427 * transfer_simplify_1.f90: New test. * transfer_simplify_2.f90: New test. Added: trunk/gcc/fortran/target-memory.c trunk/gcc/fortran/target-memory.h trunk/gcc/testsuite/gfortran.dg/transfer_simplify_1.f90 trunk/gcc/testsuite/gfortran.dg/transfer_simplify_2.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/Make-lang.in trunk/gcc/fortran/simplify.c trunk/gcc/testsuite/ChangeLog
Fixed on trunk Paul and Brooks