https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104551
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Summary|Wrong code with -O3 for |[12 Regression] Wrong code |skylake-avx512, |with -O3 for |icelake-server, and |skylake-avx512, |sapphirerapids |icelake-server, and | |sapphirerapids Target Milestone|--- |12.0 Ever confirmed|0 |1 Last reconfirmed| |2022-02-15 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Confirmed, single file version: unsigned int var_11 = 16U; unsigned int var_178 = 0; unsigned char arr_492 [128]; [[gnu::noipa]] void test() { for (bool a = 0; a < (bool)var_11; a = 2) for (unsigned b = 0; b < var_11; b += 1) var_178 = arr_492[b] ? arr_492[b] : (char) b; } int main() { for (int i = 0; i < 128; ++i) arr_492 [i] = (unsigned char)128; test(); __builtin_printf("%u\n", var_178); if (var_178 != 128) __builtin_abort(); return 0; } ----- CUT ----- I increasing the array size to 128 allowed me to merge it, I don't know why though; maybe because it allowed the code to be vectorize while 16 was not going to.