1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
3 
4 int n, nn;
f()5 void* f()
6 {
7   char *p = __builtin_calloc (n, 1);
8   p[42] = '\n';
9   __builtin_memset (p, 0, nn);
10   return p;
11 }
12 
g(int m1,int m2)13 void* g(int m1, int m2)
14 {
15   char *p = __builtin_malloc (m2);
16   while (--m1)
17   {
18     __builtin_memset (p, 0, m2);
19     p[n] = 'b';
20   }
21   return p;
22 }
23 
24 /* { dg-final { scan-tree-dump-times "malloc" 1 "optimized" } } */
25 /* { dg-final { scan-tree-dump-times "calloc" 1 "optimized" } } */
26 /* { dg-final { scan-tree-dump-times "memset" 2 "optimized" } } */
27