Bug 42956 - [4.4 Regression] internal compiler error: Segmentation fault with -O1
Summary: [4.4 Regression] internal compiler error: Segmentation fault with -O1
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.4.3
: P1 major
Target Milestone: 4.4.4
Assignee: Richard Biener
URL:
Keywords: ice-on-valid-code, patch
Depends on:
Blocks:
 
Reported: 2010-02-04 14:22 UTC by Peter Breitenlohner
Modified: 2010-04-08 11:47 UTC (History)
1 user (show)

See Also:
Host: i686-linux-gnu
Target: i686-linux-gnu
Build: i686-linux-gnu
Known to work: 4.3.5 4.4.2 4.5.0
Known to fail: 4.4.3
Last reconfirmed: 2010-02-05 14:59:04


Attachments
preprocessed source (63.92 KB, text/plain)
2010-02-04 14:27 UTC, Peter Breitenlohner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Breitenlohner 2010-02-04 14:22:25 UTC
When building Cuba-1.6 (http://www.feynarts.de/cuba/Cuba-1.6.tar.gz)
via configure && make, there is an internal compiler error (segmentation fault) in the compilation of Divonne.c.  This may or may not be related to #41155.

gcc says:
gcc-4.4.3 -O3 -fomit-frame-pointer -ffast-math -DHAVE_CONFIG_H -I../Cuba-1.6/src/common -I. -I../Cuba-1.6 -I../Cuba-1.6/src/divonne -c -o Divonne.o ../Cuba-1.6/src/divonne/Divonne.c
In file included from ../Cuba-1.6/src/divonne/common.c:19,
                 from ../Cuba-1.6/src/divonne/Divonne.c:41:
../Cuba-1.6/src/divonne/Split.c: In function 'Split':
../Cuba-1.6/src/divonne/Split.c:275: internal compiler error: Segmentation fault

This error occurs for gcc-4.4.3 with -O3, -O2, and -O1 but neither with -O0 nor for gcc-4.4.2
Comment 1 Paolo Carlini 2010-02-04 14:26:44 UTC
Please follow the instructions here

  http://gcc.gnu.org/bugs/#report

provide a preprocessed file. Thanks.
Comment 2 Peter Breitenlohner 2010-02-04 14:27:26 UTC
Created attachment 19804 [details]
preprocessed source
Comment 3 Richard Biener 2010-02-04 15:44:03 UTC
Confirmed at -O2.  Reducing.

../Cuba-1.6/src/divonne/Split.c: In function 'Split':
../Cuba-1.6/src/divonne/Split.c:275:13: error: expected an SSA_NAME object
../Cuba-1.6/src/divonne/Split.c:275:13: error: in statement
D.15203_353 = D.8489 /[ex] 8;
../Cuba-1.6/src/divonne/Split.c:275:13: internal compiler error: verify_ssa failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 4 Richard Biener 2010-02-04 15:54:21 UTC
typedef const int cint;
typedef struct {
} Bounds;
int ndim_, ncomp_, selectedcomp_, nregions_;
void *voidregion_;
typedef struct {
    double diff, err, spread;
} Errors;
typedef const Errors cErrors;
void Split(int iregion, int depth, int xregion)
{
  typedef struct {
      double avg, err, spread, chisq;
      double xmin[ndim_], xmax[ndim_];
  } Result;
  typedef struct region {
      Result result[ncomp_];
  } Region;
  Errors errors[ncomp_];
  int comp, ireg, xreg;
  double tmp;
  for( ireg = iregion, xreg = xregion; ireg < nregions_; ireg = xreg++ )
    {
      Result *result = ((Region *)voidregion_)[ireg].result;
      for( comp = 0; comp < ncomp_; ++comp )
        {
          Result *r = &result[comp];
          cErrors *e = &errors[comp];
          double c = tmp*e->diff;
          if( r->err > 0 ) r->err = r->err*e->err + c;
        }
    }
}
Comment 5 Richard Biener 2010-02-05 14:59:04 UTC
Mine.
Comment 6 Richard Biener 2010-02-07 13:43:04 UTC
Subject: Bug 42956

Author: rguenth
Date: Sun Feb  7 13:42:52 2010
New Revision: 156571

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156571
Log:
2010-02-07  Richard Guenther  <rguenther@suse.de>

	PR middle-end/42956
	* gimplify.c (gimple_fold_indirect_ref): Avoid generating
	new ARRAY_REFs on variable size element or minimal index arrays.
	Complete.
	* tree-ssa-loop-ivopts.c (find_interesting_uses_address): Use
	gimple_fold_indirect_ref.

	* gcc.c-torture/compile/pr42956.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr42956.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimplify.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-loop-ivopts.c

Comment 7 Richard Biener 2010-02-07 13:43:24 UTC
Fixed for 4.5.0 sofar.
Comment 8 Richard Biener 2010-02-07 13:43:58 UTC
P1 for a regression on a release branch.
Comment 9 Steven Bosscher 2010-03-21 14:35:42 UTC
Still needs to be applied to GCC 4.4.
Comment 10 Richard Biener 2010-04-01 13:20:52 UTC
The "Complete." part shouldn't be backported.
Comment 11 Richard Biener 2010-04-08 11:47:26 UTC
Subject: Bug 42956

Author: rguenth
Date: Thu Apr  8 11:47:13 2010
New Revision: 158123

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=158123
Log:
2010-04-08  Richard Guenther  <rguenther@suse.de>

	PR middle-end/42956
	* gimplify.c (gimple_fold_indirect_ref): Avoid generating
	new ARRAY_REFs on variable size element or minimal index arrays.
	* tree-ssa-loop-ivopts.c (find_interesting_uses_address): Use
	gimple_fold_indirect_ref.

	* gcc.c-torture/compile/pr42956.c: New testcase.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42956.c
Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/gimplify.c
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_4-branch/gcc/tree-ssa-loop-ivopts.c

Comment 12 Richard Biener 2010-04-08 11:47:55 UTC
Fixed.