Fix ICE in substring-handling building 502.gcc_r (PR 87562)
[official-gcc.git] / gcc / testsuite / c-c++-common / Wrestrict-3.c
blob30fc54e12b7535b748aae0f52b6074c47c8a156d
1 /* PR c/83989 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -Wrestrict" } */
5 __attribute__((__malloc__)) extern void *my_malloc (__SIZE_TYPE__);
6 void baz (void *);
8 #define SIZE 32
10 void
11 foo (void)
13 void *recmem = __builtin_malloc (SIZE);
14 baz (recmem);
15 while (1)
17 void *oldrecmem = recmem;
18 recmem = __builtin_malloc (SIZE);
19 if (!recmem)
21 __builtin_free (oldrecmem);
22 return;
24 __builtin_memcpy (recmem, oldrecmem, SIZE); /* { dg-bogus "accessing" } */
25 baz (recmem);
26 __builtin_free (oldrecmem);
30 void
31 bar (void)
33 void *recmem = my_malloc (SIZE);
34 baz (recmem);
35 while (1)
37 void *oldrecmem = recmem;
38 recmem = my_malloc (SIZE);
39 if (!recmem)
41 __builtin_free (oldrecmem);
42 return;
44 __builtin_memcpy (recmem, oldrecmem, SIZE); /* { dg-bogus "accessing" } */
45 baz (recmem);
46 __builtin_free (oldrecmem);