PR libfortran/64770 Segfault when trying to open existing file with status="new".
[official-gcc.git] / gcc / testsuite / gcc.dg / ipa / ipcp-3.c
blobaf4f50b273911e9200e86d548decbef908f2297c
1 /* Verify that IPA-CP can clone mark_cell without miscompiling it despite its
2 type_attributes. */
3 /* { dg-do run } */
4 /* { dg-options "-O3 -fdump-ipa-cp" } */
7 struct PMC {
8 unsigned flags;
9 };
11 typedef struct Pcc_cell
13 struct PMC *p;
14 long bla;
15 long type;
16 } Pcc_cell;
18 int gi;
20 extern void abort ();
21 extern void never_ever(int * interp, struct PMC *pmc)
22 __attribute__((noinline));
24 void never_ever (int * interp, struct PMC *pmc)
26 abort ();
29 static void mark_cell(int * interp, Pcc_cell *c)
30 __attribute__((__nonnull__(1)))
31 __attribute__((noinline));
33 static void
34 mark_cell(int * interp, Pcc_cell *c)
36 if (c && c->type == 4 && c->p
37 && !(c->p->flags & (1<<14)))
38 never_ever(interp, c->p);
41 static void foo(int * interp, Pcc_cell *c)
42 __attribute__((noinline));
44 static void
45 foo(int * interp, Pcc_cell *c)
47 mark_cell(interp, c);
50 static struct Pcc_cell *
51 __attribute__((noinline,noclone))
52 getnull(void)
54 return (struct Pcc_cell *) 0;
58 int main()
60 int i;
62 for (i = 0; i < 100; i++)
63 foo (&gi, getnull ());
64 return 0;
68 /* { dg-final { scan-ipa-dump "Creating a specialized node of mark_cell" "cp" } } */
69 /* { dg-final { cleanup-ipa-dump "cp" } } */