Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/calloc-1.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
3
4 extern int a;
5 extern int *b;
6 int n;
7 void* f(long *q)
8 {
9 int *p = __builtin_malloc (n);
10 ++*q;
11 if (p)
12 {
13 ++*q;
14 a = 2;
15 __builtin_memset (p, 0, n);
16 *b = 3;
17 }
18 return p;
19 }
20 void* g(void)
21 {
22 float *p = __builtin_calloc (8, 4);
23 return __builtin_memset (p, 0, 24); // not 32
24 }
25
26 /* { dg-final { scan-tree-dump-times "calloc" 2 "optimized" } } */
27 /* { dg-final { scan-tree-dump-not "malloc" "optimized" } } */
28 /* { dg-final { scan-tree-dump-not "memset" "optimized" } } */