Bug 35428 - [4.3 regression] ICE with "-ftrapv"
Summary: [4.3 regression] ICE with "-ftrapv"
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.4.0
: P2 normal
Target Milestone: 4.4.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-checking, ice-on-valid-code, monitored
Depends on:
Blocks:
 
Reported: 2008-03-03 19:50 UTC by Volker Reichelt
Modified: 2010-04-20 13:40 UTC (History)
9 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 4.3.4
Last reconfirmed: 2008-08-12 15:16:54


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2008-03-03 19:50:39 UTC
The following valid code snippet triggers an ICE on mainline and 4.3 branch
when compiled with "-ftrapv -O3":

================================
void foo(int x[])
{
  int i, j;

  for (i = 0; i < 2; i++)
    for (j = 0; j < 2; j++)
    {
      x[i] = x[i*j];
      x[i] = x[i*j];
    }
}
================================

bug.c: In function 'foo':
bug.c:2: internal compiler error: tree check: expected integer_cst, have polynomial_chrec in int_cst_value, at tree.c:7968
Please submit a full bug report, [etc.]
Comment 1 pinskia@gmail.com 2008-03-03 20:14:24 UTC
Subject: Re:   New: [4.3/4.4 regression] ICE with "-ftrapv"

This is caused by the vectorizer.

Sent from my iPhone

On Mar 3, 2008, at 11:50, "reichelt at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org 
 > wrote:

> The following valid code snippet triggers an ICE on mainline and 4.3  
> branch
> when compiled with "-ftrapv -O3"

-- Pinski
Comment 2 Volker Reichelt 2008-03-03 20:29:04 UTC
> This is caused by the vectorizer.

Indeed. The ICE appears also with "-ftrapv -O -ftree-vectorize".
(This still compiles fine on the 4.2 branch.)
Comment 3 Ira Rosen 2008-03-04 13:30:42 UTC
It fails in initialize_matrix_A() when called with chrec {0, +, {0, +, 4}_1}_2:
int_cst_value (CHREC_RIGHT (chrec)) ICEs, since CHREC_RIGHT (chrec) here is {0, +, 4}_1.

Ira
Comment 4 Ira Rosen 2008-03-04 15:44:26 UTC
Isn't the same problem as in pr34635?

Ira
Comment 5 Richard Biener 2008-03-14 17:15:01 UTC
As I can no longer reproduce this I assume so.

*** This bug has been marked as a duplicate of 34635 ***
Comment 6 Volker Reichelt 2008-03-14 20:45:33 UTC
No, it's not a duplicate.
The bug is still present on mainline and 4.3 branch from 2008-03-12
(at least on i686-pc-linux-gnu).
Comment 7 Volker Reichelt 2008-05-31 00:51:51 UTC
The bug disappeared on mainline between 2008-04-25 and 2008-05-03.
Comment 8 Richard Biener 2008-06-06 14:59:07 UTC
4.3.1 is being released, adjusting target milestone.
Comment 9 Aldy Hernandez 2008-08-06 10:18:04 UTC
I can no longer reproduce this on either the 4.3 branch or mainline.  Volker, can you check on your end?

If there is no update, I will close at the end of the week.
Comment 10 Volker Reichelt 2008-08-12 06:45:15 UTC
The bug is still present on the 4.3 branch as of 2008-08-11 (with both the C and C++ frontend).
Comment 11 Aldy Hernandez 2008-08-12 14:21:51 UTC
Still can't reproduce.  What target are you compiling for?

Verify my steps below, and see if there's any discrepancy in what you are doing.

anquetil:/build/43/gcc$ ./cc1 --version
GNU C (GCC) version 4.3.2 20080812 (prerelease) [gcc-4_3-branch revision 139018] (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.1.2 20070925 (Red Hat 4.1.2-33), GMP version 4.2.2, MPFR version 2.3.0-p2.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
anquetil:/build/43/gcc$ ./cc1 a.c -O3 -ftrapv -quiet
anquetil:/build/43/gcc$ ./cc1plus a.c -O3 -ftrapv -quiet
anquetil:/build/43/gcc$ ./cc1 a.c -ftrapv -O -ftree-vectorize -quiet
anquetil:/build/43/gcc$ ./cc1plus a.c -ftrapv -O -ftree-vectorize -quiet
anquetil:/build/43/gcc$ uname -a
Linux anquetil.quesejoda.com 2.6.24.7-92.fc8 #1 SMP Wed May 7 16:26:02 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux
anquetil:/build/43/gcc$ cat a.c
void foo(int x[])
{
  int i, j;

  for (i = 0; i < 2; i++)
    for (j = 0; j < 2; j++)
    {
      x[i] = x[i*j];
      x[i] = x[i*j];
    }
}
Comment 12 Volker Reichelt 2008-08-12 14:37:59 UTC
I'm using i686-pc-linux-gnu.
On x86_64-unknown-linux-gnu you probably need to add "-m32" to the flags.
Comment 13 Aldy Hernandez 2008-08-12 15:02:34 UTC
Nope, still can't reproduce with i686-pc-linux-gnu, or with x86-64-linux using -m32.  FWIW, Jakub can't reproduce it either.

Can anyone beside Volker reproduce this?  If nobody else can't, I'm inclined to say it's a problem on Volker's setup, and close the PR.
Comment 14 Richard Biener 2008-08-12 15:16:37 UTC
Fails for me on a x86_64 -> i586-linux cross

./cc1 -quiet -O3 -ftrapv /tmp/t.c
/tmp/t.c: In function 'foo':
/tmp/t.c:2: internal compiler error: tree check: expected integer_cst, have polynomial_chrec in int_cst_value, at tree.c:8078
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

you probably need to configure with --enable-checking.
Comment 15 Volker Reichelt 2008-08-13 07:34:59 UTC
As I alredy guessed in comment #12, the testcase really fails on native
x86_64-unknown-linux-gnu with "-m32 -O3 -ftrapv".

As this is a "tree check" ICE you really need to configure the compiler
with --enable-checking to see it.
Comment 16 Joseph S. Myers 2008-08-27 22:03:25 UTC
4.3.2 is released, changing milestones to 4.3.3.
Comment 17 Richard Biener 2009-01-24 10:20:10 UTC
GCC 4.3.3 is being released, adjusting target milestone.
Comment 18 Richard Biener 2009-08-04 12:28:50 UTC
GCC 4.3.4 is being released, adjusting target milestone.
Comment 19 Richard Biener 2010-04-20 13:40:51 UTC
WONTFIX on the 4.3 branch.