Bug 61279 - [4.10 Regression] ICE in loop_preheader_edge, at cfgloop.c:1668 w/ -O1 -ftree-loop-vectorize
Summary: [4.10 Regression] ICE in loop_preheader_edge, at cfgloop.c:1668 w/ -O1 -ftree...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 5.0
: P3 normal
Target Milestone: 5.0
Assignee: Richard Biener
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2014-05-22 02:12 UTC by Arseny Solokha
Modified: 2014-05-26 08:30 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work: 4.7.3, 4.8.2, 4.9.0
Known to fail: 4.10.0
Last reconfirmed: 2014-05-22 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arseny Solokha 2014-05-22 02:12:32 UTC
gcc-4.10.0-alpha20140518 fails when compiling the following code w/ -ftree-loop-vectorize -O1 and above:

int z;
int d;

int
n(void)
{
  int s;
  int *q;
  for (s = 0; s < 1; ++s) {
    int b;
    for (d = 0; d < 1; ++d)
      return 0;
    for (b = 0; b < 1; ++b) {
      int o[1] = { 0 };
      q = &o[b];
    }
    for (z = 0; z < 1; ++z)
      return 0;
  }
  return *q;
}

bb234e61.c: In function 'n':
bb234e61.c:21:1: internal compiler error: in loop_preheader_edge, at cfgloop.c:1668

4.10.0-alpha20140411 works well here.
Comment 1 Richard Biener 2014-05-22 08:26:20 UTC
I'll have a look.
Comment 2 Richard Biener 2014-05-23 08:06:45 UTC
I cannot reproduce this.  What architecture do you see the ICE on?
Comment 3 Arseny Solokha 2014-05-23 08:46:59 UTC
x86_64-pc-linux-gnu (both host and target), powerpc-e500v2-linux-gnuspe (likewise).
Comment 4 Arseny Solokha 2014-05-25 16:12:00 UTC
I even have another reproducer which is basically identical to the original one but not completely.

int t;
int n[1] = { 0 };

void
x(void)
{
  int v;
  int r;
  int i[4] = { 0 };
  for (v = 0; v < 1; ++v) {
    ++i[3];
    for (r = 0; r < 1; ++r) {
      for (t = 0; t < 1; ++t)
        return;
      for (t = 0; t < 1; ++t)
        /* Irregardless of i's declared size, the ICE only occurs
           when the array subscript on lines 18 and 11 is exactly 3
           (I've checked only the nearest values, however). */
        i[3] = n[t];
      for (t = 0; t < 1; ++t)
        return;
    }
  }
}
Comment 5 Arseny Solokha 2014-05-26 08:09:57 UTC
OK, it seems to be accidentally fixed somewhere between the two snapshots as now I'm also unable to reproduce it w/ 4.10.0-alpha20140525.
Comment 6 Richard Biener 2014-05-26 08:30:39 UTC
Thanks.