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