2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / other / pr56184.C
blobdc949283c988bd33e9ebd27ff667df14c6d10b07
1 /* { dg-do compile { target arm*-*-* } } */
2 /* { dg-skip-if "incompatible options" { ! { arm_thumb1_ok || arm_thumb2_ok } } } */
3 /* { dg-options "-fno-short-enums -O2 -mthumb -march=armv7-a -mfpu=neon -mfloat-abi=softfp -mtune=cortex-a9 -fno-section-anchors -Wno-return-type" } */
5 typedef unsigned int size_t;
6 __extension__ typedef int __intptr_t;
7 typedef __intptr_t intptr_t;
8 typedef union tree_node *tree;
9 typedef const union tree_node *const_tree;
10 extern void *ggc_internal_cleared_alloc_stat (size_t )
11   __attribute__ ((__malloc__));
12 enum tree_code {
13 TREE_LIST=2,
14 FUNCTION_DECL,
15 MAX_TREE_CODES=254
17 extern unsigned char tree_contains_struct[MAX_TREE_CODES][64];
18 struct tree_base {
19   enum tree_code code : 16;
21 struct tree_common {
22   tree chain;
24 enum tree_node_structure_enum {
25 TS_COMMON,
26 TS_DECL_COMMON,
28 extern void tree_contains_struct_check_failed (const_tree,
29             const enum tree_node_structure_enum,
30             const char *, int, const char *)
31   __attribute__ ((__noreturn__));
32 extern void tree_check_failed (const_tree, const char *, int, const char *,
33           ...) __attribute__ ((__noreturn__));
34 struct tree_list {
35   tree value;
37 struct tree_decl_common {
38   tree initial;
40 struct tree_function_decl {
41   struct function *f;
43 union
44                                                          tree_node {
45   struct tree_base base;
46   struct tree_common common;
47   struct tree_decl_common decl_common;
48   struct tree_function_decl function_decl;
49   struct tree_list list;
51 inline tree
52 tree_check (tree __t, const char *__f, int __l, const char *__g, enum tree_code __c)
54   if (((enum tree_code) (__t)->base.code) != __c)
55     tree_check_failed (__t, __f, __l, __g, __c, 0);
57 inline tree
58 contains_struct_check (tree __t, const enum tree_node_structure_enum __s,
59                        const char *__f, int __l, const char *__g)
61   if (tree_contains_struct[((enum tree_code) (__t)->base.code)][__s] != 1)
62       tree_contains_struct_check_failed (__t, __s, __f, __l, __g);
64 struct function {
65   tree static_chain_decl;
67 enum gimple_code {
68     LAST_AND_UNUSED_GIMPLE_CODE
70 struct eh_catch_d
72   struct eh_catch_d *next_catch;
73   struct eh_catch_d *prev_catch;
74   tree type_list;
75   tree filter_list;
76   tree label;
78 struct eh_region_d
80   struct eh_region_d *outer;
81   struct eh_region_d *inner;
82   int index;
83   union eh_region_u {
84     struct eh_region_u_try {
85       struct eh_catch_d *first_catch;
86     } eh_try;
87   } u;
89 typedef struct eh_catch_d *eh_catch;
90 typedef struct eh_region_d *eh_region;
91 extern void add_type_for_runtime (tree);
92 enum LTO_tags
94   LTO_null = 0,
95   LTO_bb0 = 1 + MAX_TREE_CODES + LAST_AND_UNUSED_GIMPLE_CODE,
96   LTO_ert_cleanup,
97   LTO_NUM_TAGS
99 enum lto_section_type
101   LTO_section_function_body,
103 struct lto_input_block
105   const char *data;
106   unsigned int p;
107   unsigned int len;
109 extern void lto_section_overrun (struct lto_input_block *) __attribute__ ((__noreturn__));
110 extern void lto_value_range_error (const char *,
111        long long, long long,
112        long long) __attribute__ ((__noreturn__));
113 long long streamer_read_hwi (struct lto_input_block *);
114 static inline unsigned char
115 streamer_read_uchar (struct lto_input_block *ib)
117   if (ib->p >= ib->len)
118     lto_section_overrun (ib);
119   return (ib->data[ib->p++]);
121 static inline long long
122 streamer_read_hwi_in_range (struct lto_input_block *ib,
123      const char *purpose,
124      long long min,
125      long long max)
127   long long range = max - min;
128   long long val = streamer_read_uchar (ib);
129   if (range >= 0xff)
130     val |= ((long long)streamer_read_uchar (ib)) << 8;
131   if (val < min || val > max)
132     lto_value_range_error (purpose, val, min, max);
133   return val;
135 static inline enum LTO_tags
136 streamer_read_record_start (struct lto_input_block *ib)
138   return (enum LTO_tags)streamer_read_hwi_in_range ((ib), "LTO_tags", 0, (int)(LTO_NUM_TAGS) - 1);
140 struct streamer_hooks {
141   tree (*read_tree) (struct lto_input_block *, struct data_in *);
143 extern struct streamer_hooks streamer_hooks;
144 static struct eh_catch_d *
145 lto_input_eh_catch_list (struct lto_input_block *ib, struct data_in *data_in,
146     eh_catch *last_p)
148   eh_catch first;
149   enum LTO_tags tag;
150   *last_p = first = __null;
151   tag = streamer_read_record_start (ib);
152   while (tag)
153     {
154       tree list;
155       eh_catch n;
156       n = ((struct eh_catch_d *)(ggc_internal_cleared_alloc_stat (sizeof (struct eh_catch_d) )));
157       n->type_list = streamer_hooks.read_tree(ib, data_in);
158       n->filter_list = streamer_hooks.read_tree(ib, data_in);
159       n->label = streamer_hooks.read_tree(ib, data_in);
160       for (list = n->filter_list; list; list = ((contains_struct_check ((list), (TS_COMMON), "../../../gcc-4.8~svn195526/gcc/lto-streamer-in.c", 275, __FUNCTION__))->common.chain))
161  add_type_for_runtime (((tree_check ((list), "../../../gcc-4.8~svn195526/gcc/lto-streamer-in.c", 276, __FUNCTION__, (TREE_LIST)))->list.value));
162       if (*last_p)
163  (*last_p)->next_catch = n;
164       n->prev_catch = *last_p;
165       *last_p = n;
166       if (first == __null)
167  first = n;
168       tag = streamer_read_record_start (ib);
169     }
170   return first;
172 static eh_region
173 input_eh_region (struct lto_input_block *ib, struct data_in *data_in, int ix)
175   enum LTO_tags tag;
176   eh_region r;
177   tag = streamer_read_record_start (ib);
178   if (tag == LTO_null)
179     return __null;
180   r = ((struct eh_region_d *)(ggc_internal_cleared_alloc_stat (sizeof (struct eh_region_d) )));
181   r->index = streamer_read_hwi (ib);
182   r->outer = (eh_region) (intptr_t) streamer_read_hwi (ib);
183   r->inner = (eh_region) (intptr_t) streamer_read_hwi (ib);
184   switch (tag)
185     {
186       case LTO_ert_cleanup:
188    struct eh_catch_d *last_catch;
189    r->u.eh_try.first_catch = lto_input_eh_catch_list (ib, data_in,
190             &last_catch);
193    tree l;
194      add_type_for_runtime (((tree_check ((l), "../../../gcc-4.8~svn195526/gcc/lto-streamer-in.c", 346, __FUNCTION__, (TREE_LIST)))->list.value));
196     }
198 static void
199 input_eh_regions (struct lto_input_block *ib, struct data_in *data_in,
200     struct function *fn)
202   long long i, root_region, len;
203   enum LTO_tags tag;
204   tag = streamer_read_record_start (ib);
205   if (tag == LTO_null)
206     return;
207   len = streamer_read_hwi (ib);
208   if (len > 0)
209     {
210       for (i = 0; i < len; i++)
212    eh_region r = input_eh_region (ib, data_in, i);
214     }
216 static void
217 input_ssa_names (struct lto_input_block *ib, struct data_in *data_in,
218    struct function *fn)
220   unsigned int i, size;
221   while (i)
222     {
223     }
225 static void
226 input_struct_function_base (struct function *fn, struct data_in *data_in,
227                             struct lto_input_block *ib)
229   fn->static_chain_decl = streamer_hooks.read_tree(ib, data_in);
231 static void
232 input_function (tree fn_decl, struct data_in *data_in,
233   struct lto_input_block *ib)
235   struct function *fn;
236   enum LTO_tags tag;
237   fn = ((tree_check ((fn_decl), "../../../gcc-4.8~svn195526/gcc/lto-streamer-in.c", 807, __FUNCTION__, (FUNCTION_DECL)))->function_decl.f);
238   tag = streamer_read_record_start (ib);
239   input_struct_function_base (fn, data_in, ib);
240   input_ssa_names (ib, data_in, fn);
241   input_eh_regions (ib, data_in, fn);
242   ((contains_struct_check ((fn_decl), (TS_DECL_COMMON), "../../../gcc-4.8~svn195526/gcc/lto-streamer-in.c", 823, __FUNCTION__))->decl_common.initial) = streamer_hooks.read_tree(ib, data_in);
244 static void
245 lto_read_body (struct lto_file_decl_data *file_data, tree fn_decl,
246         const char *data, enum lto_section_type section_type)
248   struct data_in *data_in;
249   struct lto_input_block ib_main;
250   input_function (fn_decl, data_in, &ib_main);
252 void
253 lto_input_function_body (struct lto_file_decl_data *file_data,
254     tree fn_decl, const char *data)
256   lto_read_body (file_data, fn_decl, data, LTO_section_function_body);