https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119973
Bug ID: 119973 Summary: [15/16 Regression] Wrong code at -O1 -fipa-pta -flto Product: gcc Version: 16.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ipa Assignee: unassigned at gcc dot gnu.org Reporter: xry111 at gcc dot gnu.org Target Milestone: --- $ cat bug.c int is_valid_domain_name (const char *string) { const char *s; for (s=string; *s; s++) if (*s == '.') { if (string == s) return 0; } return !!*string; } int main (void) { static struct { const char *name; int valid; } testtbl[] = { { ".", 0 }, { nullptr, 0 } }; int idx; for (idx=0; testtbl[idx].name; idx++) { if (is_valid_domain_name (testtbl[idx].name) != testtbl[idx].valid) __builtin_abort (); } } $ cc bug.c -std=c23 -O1 -fipa-pta -flto $ ./a.out [1] 301695 IOT instruction (core dumped) ./a.out Removing any of -fipa-pta -flto can work around the issue. The code is reduced from gnupg-2.4.7, it only fails at -O1 but the original gnupg code fails at -O2 and -O3 as well. The output of GCC 14 is fine.