These pass on Linux now.
[oota-llvm.git] / test / DebugInfo / 2006-11-30-NoCompileUnit.cpp
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 - | llvm-as | llc --disable-fp-elim -o Output/NoCompileUnit.s -f
4 // RUN: as Output/NoCompileUnit.s -o Output/NoCompileUnit.o
5 // RUN: g++ Output/NoCompileUnit.o -o Output/NoCompileUnit.exe
6 // RUN: ( echo "break main"; echo "run" ; echo "p NoCompileUnit::pubname" ) > Output/NoCompileUnit.gdbin 
7 // RUN: gdb -q -batch -n -x Output/NoCompileUnit.gdbin Output/NoCompileUnit.exe | tee Output/NoCompileUnit.out | not grep '"low == high"'
8 // XFAIL: alpha|ia64|arm
9
10
11 class MamaDebugTest {
12 private:
13   int N;
14   
15 protected:
16   MamaDebugTest(int n) : N(n) {}
17   
18   int getN() const { return N; }
19
20 };
21
22 class BabyDebugTest : public MamaDebugTest {
23 private:
24
25 public:
26   BabyDebugTest(int n) : MamaDebugTest(n) {}
27   
28   static int doh;
29   
30   int  doit() {
31     int N = getN();
32     int Table[N];
33     
34     int sum = 0;
35     
36     for (int i = 0; i < N; ++i) {
37       int j = i;
38       Table[i] = j;
39     }
40     for (int i = 0; i < N; ++i) {
41       int j = Table[i];
42       sum += j;
43     }
44     
45     return sum;
46   }
47
48 };
49
50 int BabyDebugTest::doh;
51
52
53 int main(int argc, const char *argv[]) {
54   BabyDebugTest BDT(20);
55   return BDT.doit();
56 }