1 // Bug c++/84617 - new test cases g++.dg/ext/attr-const.C and
2 // g++.dg/ext/attr-pure.C fail
4 // { dg-options "-O -Wall -fdump-tree-optimized" }
8 void* __attribute__ ((malloc))
9 func_malloc_none (unsigned);
12 func_alloc_none (unsigned); // redeclare with no attribute
14 void func_malloc_none_failed ();
16 void test_func_malloc_none (void)
18 void *p = func_malloc_none (1);
22 if (p == a) // must be false
23 func_malloc_none_failed (); // should be eliminated
25 // Verify that the call to func_malloc_none_failed() is eliminated.
26 // { dg-final { scan-tree-dump-not "func_malloc_none_failed" "optimized" } }
31 func_none_malloc (unsigned);
33 void* __attribute__ ((malloc))
34 func_none_malloc (unsigned); // redeclare with an attribute
36 void func_none_malloc_failed ();
38 void test_func_none_malloc (void)
40 void *p = func_none_malloc (1);
44 if (p == a) // must be false
45 func_none_malloc_failed (); // should be eliminated
47 // Verify that the call to func_none_malloc_failed() is eliminated.
48 // { dg-final { scan-tree-dump-not "func_none_malloc_failed" "optimized" } }
53 void* __attribute__ ((malloc))
54 templ_malloc_none (unsigned);
58 templ_malloc_none (unsigned); // redeclare with no attribute
60 void templ_malloc_none_failed ();
62 void test_templ_malloc_none (void)
64 void *p = templ_malloc_none<void>(1);
68 if (p == a) // must be false
69 templ_malloc_none_failed (); // should be eliminated
71 // Verify that the call to templ_malloc_none_failed() is eliminated.
72 // { dg-final { scan-tree-dump-not "templ_malloc_none_failed" "optimized" } }
77 templ_none_malloc (unsigned);
80 void* __attribute__ ((malloc))
81 templ_none_malloc (unsigned); // redeclared with an attribute
83 void templ_none_malloc_failed ();
85 void test_templ_none_malloc (void)
87 void *p = templ_none_malloc<void>(1);
91 if (p == a) // must be false
92 templ_none_malloc_failed (); // should be eliminated
94 // Verify that the call to templ_none_malloc_failed() is eliminated.
95 // { dg-final { scan-tree-dump-not "templ_none_malloc_failed" "optimized" } }