Fixed some bugs.
[llvm/zpu.git] / test / FrontendC++ / 2006-11-30-NoCompileUnit.cpp
blob242a37e41336ef7db137f0c1af71a9fbffa8f468
1 // This is a regression test on debug info to make sure we don't hit a compile
2 // unit size issue with gdb.
3 // RUN: %llvmgcc -S -O0 -g %s -o - | \
4 // RUN: llc --disable-fp-elim -o NoCompileUnit.s
5 // RUN: %compile_c NoCompileUnit.s -o NoCompileUnit.o
6 // RUN: %link NoCompileUnit.o -o NoCompileUnit.exe
7 // RUN: echo {break main\nrun\np NoCompileUnit::pubname} > %t2
8 // RUN: gdb -q -batch -n -x %t2 NoCompileUnit.exe | \
9 // RUN: tee NoCompileUnit.out | not grep {"low == high"}
10 // XFAIL: alpha,arm
11 // XFAIL: *
12 // See PR2454
15 class MamaDebugTest {
16 private:
17 int N;
19 protected:
20 MamaDebugTest(int n) : N(n) {}
22 int getN() const { return N; }
26 class BabyDebugTest : public MamaDebugTest {
27 private:
29 public:
30 BabyDebugTest(int n) : MamaDebugTest(n) {}
32 static int doh;
34 int doit() {
35 int N = getN();
36 int Table[N];
38 int sum = 0;
40 for (int i = 0; i < N; ++i) {
41 int j = i;
42 Table[i] = j;
44 for (int i = 0; i < N; ++i) {
45 int j = Table[i];
46 sum += j;
49 return sum;
54 int BabyDebugTest::doh;
57 int main(int argc, const char *argv[]) {
58 BabyDebugTest BDT(20);
59 return BDT.doit();