blob: 242a37e41336ef7db137f0c1af71a9fbffa8f468 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001// This is a regression test on debug info to make sure we don't hit a compile
2// unit size issue with gdb.
Dan Gohman2b62af22009-12-05 00:02:37 +00003// RUN: %llvmgcc -S -O0 -g %s -o - | \
Dan Gohman2d65d352009-08-25 15:38:29 +00004// RUN: llc --disable-fp-elim -o NoCompileUnit.s
Chris Lattner670f4512008-03-10 06:52:10 +00005// RUN: %compile_c NoCompileUnit.s -o NoCompileUnit.o
Dale Johannesenb58f0a62008-06-10 18:01:54 +00006// RUN: %link NoCompileUnit.o -o NoCompileUnit.exe
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007// RUN: echo {break main\nrun\np NoCompileUnit::pubname} > %t2
Duncan Sandsa524e0e2007-07-23 15:23:35 +00008// RUN: gdb -q -batch -n -x %t2 NoCompileUnit.exe | \
9// RUN: tee NoCompileUnit.out | not grep {"low == high"}
Daniel Dunbar5a7b8f02009-11-09 16:38:15 +000010// XFAIL: alpha,arm
Matthijs Kooijman2035efd2008-06-13 16:52:35 +000011// XFAIL: *
12// See PR2454
Dan Gohmanf17a25c2007-07-18 16:29:46 +000013
14
15class MamaDebugTest {
16private:
17 int N;
18
19protected:
20 MamaDebugTest(int n) : N(n) {}
21
22 int getN() const { return N; }
23
24};
25
26class BabyDebugTest : public MamaDebugTest {
27private:
28
29public:
30 BabyDebugTest(int n) : MamaDebugTest(n) {}
31
32 static int doh;
33
34 int doit() {
35 int N = getN();
36 int Table[N];
37
38 int sum = 0;
39
40 for (int i = 0; i < N; ++i) {
41 int j = i;
42 Table[i] = j;
43 }
44 for (int i = 0; i < N; ++i) {
45 int j = Table[i];
46 sum += j;
47 }
48
49 return sum;
50 }
51
52};
53
54int BabyDebugTest::doh;
55
56
57int main(int argc, const char *argv[]) {
58 BabyDebugTest BDT(20);
59 return BDT.doit();
60}