aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/crossjump1.C
blob: 3bb95d1810c77266003dc51371802b6785c25616 (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
// PR middle-end/21492
// { dg-do compile }
// { dg-options "-Os -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;
}