Bug 35475 - [4.2 Regression] gfortran fails to compile valid code with ICE erro in fold-const.c
Summary: [4.2 Regression] gfortran fails to compile valid code with ICE erro in fold-c...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.2.3
: P3 normal
Target Milestone: 4.2.4
Assignee: Jerry DeLisle
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2008-03-05 17:25 UTC by Simon Binnie
Modified: 2008-03-14 03:17 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.3.0 4.4.0
Known to fail: 4.1.3 4.2.2
Last reconfirmed: 2008-03-12 04:12:02


Attachments
Testcase (reduced from proprietary code). (206 bytes, text/plain)
2008-03-05 17:26 UTC, Simon Binnie
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Binnie 2008-03-05 17:25:23 UTC
gfortran fails to compile valid code, leads to ICE segfault, Code compiles fine under 4.1.2 .

command used:
 gfortran -v -save-temps -c -ffree-form ice.f

OUTPUT:

Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.2.3/configure --prefix=/scratch/sjb/local
Thread model: posix
gcc version 4.2.3
 /scratch/sjb/local/libexec/gcc/i686-pc-linux-gnu/4.2.3/f951 ice.f -quiet -dumpbase ice.f -mtune=generic -auxbase ice -version -ffree-form -I /scratch/sjb/local/lib/gcc/i686-pc-linux-gnu/4.2.3/finclude -o ice.s
GNU F95 version 4.2.3 (i686-pc-linux-gnu)
        compiled by GNU C version 4.2.3.
GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129260
ice.f: In function ‘subtwo’:
ice.f:51: internal compiler error: in fold_convert, at fold-const.c:2248
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 Simon Binnie 2008-03-05 17:26:45 UTC
Created attachment 15263 [details]
Testcase (reduced from proprietary code).

Testcase (reduced from proprietary code).
Comment 2 Simon Binnie 2008-03-05 17:34:05 UTC
(In reply to comment #0)
> gfortran fails to compile valid code, leads to ICE segfault, Code compiles fine
> under 4.1.2 .
> 
> command used:
>  gfortran -v -save-temps -c -ffree-form ice.f
> 
> OUTPUT:
> 
> Using built-in specs.
> Target: i686-pc-linux-gnu
> Configured with: ../gcc-4.2.3/configure --prefix=/scratch/sjb/local
> Thread model: posix
> gcc version 4.2.3
>  /scratch/sjb/local/libexec/gcc/i686-pc-linux-gnu/4.2.3/f951 ice.f -quiet
> -dumpbase ice.f -mtune=generic -auxbase ice -version -ffree-form -I
> /scratch/sjb/local/lib/gcc/i686-pc-linux-gnu/4.2.3/finclude -o ice.s
> GNU F95 version 4.2.3 (i686-pc-linux-gnu)
>         compiled by GNU C version 4.2.3.
> GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129260
> ice.f: In function ‘subtwo’:
> ice.f:51: internal compiler error: in fold_convert, at fold-const.c:2248
> Please submit a full bug report,
> with preprocessed source if appropriate.
> See <URL:http://gcc.gnu.org/bugs.html> for instructions.
> 

Sorry it's not a segfault (that was yesterdays problem...) as the output shows it's a problem with fold-const.c .
Comment 3 Daniel Franke 2008-03-05 17:51:44 UTC
Works on 4.1.2 (release), trunk (20080225) and 4.3 branch (20080219), fails for 4.2.4 (20080222).
Comment 4 Tobias Burnus 2008-03-05 17:55:00 UTC
Thanks for the report.  I can reproduce the problem with 4.2.3, however, it seems to be fixed in GCC/gfortran 4.3.0rc2 (and 4.4.0) - and as Daniel noted it used to worked with 4.1.3.

GCC 4.3.0 is supposted to be released at the end of this week (currently, we have release candidate 2). Any chance that you could upgrade your GCC and try again? Despite being a regression, I'm not sure it will be fixed soon as we need to find the fix first.

Binaries and a description how to build GCC from source can be found at http://gcc.gnu.org/wiki/GFortranBinaries Depending on your Linux distribution, they might have already experimental GCC 4.3.0 packages somewhere.
Changelog: http://gcc.gnu.org/gcc-4.3/changes.html
Comment 5 Andrew Pinski 2008-03-05 17:59:13 UTC
(In reply to comment #4)
> GCC 4.3.0 is supposted to be released at the end of this week (currently, we
> have release candidate 2). 

It is actually very closer to release than the end of the week, in fact it is being uploaded to the FTP sites right now :).  The official announcement will be made after some of the mirrors pick it up.

-- Pinski
Comment 6 Paul Thomas 2008-03-05 21:43:09 UTC
Simon and Tobias,

(In reply to comment #4)
> Thanks for the report.  I can reproduce the problem with 4.2.3, however, it
> seems to be fixed in GCC/gfortran 4.3.0rc2 (and 4.4.0) - and as Daniel noted it
> used to worked with 4.1.3.

I was responsible for much of the variability and regressions in this area.  Unfortunately, in spite of our my endeavours, the testsuite did not keep track of the regressions that I was generating.  I think that is OK now and that the regression in 4.2.3 was cause by fixing things that 4.1.3 did not dream about. 4.3.x and 4.4.0 are now much better.

Please accept my apologies for the temporary breakage.

Paul
Comment 7 Jerry DeLisle 2008-03-12 04:12:02 UTC
I will dejagnuize the test case and commit it.
Comment 8 Jerry DeLisle 2008-03-14 03:14:05 UTC
Subject: Bug 35475

Author: jvdelisle
Date: Fri Mar 14 03:13:17 2008
New Revision: 133205

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133205
Log:
2008-03-13  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/35475
	* gfortran.dg/derived_sub.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/derived_sub.f90
Modified:
    trunk/gcc/testsuite/ChangeLog

Comment 9 Jerry DeLisle 2008-03-14 03:17:29 UTC
Woks on trunk.  Test case committed to avoid future regression.