2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.dg / debug / debug3.C
blob14cd7c5a6cf9e9cd1446740260dd56b41413ac78
1 // PR optimization/5547
2 // This testcase caused ICE on IA-32, since DWARF-2 was unable
3 // to emit location expression for parameter a of operator+.
4 // { dg-do compile }
5 // { dg-options "-fpic" }
6 // { dg-warning "not supported" "PIC unsupported" { target cris-*-elf* cris-*-aout* mmix-*-* } 0 }
8 struct A { char *s; };
10 inline A operator+ (char a, const A &b)
12   A s;
13   s.s = new char[12];
14   s.s[0] = a;
15   return s;
18 int b (const A &);
20 void test1 (const A &x, int y)
22   int j = b ("012345"[y] + x);
23   for (int i = 0; i < y; i++);
26 void test2 (const A &x, int y)
28   int j = b ("012345678"[y + 2] + x);
29   for (int i = 0; i < y; i++);
32 void test3 (const A &x, int y)
34   int j = b ("012345678"[y - 6] + x);
35   for (int i = 0; i < y; i++);
38 void test4 (const A &x, int y)
40   int j = b ("012345678"[2 * y - 10] + x);
41   for (int i = 0; i < y; i++);
44 void test5 (const A &x, int y)
46   int j = b ("012345678"[4 * y] + x);
47   for (int i = 0; i < y; i++);