1 /* PR lto/85248 */
2 /* { dg-lto-do run } */
3 /* { dg-lto-options { { -flto -O2 } } } */
4
5 #define STR1(X) #X
6 #define STR2(X) STR1(X)
7
8 extern void test_alias (int s, int e)
9 __asm__ (STR2(__USER_LABEL_PREFIX__) "test");
10 extern void test_noreturn (int s, int e)
11 __asm__ (STR2(__USER_LABEL_PREFIX__) "test")
12 __attribute__ ((__noreturn__));
13
14 extern inline __attribute__ ((__always_inline__, __gnu_inline__)) void
15 test (int s, int e)
16 {
17 if (__builtin_constant_p (s) && s != 0)
18 test_noreturn (s, e);
19 else
20 test_alias (s, e);
21 }
22
23 int
24 foo (void)
25 {
26 static volatile int a;
27 return a;
28 }
29
30 static void
31 bar (void)
32 {
33 test (0, 1);
34 __builtin_exit (0);
35 }
36
37 static void
38 baz ()
39 {
40 test (1, 0);
41 }
42
43 int
44 main ()
45 {
46 if (foo ())
47 baz ();
48 bar ();
49 __builtin_abort ();
50 }