summaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq2/main.cpp
blob: 1651db2ea4a1f08b7891f5929ef34781f2341f52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//===-- main.cpp ------------------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

volatile int x;

void __attribute__((noinline)) sink() {
  x++; //% self.filecheck("bt", "main.cpp")
  // CHECK-NOT: func{{[23]}}
}

void func2();

void __attribute__((noinline)) func1() {
  if (x < 1)
    func2();
  else
    sink();
}

void __attribute__((noinline)) func2() {
  if (x < 1)
    sink();
  else
    func1();
}

int main() {
  // Tail recursion creates ambiguous execution histories.
  x = 0;
  func1();
  return 0;
}