summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/debug/debug3.C
blob: c7251429fa426106ac012afd9c86f06272f98610 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// PR optimization/5547
// This testcase caused ICE on IA-32, since DWARF-2 was unable
// to emit location expression for parameter a of operator+.
// { dg-do compile { target fpic } }
// { dg-options "-fpic" }

struct A { char *s; };

inline A operator+ (char a, const A &b)
{
  A s;
  s.s = new char[12];
  s.s[0] = a;
  return s;
}

int b (const A &);

void test1 (const A &x, int y)
{
  int j = b ("012345"[y] + x);
  for (int i = 0; i < y; i++);
}

void test2 (const A &x, int y)
{
  int j = b ("012345678"[y + 2] + x);
  for (int i = 0; i < y; i++);
}

void test3 (const A &x, int y)
{
  int j = b ("012345678"[y - 6] + x);
  for (int i = 0; i < y; i++);
}

void test4 (const A &x, int y)
{
  int j = b ("012345678"[2 * y - 10] + x);
  for (int i = 0; i < y; i++);
}

void test5 (const A &x, int y)
{
  int j = b ("012345678"[4 * y] + x);
  for (int i = 0; i < y; i++);
}