1 // Bug c++/83503 - bogus -Wattributes for const and pure on function template
3 // Test to verify that attribute malloc on multiple declarations of
4 // the same ordinary function are merged.
6 // { dg-options "-O -Wall -fdump-tree-optimized" }
8 void* __attribute__ ((malloc))
9 fmalloc_none (unsigned);
12 fmalloc_none (unsigned);
16 void fmalloc_none_failed ();
18 void test_fmalloc_none (void)
20 void *p = fmalloc_none (1);
24 if (p == a) // must be false
25 fmalloc_none_failed (); // should be eliminated
27 // Verify that the call to fmalloc_none() is eliminated.
28 // { dg-final { scan-tree-dump-not "fmalloc_none_failed" "optimized" } }
31 void* fnone_malloc (unsigned);
33 void* __attribute__ ((malloc))
34 fnone_malloc (unsigned);
36 void fnone_malloc_failed ();
38 void test_fnone_malloc (void)
40 void *p = fnone_malloc (1);
44 if (p == a) // must be false
45 fnone_malloc_failed (); // should be eliminated
47 // Verify that the call to fnone_malloc() is eliminated.
48 // { dg-final { scan-tree-dump-not "fnone_malloc_failed" "optimized" } }