2015-09-24 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / pr50287.c
blob1f61293a5c082d034f8db12c0e2732e578838052
1 /* { dg-do compile } */
3 struct PMC {
4 unsigned flags;
5 };
7 struct PVC {
8 unsigned flags, other_stuff;
9 };
12 typedef struct Pcc_cell
14 struct PMC *p;
15 long bla;
16 long type;
17 } Pcc_cell;
19 int gi;
20 int cond;
22 struct PVC g_pvc;
24 extern void abort ();
25 extern void never_ever(int interp, struct PMC *pmc)
26 __attribute__((noinline,noclone));
28 void never_ever (int interp, struct PMC *pmc)
30 abort ();
33 static void mark_cell(int * interp, Pcc_cell *c, struct PVC pvc)
34 __attribute__((__nonnull__(1)));
36 static void
37 mark_cell(int * interp, Pcc_cell *c, struct PVC pvc)
39 if (!cond)
40 return;
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);
71 static void
72 foo(int * interp, Pcc_cell *c)
74 mark_cell(interp, c, g_pvc);
77 static struct Pcc_cell *
78 __attribute__((noinline,noclone))
79 getnull(void)
81 return (struct Pcc_cell *) 0;
85 int main()
87 int i;
89 cond = 1;
90 for (i = 0; i < 100; i++)
91 foo (&gi, getnull ());
92 return 0;
96 void
97 bar_1 (int * interp, Pcc_cell *c)
99 c->bla += 1;
100 mark_cell(interp, c, g_pvc);
103 void
104 bar_2 (int * interp, Pcc_cell *c, struct PVC pvc)
106 c->bla += 2;
107 mark_cell(interp, c, pvc);