Debian Codegraph @

gcc/testsuite/gcc.dg/ipa/propmalloc-2.c

raw
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, used, no_icf))
6 static void *foo (__SIZE_TYPE__ n)
7 {
8 return __builtin_malloc (n * 10);
9 }
10
11 __attribute__((noinline, used, no_icf))
12 static void *bar(__SIZE_TYPE__ n, int cond)
13 {
14 void *p;
15 if (cond)
16 p = foo (n);
17 else
18 p = __builtin_malloc (n);
19
20 return p;
21 }
22
23 /* { dg-final { scan-ipa-dump "Function foo/\[0-9+\]+ found to be malloc" "pure-const" } } */
24 /* { dg-final { scan-ipa-dump "Function bar/\[0-9+\]+ found to be malloc" "pure-const" } } */