PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / pr19831-1.c
blob9d6e233a51e6bf04bf97bc6ba212945f0a0f54d0
1 /* { dg-do compile } */
2 /* { dg-options "-O -fdump-tree-optimized" } */
4 void test1(void)
6 int *p = __builtin_malloc (sizeof (int) * 4);
7 int *q = p;
8 *q++ = 4;
9 *q++ = 4;
10 __builtin_free (p);
13 void test3(int b)
15 int *p = __builtin_malloc (sizeof (int) * 4);
16 if (b)
17 __builtin_free (p);
18 *p = 5;
21 void test4(int b)
23 int *p = __builtin_malloc (sizeof (int) * 4);
24 if (b)
25 __builtin_free (p);
26 *p = 5;
27 __builtin_free (p);
30 /* { dg-final { scan-tree-dump-times "free" 0 "optimized" } } */
31 /* { dg-final { scan-tree-dump-times "malloc" 0 "optimized" } } */