aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/opt/crossjump1.C
blob: 01abdc071028482f32b47e125b50864857037126 (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
// PR middle-end/21492
// { dg-do compile }
// { dg-options "-Os" }
// { dg-options "-Os -fPIC" { target fpic } }

extern char *bar (const char *, const char *);
extern char *baz (char *, const char *);
extern unsigned int fn (const char *);
static const struct C { int i; } k = { 0};

struct A
{
  ~A ();
};

char *
foo (char *x, const char *y)
{
  A a;
  char *c = x;

  if (bar (y, "foo"))
    {
      baz (c, "foo");
      c += fn ("foo");
    }
  else if (bar (y, "bar"))
    {
      baz (c, "bar");
      c += fn ("bar");
    }

  return x;
}