1 /* { dg-do compile } */
2 
3 struct PMC {
4     unsigned flags;
5 };
6 
7 struct PVC {
8   unsigned flags, other_stuff;
9 };
10 
11 
12 typedef struct Pcc_cell
13 {
14     struct PMC *p;
15     long bla;
16     long type;
17 } Pcc_cell;
18 
19 int gi;
20 int cond;
21 
22 struct PVC g_pvc;
23 
24 extern void abort ();
25 extern void never_ever(int interp, struct PMC *pmc)
26   __attribute__((noinline,noclone));
27 
never_ever(int interp,struct PMC * pmc)28 void never_ever (int interp, struct PMC *pmc)
29 {
30   abort ();
31 }
32 
33 static void mark_cell(int * interp, Pcc_cell *c, struct PVC pvc)
34   __attribute__((__nonnull__(1)));
35 
36 static void
mark_cell(int * interp,Pcc_cell * c,struct PVC pvc)37 mark_cell(int * interp, Pcc_cell *c, struct PVC pvc)
38 {
39   if (!cond)
40     return;
41 
42   if (c && c->type == 4 && c->p
43       && !(c->p->flags & (1<<8)))
44     never_ever(gi + 1, c->p);
45   if (c && c->type == 4 && c->p
46       && !(c->p->flags & (1<<7)))
47     never_ever(gi + 2, c->p);
48   if (c && c->type == 4 && c->p
49       && !(c->p->flags & (1<<6)))
50     never_ever(gi + 3, c->p);
51   if (c && c->type == 4 && c->p
52       && !(c->p->flags & (1<<5)))
53     never_ever(gi + 4, c->p);
54   if (c && c->type == 4 && c->p
55       && !(c->p->flags & (1<<4)))
56     never_ever(gi + 5, c->p);
57   if (c && c->type == 4 && c->p
58       && !(c->p->flags & (1<<3)))
59     never_ever(gi + 6, c->p);
60   if (c && c->type == 4 && c->p
61       && !(c->p->flags & (1<<2)))
62     never_ever(gi + 7, c->p);
63   if (c && c->type == 4 && c->p
64       && !(c->p->flags & (1<<1)))
65     never_ever(gi + 8, c->p);
66   if (c && c->type == 4 && c->p
67       && !(c->p->flags & (1<<9)))
68     never_ever(gi + 9, c->p);
69 }
70 
71 static void
foo(int * interp,Pcc_cell * c)72 foo(int * interp, Pcc_cell *c)
73 {
74   mark_cell(interp, c, g_pvc);
75 }
76 
77 static struct Pcc_cell *
78 __attribute__((noinline,noclone))
getnull(void)79 getnull(void)
80 {
81   return (struct Pcc_cell *) 0;
82 }
83 
84 
main()85 int main()
86 {
87   int i;
88 
89   cond = 1;
90   for (i = 0; i < 100; i++)
91     foo (&gi, getnull ());
92   return 0;
93 }
94 
95 
96 void
bar_1(int * interp,Pcc_cell * c)97 bar_1 (int * interp, Pcc_cell *c)
98 {
99   c->bla += 1;
100   mark_cell(interp, c, g_pvc);
101 }
102 
103 void
bar_2(int * interp,Pcc_cell * c,struct PVC pvc)104 bar_2 (int * interp, Pcc_cell *c, struct PVC pvc)
105 {
106   c->bla += 2;
107   mark_cell(interp, c, pvc);
108 }
109 
110