https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84339
Bug ID: 84339 Summary: [8 Regression] Wrong-code with optimizing strlen Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: mpolacek at gcc dot gnu.org Target Milestone: --- Hunspell's test alias3 fails. Distilled testcase: typedef __SIZE_TYPE__ size_t; struct S { int a; char b[1]; }; __attribute__((noipa)) size_t foo (struct S *p) { return __builtin_strlen (&p->b[0]); } __attribute__((noipa)) size_t bar (struct S *p) { return __builtin_strlen (p->b); } int main () { struct S *p = __builtin_malloc (sizeof (struct S) + 16); if (p) { p->a = 1; __builtin_strcpy (p->b, "abcdefg"); if (foo (p) != 7 || bar (p) != 7) __builtin_abort (); __builtin_free (p); } return 0; } Started with r256457.