summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/torture/pr60648.C
blob: 48cf0afb52b20a329587f6fb424798945d58a40f (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// PR target/60648
// { dg-do compile }
// { dg-additional-options "-fPIC" { target fpic } }

enum component
{
  Ex,
  Ez,
  Hy,
  Permeability
};
enum derived_component
{};
enum direction
{
  X,
  Y,
  Z,
  R,
  P,
  NO_DIRECTION
};
derived_component a;
component *b;
component c;
direction d;
inline direction fn1 (component p1)
{
  switch (p1)
    {
    case 0:
      return Y;
    case 1:
      return Z;
    case Permeability:
      return NO_DIRECTION;
    }
  return X;
}

inline component fn2 (direction p1)
{
  switch (p1)
    {
    case 0:
    case 1:
      return component ();
    case Z:
    case R:
      return component (1);
    case P:
      return component (3);
    }
}

void fn3 ()
{
  direction e;
  switch (0)
  case 0:
  switch (a)
    {
    case 0:
      c = Ex;
      b[1] = Hy;
    }
  e = fn1 (b[1]);
  b[1] = fn2 (e);
  d = fn1 (c);
}