PR libfortran/64770 Segfault when trying to open existing file with status="new".
[official-gcc.git] / gcc / testsuite / gcc.dg / ipa / pr50744.c
blob05353489265f0fa13bceca612d418727f6922cd8
1 /* { dg-do compile } */
2 /* { dg-options "-O3 -fno-optimize-sibling-calls" } */
4 extern int use_data (void *p_01, void *p_02, void *p_03, void *p_04, void *p_05,
5 void *p_06, void *p_07, void *p_08, void *p_09, void *p_10,
6 void *p_11, void *p_12, void *p_13, void *p_14, void *p_15,
7 void *p_16, void *p_17, void *p_18, void *p_19, void *p_20,
8 void *p_21, void *p_22, void *p_23, void *p_24, void *p_25,
9 void *p_26, void *p_27, void *p_28, void *p_29,
10 void *p_30);
12 extern int idx (int i, int j, int n);
14 struct stuff
16 int decision;
17 int *a, *b, *c;
18 int res;
22 #define some_large_stuff(stuff, n) { \
23 int i, j, k; \
24 for (i = 0; i < n; i++) \
25 for (j = 0; j < n; j++) \
26 { \
27 int v = stuff->c[idx(i, j, n)]; \
28 for (k = 0; k < n; k++) \
29 v += stuff->a[idx(i, k, n)] * stuff->b[idx(k,j,n)]; \
30 stuff->c[idx(i, j, n)] = v; \
31 } \
34 #define recursion if (iter > 0) \
35 foo (stuff, iter - 1, (void *) -1, p_01, p_02, p_03, p_04, p_05, p_06, \
36 p_07, p_08, p_09, p_10, p_11, p_12, p_13, p_14, p_15, p_16, p_17, \
37 p_18, p_19, p_20, p_21, p_22, p_23, p_24, p_25, p_26, p_27, p_28, p_29); \
38 else \
39 foo (stuff, iter, p_01, p_02, p_03, p_04, p_05, p_06, p_07, p_08, p_09, \
40 p_10, p_11, p_12, p_13, p_14, p_15, p_16, p_17, p_18, p_19, p_20, \
41 p_21,p_22, p_23, p_24, p_25, p_26, p_27, p_28, p_29, p_30)
43 void
44 foo (struct stuff *stuff,
45 int iter,
46 void *p_01, void *p_02, void *p_03, void *p_04, void *p_05,
47 void *p_06, void *p_07, void *p_08, void *p_09, void *p_10,
48 void *p_11, void *p_12, void *p_13, void *p_14, void *p_15,
49 void *p_16, void *p_17, void *p_18, void *p_19, void *p_20,
50 void *p_21, void *p_22, void *p_23, void *p_24, void *p_25,
51 void *p_26, void *p_27, void *p_28, void *p_29, void *p_30)
53 switch (stuff->decision)
55 case 0:
56 some_large_stuff (stuff, 83);
57 stuff->res =
58 use_data (p_01, p_02, p_03, p_04, p_05, p_06, p_07, p_08, p_09, p_10,
59 p_11, p_12, p_13, p_14, p_15, p_16, p_17, p_18, p_19, p_20,
60 p_21, p_22, p_23, p_24, p_25, p_26, p_27, p_28, p_29, p_30);
61 recursion;
62 break;
64 case 1:
65 some_large_stuff (stuff, 25);
66 stuff->res =
67 use_data (p_11, p_02, p_03, p_04, p_05, p_06, p_07, p_08, p_09, p_10,
68 p_21, p_12, p_13, p_14, p_15, p_16, p_17, p_18, p_19, p_20,
69 p_01, p_22, p_23, p_24, p_25, p_26, p_27, p_28, p_29, p_30);
70 recursion;
71 break;
73 case 3:
74 some_large_stuff (stuff, 139);
75 stuff->res =
76 use_data (p_01, p_12, p_03, p_04, p_05, p_06, p_07, p_08, p_09, p_10,
77 p_11, p_22, p_13, p_14, p_15, p_16, p_17, p_18, p_19, p_20,
78 p_21, p_02, p_23, p_24, p_25, p_26, p_27, p_28, p_29, p_30);
79 recursion;
80 break;
82 case 4:
83 some_large_stuff (stuff, 32);
84 stuff->res =
85 use_data (p_01, p_02, p_13, p_04, p_05, p_06, p_07, p_08, p_09, p_10,
86 p_11, p_12, p_23, p_14, p_15, p_16, p_17, p_18, p_19, p_20,
87 p_21, p_22, p_03, p_24, p_25, p_26, p_27, p_28, p_29, p_30);
88 recursion;
89 break;
91 case 5:
92 some_large_stuff (stuff, 205);
93 stuff->res =
94 use_data (p_01, p_02, p_03, p_04, p_15, p_06, p_07, p_08, p_09, p_10,
95 p_11, p_12, p_13, p_14, p_25, p_16, p_17, p_18, p_19, p_20,
96 p_21, p_22, p_23, p_24, p_05, p_26, p_27, p_28, p_29, p_30);
97 recursion;
98 break;
100 case 6:
101 some_large_stuff (stuff, 64);
102 stuff->res =
103 use_data (p_01, p_02, p_03, p_04, p_05, p_16, p_07, p_08, p_09, p_10,
104 p_11, p_12, p_13, p_14, p_15, p_26, p_17, p_18, p_19, p_20,
105 p_21, p_22, p_23, p_24, p_25, p_06, p_27, p_28, p_29, p_30);
106 recursion;
107 break;
111 #define NULL (void *)0
113 void
114 bar (struct stuff *stuff, int iter)
116 foo (stuff, iter, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
117 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
118 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);