This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/54458] [4.8 Regression] ICE get_loop_body, at cfgloop.c:830


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54458

--- Comment #4 from Francesco Zappa Nardelli <francesco.zappa.nardelli at gmail dot com> 2012-09-02 17:55:10 UTC ---
Just to be precise, the program has an undefined behaviour in the test of the
first 'if':

  (c ? 0 : 0 % 0)

because the right operand of % cannot be 0 (according to the standard,
Â6.5.5#5).  Unclear to me if a compiler is allowed to crash on programs with
undefined behaviours or not.  

However an undefined-behaviour free (I believe) variant of that code makes gcc
crash similarly:

int g_24[][0];
int g_42;
int g_168[];

void func_34 (p_38) {
lbl_424:
  if (g_24[0][0] == 0 ? 1 : 1 % (g_24[0][0]))
    for (; g_42; g_42--)
lbl_130: {
    }
  else if (p_38)
    for (;;) {
    }
  if (g_168[0])
    goto lbl_130;
  goto lbl_424;
}

void main () {
  g_24[0][0] = 1;
  func_34(0);
}

$ gcc -O3 input.c   (gcc version 4.8.0 20120902 (experimental) (GCC) )

input-hand.c: In function 'func_34':
input-hand.c:5:6: internal compiler error: in get_loop_body, at cfgloop.c:823
 void func_34 (p_38) {
      ^
Please submit a full bug report.

Not sure that it helps, but while I was performing test-case reduction I
noticed that the % operator plays a key role in making gcc crash here.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]