131
|
1 /* PR c++/83871 - wrong code for attribute const and pure on distinct
|
|
2 template specializations
|
|
3 Test to verify that attributes noreturn on multiple declarations of
|
|
4 the same function are merged.
|
|
5 { dg-do compile }
|
|
6 { dg-options "-O -fdump-tree-optimized" } */
|
|
7
|
|
8 int __attribute__ ((noreturn)) fnoreturn ();
|
|
9
|
|
10 void fnoreturn_failed ();
|
|
11
|
|
12 int test_noreturn () throw ()
|
|
13 {
|
|
14 fnoreturn ();
|
|
15 fnoreturn_failed ();
|
|
16 // Verify that the call to fnoreturn_failed() is eliminated.
|
|
17 // { dg-final { scan-tree-dump-not "fnoreturn_failed" "optimized" } }
|
|
18
|
|
19 // Expect no -Wreturn-type warning despite the absence of a return
|
|
20 // statement in a non-void function.
|
|
21 }
|
|
22
|
|
23
|
|
24 int __attribute__ ((noreturn)) fnoreturn_none ();
|
|
25 int fnoreturn_none ();
|
|
26
|
|
27 void fnoreturn_none_failed ();
|
|
28
|
|
29
|
|
30 int test_noreturn_none ()
|
|
31 {
|
|
32 fnoreturn_none ();
|
|
33 fnoreturn_none_failed ();
|
|
34 // { dg-final { scan-tree-dump-not "fnoreturn_none_failed" "optimized" } }
|
|
35 }
|
|
36
|
|
37 int fnone_noreturn ();
|
|
38 int __attribute__ ((noreturn)) fnone_noreturn ();
|
|
39
|
|
40 void fnone_noreturn_failed ();
|
|
41
|
|
42 int test_none_noreturn () throw ()
|
|
43 {
|
|
44 fnone_noreturn ();
|
|
45 fnone_noreturn_failed ();
|
|
46 // { dg-final { scan-tree-dump-not "fnone_noreturn_failed" "optimized" } }
|
|
47 }
|