https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98337
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2021-01-04 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- It could be optimized to return x even ... Note we're forcing the array to the stack because of the variable array access. We could optimize this on the GIMPLE level from MEM <unsigned long> [(int *)&a] = 3547642986509; _5 = a[x_4(D)]; to 3547642986509ul >> (x_4(D)*32) for example when using more "interesting" constants like int f(int x) { int a[] = {13, 826}; return a[x]; }