https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86711
Bug ID: 86711
Summary: wrong folding of memchr
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: bernd.edlinger at hotmail dot de
Target Milestone: ---
This example generates wrong code:
$ cat part.c
static const char a[2][4] = { "1234", "5678" };
int main ()
{
void *p = __builtin_memchr (a, 0, 5);
if (p)
__builtin_abort ();
}
$ gcc part.c
$ ./a.out
Aborted (core dumped)