Require target lra in gcc.dg/pr108095.c
[official-gcc.git] / gcc / testsuite / gcc.dg / memchr-2.c
blob61357f96d12f177e86b3b4af66439ff4a5432120
1 /* PR tree-optimization/96670 - ICE on memchr with an empty initializer
2 { dg-do compile }
3 { dg-options "-O -Wall -fdump-tree-optimized" } */
5 struct {
6 int i, j;
7 } const s = { };
9 void memchr_success_unused (void)
11 int n = (char *)&s.j - (char *)&s;
12 char *p = (char *)&s;
13 __builtin_memchr (p, '\0', n);
16 void memchr_success_used (void)
18 int n = (char *)&s.j - (char *)&s;
19 char *p = (char *)&s;
20 if (&s != __builtin_memchr (p, '\0', n))
21 __builtin_abort ();
24 void memchr_fail_unused (void)
26 int n = (char *)&s.j - (char *)&s;
27 char *p = (char *)&s;
28 __builtin_memchr (p, '\5', n);
31 void memchr_fail_used (void)
33 int n = (char *)&s.j - (char *)&s;
34 char *p = (char *)&s;
35 if (__builtin_memchr (p, '\5', n))
36 __builtin_abort ();
39 /* { dg-prune-output "\\\[-Wunused-value" }
40 { dg-final { scan-tree-dump-not "abort" "optimized" } }
41 { dg-final { scan-tree-dump-not "memcmp \\(" "optimized" } } */