https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79334
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org --- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- So we don't do the hoisting for int d[][8]; extern void func_that_exits (int); int main (void) { int e; while (1) { func_that_exits (e); e = d[1000][0]; } return 0; } which is because func_that_exits may clobber it which it can't if d is static readonly. So we hoist it for const int d[8]; extern void func_that_exits (int); int main (void) { int e; while (1) { func_that_exits (e); e = d[10]; } return 0; } Mine.