Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 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 | \ |
Duncan Sands | a524e0e | 2007-07-23 15:23:35 +0000 | [diff] [blame^] | 4 | // RUN: llc --disable-fp-elim -o NoCompileUnit.s -f |
| 5 | // RUN: as NoCompileUnit.s -o NoCompileUnit.o |
| 6 | // RUN: g++ NoCompileUnit.o -o NoCompileUnit.exe |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 7 | // RUN: echo {break main\nrun\np NoCompileUnit::pubname} > %t2 |
Duncan Sands | a524e0e | 2007-07-23 15:23:35 +0000 | [diff] [blame^] | 8 | // RUN: gdb -q -batch -n -x %t2 NoCompileUnit.exe | \ |
| 9 | // RUN: tee NoCompileUnit.out | not grep {"low == high"} |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 10 | // XFAIL: alpha|ia64|arm |
| 11 | |
| 12 | |
| 13 | class MamaDebugTest { |
| 14 | private: |
| 15 | int N; |
| 16 | |
| 17 | protected: |
| 18 | MamaDebugTest(int n) : N(n) {} |
| 19 | |
| 20 | int getN() const { return N; } |
| 21 | |
| 22 | }; |
| 23 | |
| 24 | class BabyDebugTest : public MamaDebugTest { |
| 25 | private: |
| 26 | |
| 27 | public: |
| 28 | BabyDebugTest(int n) : MamaDebugTest(n) {} |
| 29 | |
| 30 | static int doh; |
| 31 | |
| 32 | int doit() { |
| 33 | int N = getN(); |
| 34 | int Table[N]; |
| 35 | |
| 36 | int sum = 0; |
| 37 | |
| 38 | for (int i = 0; i < N; ++i) { |
| 39 | int j = i; |
| 40 | Table[i] = j; |
| 41 | } |
| 42 | for (int i = 0; i < N; ++i) { |
| 43 | int j = Table[i]; |
| 44 | sum += j; |
| 45 | } |
| 46 | |
| 47 | return sum; |
| 48 | } |
| 49 | |
| 50 | }; |
| 51 | |
| 52 | int BabyDebugTest::doh; |
| 53 | |
| 54 | |
| 55 | int main(int argc, const char *argv[]) { |
| 56 | BabyDebugTest BDT(20); |
| 57 | return BDT.doit(); |
| 58 | } |