| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fdump-ipa-pure-const-details -fdelete-null-pointer-checks" } */ |
| 3 |
/* { dg-skip-if "" keeps_null_pointer_checks } */ |
| 4 |
|
| 5 |
__attribute__((noinline, no_icf, used)) |
| 6 |
static void *f(__SIZE_TYPE__ n) |
| 7 |
{ |
| 8 |
void *p = __builtin_malloc (n); |
| 9 |
if (p == 0) |
| 10 |
__builtin_abort (); |
| 11 |
return p; |
| 12 |
} |
| 13 |
|
| 14 |
__attribute__((noinline, no_icf, used)) |
| 15 |
static void *bar(__SIZE_TYPE__ n) |
| 16 |
{ |
| 17 |
void *p = f (n); |
| 18 |
return p; |
| 19 |
} |
| 20 |
|
| 21 |
/* { dg-final { scan-ipa-dump "Function f/\[0-9+\]+ found to be malloc" "pure-const" } } */ |
| 22 |
/* { dg-final { scan-ipa-dump "Function bar/\[0-9+\]+ found to be malloc" "pure-const" } } */ |