2006-12-04 21:46:05 +01:00
|
|
|
// This is a regression test on debug info to make sure we don't hit a compile
|
|
|
|
// unit size issue with gdb.
|
2009-12-05 01:02:37 +01:00
|
|
|
// RUN: %llvmgcc -S -O0 -g %s -o - | \
|
2009-08-25 17:38:29 +02:00
|
|
|
// RUN: llc --disable-fp-elim -o NoCompileUnit.s
|
2008-03-10 07:52:10 +01:00
|
|
|
// RUN: %compile_c NoCompileUnit.s -o NoCompileUnit.o
|
2008-06-10 20:01:54 +02:00
|
|
|
// RUN: %link NoCompileUnit.o -o NoCompileUnit.exe
|
2007-04-16 00:37:04 +02:00
|
|
|
// RUN: echo {break main\nrun\np NoCompileUnit::pubname} > %t2
|
2007-07-23 17:23:35 +02:00
|
|
|
// RUN: gdb -q -batch -n -x %t2 NoCompileUnit.exe | \
|
|
|
|
// RUN: tee NoCompileUnit.out | not grep {"low == high"}
|
2009-11-09 17:38:15 +01:00
|
|
|
// XFAIL: alpha,arm
|
2008-06-13 18:52:35 +02:00
|
|
|
// XFAIL: *
|
|
|
|
// See PR2454
|
2006-11-30 16:36:44 +01:00
|
|
|
|
|
|
|
|
|
|
|
class MamaDebugTest {
|
|
|
|
private:
|
|
|
|
int N;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
MamaDebugTest(int n) : N(n) {}
|
|
|
|
|
|
|
|
int getN() const { return N; }
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class BabyDebugTest : public MamaDebugTest {
|
|
|
|
private:
|
|
|
|
|
|
|
|
public:
|
|
|
|
BabyDebugTest(int n) : MamaDebugTest(n) {}
|
|
|
|
|
|
|
|
static int doh;
|
|
|
|
|
|
|
|
int doit() {
|
|
|
|
int N = getN();
|
|
|
|
int Table[N];
|
|
|
|
|
|
|
|
int sum = 0;
|
|
|
|
|
|
|
|
for (int i = 0; i < N; ++i) {
|
|
|
|
int j = i;
|
|
|
|
Table[i] = j;
|
|
|
|
}
|
|
|
|
for (int i = 0; i < N; ++i) {
|
|
|
|
int j = Table[i];
|
|
|
|
sum += j;
|
|
|
|
}
|
|
|
|
|
|
|
|
return sum;
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
int BabyDebugTest::doh;
|
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, const char *argv[]) {
|
|
|
|
BabyDebugTest BDT(20);
|
|
|
|
return BDT.doit();
|
|
|
|
}
|