https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56210
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hubicka at gcc dot gnu.org Last reconfirmed|2013-02-05 00:00:00 |2025-2-18 --- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> --- ANTIC_OUT[2] := { {call_expr<strncmp>,addr_expr<";">,addr_expr<&key>,integer_cst<3>}@.MEM_5(D) that's not simplifed. We're also not trying to thread anything. One issue is that 'key' is not promoted read-only because it's passed to strncmp. The other issue is that PRE phi-translation (no longer?) simplifies references. It did so on GCC 7 but not after (I'm sure it wouldn't have worked there). For cases like this this looks relevant. Adjusted testcase to avoid the readonly issue: #include <string.h> #include <stdio.h> void f (void) { char *p = ";"; while (*p) { static const char key[] = "abc"; if (strncmp(p, key, 3) == 0) { p += 3; printf("%s\n", p); return; } if ((p = strchr(p, ';')) == NULL) return; p++; } }