1 /* PR middle-end/15345, c/16450 */ 2 /* Test whether unused nested functions aren't emitted into the assembly. */ 3 /* { dg-do compile } */ 4 /* { dg-options "-g0" } */ 5 /* { dg-require-effective-target trampolines } */ 6 7 int fn1(int x)8fn1 (int x) 9 { 10 int i = x; 11 inline __attribute__((always_inline)) int 12 should_not_appear1 (void) 13 { 14 return i; 15 } 16 return should_not_appear1 (); 17 } 18 19 int fn2(int x)20fn2 (int x) 21 { 22 int i = x; 23 inline __attribute__((always_inline)) int 24 should_not_appear2 (void) 25 { 26 return i; 27 } 28 return x; 29 } 30 31 extern void check (void *p); 32 33 int fn3(int x)34fn3 (int x) 35 { 36 int i = x; 37 inline int 38 should_appear1 (void) 39 { 40 char *p = __builtin_alloca (i); 41 check (p); 42 return i; 43 } 44 return should_appear1 (); 45 } 46 47 int fn4(int x)48fn4 (int x) 49 { 50 int i = x; 51 inline int 52 should_not_appear3 (void) 53 { 54 char *p = __builtin_alloca (i); 55 check (p); 56 return i; 57 } 58 return 0 ? should_not_appear3 () : 1; 59 } 60 61 int fn5(int x)62fn5 (int x) 63 { 64 int i = x; 65 inline int 66 should_appear2 (void) 67 { 68 return i; 69 } 70 check (should_appear2); 71 return i; 72 } 73 74 /* { dg-final { scan-assembler-not "should_not_appear" } } */ 75