| 1 | volatile int x; |
| 2 | |
| 3 | void __attribute__((noinline)) sink() { |
| 4 | x++; //% self.filecheck("bt", "main.cpp", "-implicit-check-not=artificial") |
| 5 | // CHECK: frame #0: 0x{{[0-9a-f]+}} a.out`sink() at main.cpp:[[@LINE-1]]:4 |
| 6 | // CHECK-NEXT: func3{{.*}} [artificial] |
| 7 | // CHECK-NEXT: func1{{.*}} [artificial] |
| 8 | // CHECK-NEXT: main{{.*}} |
| 9 | } |
| 10 | |
| 11 | void __attribute__((noinline)) func3() { sink(); /* tail */ } |
| 12 | |
| 13 | void __attribute__((noinline)) func2() { sink(); /* tail */ } |
| 14 | |
| 15 | void __attribute__((noinline)) func1() { func3(); /* tail */ } |
| 16 | |
| 17 | int __attribute__((disable_tail_calls)) main(int argc, char **) { |
| 18 | // The sequences `main -> func1 -> f{2,3} -> sink` are both plausible. Test |
| 19 | // that lldb picks the latter sequence. |
| 20 | func1(); |
| 21 | return 0; |
| 22 | } |
| 23 | |