[Bug c++/86871] ICE: gimple check: expected gimple_assign(error_mark), have gimple_call(trunc_mod_expr) in gimple_assign_lhs, at gimple.h:2462

2018-08-06 Thread slyfox at inbox dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86871

Sergei Trofimovich  changed:

   What|Removed |Added

  Attachment #44511|0   |1
is obsolete||

--- Comment #2 from Sergei Trofimovich  ---
Created attachment 44512
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44512=edit
a.cc

[Bug c++/86871] ICE: gimple check: expected gimple_assign(error_mark), have gimple_call(trunc_mod_expr) in gimple_assign_lhs, at gimple.h:2462

2018-08-06 Thread slyfox at inbox dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86871

--- Comment #1 from Sergei Trofimovich  ---
Managed to get rid of templates. Looks like use of uninitialized 'i' is somehow
the culprit:

int *f;
struct g {
  g() {
f = new int;
aj = f;
  }
  int [](int h) { return *(aj + h); }
  int *aj;
};
void j() {
  g b;
  g c;
  for (int i; i; i++) {
int d = 0;
for (int e = -1; e <= 1; e++) {
  int a = i + e;
  if (a)
d = b[a];
}
c[i] = d;
  }
}