File: | build/gcc/c/c-typeck.cc |
Warning: | line 3174, column 5 Called C++ object pointer is null |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* Build expressions with type checking for C compiler. | |||
2 | Copyright (C) 1987-2023 Free Software Foundation, Inc. | |||
3 | ||||
4 | This file is part of GCC. | |||
5 | ||||
6 | GCC is free software; you can redistribute it and/or modify it under | |||
7 | the terms of the GNU General Public License as published by the Free | |||
8 | Software Foundation; either version 3, or (at your option) any later | |||
9 | version. | |||
10 | ||||
11 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |||
12 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
13 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
14 | for more details. | |||
15 | ||||
16 | You should have received a copy of the GNU General Public License | |||
17 | along with GCC; see the file COPYING3. If not see | |||
18 | <http://www.gnu.org/licenses/>. */ | |||
19 | ||||
20 | ||||
21 | /* This file is part of the C front end. | |||
22 | It contains routines to build C expressions given their operands, | |||
23 | including computing the types of the result, C-specific error checks, | |||
24 | and some optimization. */ | |||
25 | ||||
26 | #include "config.h" | |||
27 | #include "system.h" | |||
28 | #include "coretypes.h" | |||
29 | #include "memmodel.h" | |||
30 | #include "target.h" | |||
31 | #include "function.h" | |||
32 | #include "bitmap.h" | |||
33 | #include "c-tree.h" | |||
34 | #include "gimple-expr.h" | |||
35 | #include "predict.h" | |||
36 | #include "stor-layout.h" | |||
37 | #include "trans-mem.h" | |||
38 | #include "varasm.h" | |||
39 | #include "stmt.h" | |||
40 | #include "langhooks.h" | |||
41 | #include "c-lang.h" | |||
42 | #include "intl.h" | |||
43 | #include "tree-iterator.h" | |||
44 | #include "gimplify.h" | |||
45 | #include "tree-inline.h" | |||
46 | #include "omp-general.h" | |||
47 | #include "c-family/c-objc.h" | |||
48 | #include "c-family/c-ubsan.h" | |||
49 | #include "gomp-constants.h" | |||
50 | #include "spellcheck-tree.h" | |||
51 | #include "gcc-rich-location.h" | |||
52 | #include "stringpool.h" | |||
53 | #include "attribs.h" | |||
54 | #include "asan.h" | |||
55 | #include "realmpfr.h" | |||
56 | ||||
57 | /* Possible cases of implicit conversions. Used to select diagnostic messages | |||
58 | and control folding initializers in convert_for_assignment. */ | |||
59 | enum impl_conv { | |||
60 | ic_argpass, | |||
61 | ic_assign, | |||
62 | ic_init, | |||
63 | ic_init_const, | |||
64 | ic_return | |||
65 | }; | |||
66 | ||||
67 | /* The level of nesting inside "__alignof__". */ | |||
68 | int in_alignof; | |||
69 | ||||
70 | /* The level of nesting inside "sizeof". */ | |||
71 | int in_sizeof; | |||
72 | ||||
73 | /* The level of nesting inside "typeof". */ | |||
74 | int in_typeof; | |||
75 | ||||
76 | /* True when parsing OpenMP loop expressions. */ | |||
77 | bool c_in_omp_for; | |||
78 | ||||
79 | /* The argument of last parsed sizeof expression, only to be tested | |||
80 | if expr.original_code == SIZEOF_EXPR. */ | |||
81 | tree c_last_sizeof_arg; | |||
82 | location_t c_last_sizeof_loc; | |||
83 | ||||
84 | /* Nonzero if we might need to print a "missing braces around | |||
85 | initializer" message within this initializer. */ | |||
86 | static int found_missing_braces; | |||
87 | ||||
88 | static bool require_constant_value; | |||
89 | static bool require_constant_elements; | |||
90 | static bool require_constexpr_value; | |||
91 | ||||
92 | static tree qualify_type (tree, tree); | |||
93 | static int tagged_types_tu_compatible_p (const_tree, const_tree, bool *, | |||
94 | bool *); | |||
95 | static int comp_target_types (location_t, tree, tree); | |||
96 | static int function_types_compatible_p (const_tree, const_tree, bool *, | |||
97 | bool *); | |||
98 | static int type_lists_compatible_p (const_tree, const_tree, bool *, bool *); | |||
99 | static tree lookup_field (tree, tree); | |||
100 | static int convert_arguments (location_t, vec<location_t>, tree, | |||
101 | vec<tree, va_gc> *, vec<tree, va_gc> *, tree, | |||
102 | tree); | |||
103 | static tree pointer_diff (location_t, tree, tree, tree *); | |||
104 | static tree convert_for_assignment (location_t, location_t, tree, tree, tree, | |||
105 | enum impl_conv, bool, tree, tree, int, | |||
106 | int = 0); | |||
107 | static tree valid_compound_expr_initializer (tree, tree); | |||
108 | static void push_string (const char *); | |||
109 | static void push_member_name (tree); | |||
110 | static int spelling_length (void); | |||
111 | static char *print_spelling (char *); | |||
112 | static void warning_init (location_t, int, const char *); | |||
113 | static tree digest_init (location_t, tree, tree, tree, bool, bool, bool, bool, | |||
114 | bool, bool); | |||
115 | static void output_init_element (location_t, tree, tree, bool, tree, tree, bool, | |||
116 | bool, struct obstack *); | |||
117 | static void output_pending_init_elements (int, struct obstack *); | |||
118 | static bool set_designator (location_t, bool, struct obstack *); | |||
119 | static void push_range_stack (tree, struct obstack *); | |||
120 | static void add_pending_init (location_t, tree, tree, tree, bool, | |||
121 | struct obstack *); | |||
122 | static void set_nonincremental_init (struct obstack *); | |||
123 | static void set_nonincremental_init_from_string (tree, struct obstack *); | |||
124 | static tree find_init_member (tree, struct obstack *); | |||
125 | static void readonly_warning (tree, enum lvalue_use); | |||
126 | static int lvalue_or_else (location_t, const_tree, enum lvalue_use); | |||
127 | static void record_maybe_used_decl (tree); | |||
128 | static int comptypes_internal (const_tree, const_tree, bool *, bool *); | |||
129 | ||||
130 | /* Return true if EXP is a null pointer constant, false otherwise. */ | |||
131 | ||||
132 | bool | |||
133 | null_pointer_constant_p (const_tree expr) | |||
134 | { | |||
135 | /* This should really operate on c_expr structures, but they aren't | |||
136 | yet available everywhere required. */ | |||
137 | tree type = TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 137, __FUNCTION__))->typed.type); | |||
138 | ||||
139 | /* An integer constant expression with the value 0, such an expression | |||
140 | cast to type void*, or the predefined constant nullptr, are a null | |||
141 | pointer constant. */ | |||
142 | if (expr == nullptr_nodec_global_trees[CTI_NULLPTR]) | |||
143 | return true; | |||
144 | ||||
145 | return (TREE_CODE (expr)((enum tree_code) (expr)->base.code) == INTEGER_CST | |||
146 | && !TREE_OVERFLOW (expr)((tree_class_check ((expr), (tcc_constant), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 146, __FUNCTION__))->base.public_flag) | |||
147 | && integer_zerop (expr) | |||
148 | && (INTEGRAL_TYPE_P (type)(((enum tree_code) (type)->base.code) == ENUMERAL_TYPE || ( (enum tree_code) (type)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type)->base.code) == INTEGER_TYPE) | |||
149 | || (TREE_CODE (type)((enum tree_code) (type)->base.code) == POINTER_TYPE | |||
150 | && VOID_TYPE_P (TREE_TYPE (type))(((enum tree_code) (((contains_struct_check ((type), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 150, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE ) | |||
151 | && TYPE_QUALS (TREE_TYPE (type))((int) ((((tree_class_check ((((contains_struct_check ((type) , (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 151, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 151, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((((contains_struct_check ((type), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 151, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 151, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((((contains_struct_check ((type), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 151, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 151, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((((contains_struct_check ((type), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 151, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 151, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ) | (((((tree_class_check ((((contains_struct_check ((type), ( TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 151, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 151, __FUNCTION__))->base.u.bits.address_space) & 0xFF ) << 8)))) == TYPE_UNQUALIFIED))); | |||
152 | } | |||
153 | ||||
154 | /* EXPR may appear in an unevaluated part of an integer constant | |||
155 | expression, but not in an evaluated part. Wrap it in a | |||
156 | C_MAYBE_CONST_EXPR, or mark it with TREE_OVERFLOW if it is just an | |||
157 | INTEGER_CST and we cannot create a C_MAYBE_CONST_EXPR. */ | |||
158 | ||||
159 | static tree | |||
160 | note_integer_operands (tree expr) | |||
161 | { | |||
162 | tree ret; | |||
163 | if (TREE_CODE (expr)((enum tree_code) (expr)->base.code) == INTEGER_CST && in_late_binary_op) | |||
164 | { | |||
165 | ret = copy_node (expr); | |||
166 | TREE_OVERFLOW (ret)((tree_class_check ((ret), (tcc_constant), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 166, __FUNCTION__))->base.public_flag) = 1; | |||
167 | } | |||
168 | else | |||
169 | { | |||
170 | ret = build2 (C_MAYBE_CONST_EXPR, TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 170, __FUNCTION__))->typed.type), NULL_TREE(tree) __null, expr); | |||
171 | C_MAYBE_CONST_EXPR_INT_OPERANDS (ret)((tree_not_check2 (((tree_check ((ret), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 171, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 171, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_0) = 1; | |||
172 | } | |||
173 | return ret; | |||
174 | } | |||
175 | ||||
176 | /* Having checked whether EXPR may appear in an unevaluated part of an | |||
177 | integer constant expression and found that it may, remove any | |||
178 | C_MAYBE_CONST_EXPR noting this fact and return the resulting | |||
179 | expression. */ | |||
180 | ||||
181 | static inline tree | |||
182 | remove_c_maybe_const_expr (tree expr) | |||
183 | { | |||
184 | if (TREE_CODE (expr)((enum tree_code) (expr)->base.code) == C_MAYBE_CONST_EXPR) | |||
185 | return C_MAYBE_CONST_EXPR_EXPR (expr)(*((const_cast<tree*> (tree_operand_check (((tree_check ((expr), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 185, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 185, __FUNCTION__))))); | |||
186 | else | |||
187 | return expr; | |||
188 | } | |||
189 | ||||
190 | /* This is a cache to hold if two types are compatible or not. */ | |||
191 | ||||
192 | struct tagged_tu_seen_cache { | |||
193 | const struct tagged_tu_seen_cache * next; | |||
194 | const_tree t1; | |||
195 | const_tree t2; | |||
196 | /* The return value of tagged_types_tu_compatible_p if we had seen | |||
197 | these two types already. */ | |||
198 | int val; | |||
199 | }; | |||
200 | ||||
201 | static const struct tagged_tu_seen_cache * tagged_tu_seen_base; | |||
202 | static void free_all_tagged_tu_seen_up_to (const struct tagged_tu_seen_cache *); | |||
203 | ||||
204 | /* Do `exp = require_complete_type (loc, exp);' to make sure exp | |||
205 | does not have an incomplete type. (That includes void types.) | |||
206 | LOC is the location of the use. */ | |||
207 | ||||
208 | tree | |||
209 | require_complete_type (location_t loc, tree value) | |||
210 | { | |||
211 | tree type = TREE_TYPE (value)((contains_struct_check ((value), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 211, __FUNCTION__))->typed.type); | |||
212 | ||||
213 | if (error_operand_p (value)) | |||
214 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
215 | ||||
216 | /* First, detect a valid value with a complete type. */ | |||
217 | if (COMPLETE_TYPE_P (type)(((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 217, __FUNCTION__))->type_common.size) != (tree) __null)) | |||
218 | return value; | |||
219 | ||||
220 | c_incomplete_type_error (loc, value, type); | |||
221 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
222 | } | |||
223 | ||||
224 | /* Print an error message for invalid use of an incomplete type. | |||
225 | VALUE is the expression that was used (or 0 if that isn't known) | |||
226 | and TYPE is the type that was invalid. LOC is the location for | |||
227 | the error. */ | |||
228 | ||||
229 | void | |||
230 | c_incomplete_type_error (location_t loc, const_tree value, const_tree type) | |||
231 | { | |||
232 | /* Avoid duplicate error message. */ | |||
233 | if (TREE_CODE (type)((enum tree_code) (type)->base.code) == ERROR_MARK) | |||
234 | return; | |||
235 | ||||
236 | if (value != NULL_TREE(tree) __null && (VAR_P (value)(((enum tree_code) (value)->base.code) == VAR_DECL) || TREE_CODE (value)((enum tree_code) (value)->base.code) == PARM_DECL)) | |||
237 | error_at (loc, "%qD has an incomplete type %qT", value, type); | |||
238 | else | |||
239 | { | |||
240 | retry: | |||
241 | /* We must print an error message. Be clever about what it says. */ | |||
242 | ||||
243 | switch (TREE_CODE (type)((enum tree_code) (type)->base.code)) | |||
244 | { | |||
245 | case RECORD_TYPE: | |||
246 | case UNION_TYPE: | |||
247 | case ENUMERAL_TYPE: | |||
248 | break; | |||
249 | ||||
250 | case VOID_TYPE: | |||
251 | error_at (loc, "invalid use of void expression"); | |||
252 | return; | |||
253 | ||||
254 | case ARRAY_TYPE: | |||
255 | if (TYPE_DOMAIN (type)((tree_check ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 255, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values )) | |||
256 | { | |||
257 | if (TYPE_MAX_VALUE (TYPE_DOMAIN (type))((tree_check5 ((((tree_check ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 257, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values )), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 257, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval ) == NULL__null) | |||
258 | { | |||
259 | error_at (loc, "invalid use of flexible array member"); | |||
260 | return; | |||
261 | } | |||
262 | type = TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 262, __FUNCTION__))->typed.type); | |||
263 | goto retry; | |||
264 | } | |||
265 | error_at (loc, "invalid use of array with unspecified bounds"); | |||
266 | return; | |||
267 | ||||
268 | default: | |||
269 | gcc_unreachable ()(fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 269, __FUNCTION__)); | |||
270 | } | |||
271 | ||||
272 | if (TREE_CODE (TYPE_NAME (type))((enum tree_code) (((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 272, __FUNCTION__))->type_common.name))->base.code) == IDENTIFIER_NODE) | |||
273 | error_at (loc, "invalid use of undefined type %qT", type); | |||
274 | else | |||
275 | /* If this type has a typedef-name, the TYPE_NAME is a TYPE_DECL. */ | |||
276 | error_at (loc, "invalid use of incomplete typedef %qT", type); | |||
277 | } | |||
278 | } | |||
279 | ||||
280 | /* Given a type, apply default promotions wrt unnamed function | |||
281 | arguments and return the new type. */ | |||
282 | ||||
283 | tree | |||
284 | c_type_promotes_to (tree type) | |||
285 | { | |||
286 | tree ret = NULL_TREE(tree) __null; | |||
287 | ||||
288 | if (TYPE_MAIN_VARIANT (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 288, __FUNCTION__))->type_common.main_variant) == float_type_nodeglobal_trees[TI_FLOAT_TYPE]) | |||
289 | ret = double_type_nodeglobal_trees[TI_DOUBLE_TYPE]; | |||
290 | else if (c_promoting_integer_type_p (type)) | |||
291 | { | |||
292 | /* Preserve unsignedness if not really getting any wider. */ | |||
293 | if (TYPE_UNSIGNED (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 293, __FUNCTION__))->base.u.bits.unsigned_flag) | |||
294 | && (TYPE_PRECISION (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 294, __FUNCTION__))->type_common.precision) == TYPE_PRECISION (integer_type_node)((tree_class_check ((integer_types[itk_int]), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 294, __FUNCTION__))->type_common.precision))) | |||
295 | ret = unsigned_type_nodeinteger_types[itk_unsigned_int]; | |||
296 | else | |||
297 | ret = integer_type_nodeinteger_types[itk_int]; | |||
298 | } | |||
299 | ||||
300 | if (ret != NULL_TREE(tree) __null) | |||
301 | return (TYPE_ATOMIC (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 301, __FUNCTION__))->base.u.bits.atomic_flag) | |||
302 | ? c_build_qualified_type (ret, TYPE_QUAL_ATOMIC) | |||
303 | : ret); | |||
304 | ||||
305 | return type; | |||
306 | } | |||
307 | ||||
308 | /* Return true if between two named address spaces, whether there is a superset | |||
309 | named address space that encompasses both address spaces. If there is a | |||
310 | superset, return which address space is the superset. */ | |||
311 | ||||
312 | static bool | |||
313 | addr_space_superset (addr_space_t as1, addr_space_t as2, addr_space_t *common) | |||
314 | { | |||
315 | if (as1 == as2) | |||
316 | { | |||
317 | *common = as1; | |||
318 | return true; | |||
319 | } | |||
320 | else if (targetm.addr_space.subset_p (as1, as2)) | |||
321 | { | |||
322 | *common = as2; | |||
323 | return true; | |||
324 | } | |||
325 | else if (targetm.addr_space.subset_p (as2, as1)) | |||
326 | { | |||
327 | *common = as1; | |||
328 | return true; | |||
329 | } | |||
330 | else | |||
331 | return false; | |||
332 | } | |||
333 | ||||
334 | /* Return a variant of TYPE which has all the type qualifiers of LIKE | |||
335 | as well as those of TYPE. */ | |||
336 | ||||
337 | static tree | |||
338 | qualify_type (tree type, tree like) | |||
339 | { | |||
340 | addr_space_t as_type = TYPE_ADDR_SPACE (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 340, __FUNCTION__))->base.u.bits.address_space); | |||
341 | addr_space_t as_like = TYPE_ADDR_SPACE (like)((tree_class_check ((like), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 341, __FUNCTION__))->base.u.bits.address_space); | |||
342 | addr_space_t as_common; | |||
343 | ||||
344 | /* If the two named address spaces are different, determine the common | |||
345 | superset address space. If there isn't one, raise an error. */ | |||
346 | if (!addr_space_superset (as_type, as_like, &as_common)) | |||
347 | { | |||
348 | as_common = as_type; | |||
349 | error ("%qT and %qT are in disjoint named address spaces", | |||
350 | type, like); | |||
351 | } | |||
352 | ||||
353 | return c_build_qualified_type (type, | |||
354 | TYPE_QUALS_NO_ADDR_SPACE (type)((int) ((((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 354, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 354, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 354, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 354, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ))) | |||
355 | | TYPE_QUALS_NO_ADDR_SPACE_NO_ATOMIC (like)((int) ((((tree_class_check ((like), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 355, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((like), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 355, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((like), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 355, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ))) | |||
356 | | ENCODE_QUAL_ADDR_SPACE (as_common)((as_common & 0xFF) << 8)); | |||
357 | } | |||
358 | ||||
359 | ||||
360 | /* If NTYPE is a type of a non-variadic function with a prototype | |||
361 | and OTYPE is a type of a function without a prototype and ATTRS | |||
362 | contains attribute format, diagnosess and removes it from ATTRS. | |||
363 | Returns the result of build_type_attribute_variant of NTYPE and | |||
364 | the (possibly) modified ATTRS. */ | |||
365 | ||||
366 | static tree | |||
367 | build_functype_attribute_variant (tree ntype, tree otype, tree attrs) | |||
368 | { | |||
369 | if (!prototype_p (otype) | |||
370 | && prototype_p (ntype) | |||
371 | && lookup_attribute ("format", attrs)) | |||
372 | { | |||
373 | warning_at (input_location, OPT_Wattributes, | |||
374 | "%qs attribute cannot be applied to a function that " | |||
375 | "does not take variable arguments", "format"); | |||
376 | attrs = remove_attribute ("format", attrs); | |||
377 | } | |||
378 | return build_type_attribute_variant (ntype, attrs); | |||
379 | ||||
380 | } | |||
381 | /* Return the composite type of two compatible types. | |||
382 | ||||
383 | We assume that comptypes has already been done and returned | |||
384 | nonzero; if that isn't so, this may crash. In particular, we | |||
385 | assume that qualifiers match. */ | |||
386 | ||||
387 | tree | |||
388 | composite_type (tree t1, tree t2) | |||
389 | { | |||
390 | enum tree_code code1; | |||
391 | enum tree_code code2; | |||
392 | tree attributes; | |||
393 | ||||
394 | /* Save time if the two types are the same. */ | |||
395 | ||||
396 | if (t1 == t2) return t1; | |||
397 | ||||
398 | /* If one type is nonsense, use the other. */ | |||
399 | if (t1 == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
400 | return t2; | |||
401 | if (t2 == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
402 | return t1; | |||
403 | ||||
404 | code1 = TREE_CODE (t1)((enum tree_code) (t1)->base.code); | |||
405 | code2 = TREE_CODE (t2)((enum tree_code) (t2)->base.code); | |||
406 | ||||
407 | /* Merge the attributes. */ | |||
408 | attributes = targetm.merge_type_attributes (t1, t2); | |||
409 | ||||
410 | /* If one is an enumerated type and the other is the compatible | |||
411 | integer type, the composite type might be either of the two | |||
412 | (DR#013 question 3). For consistency, use the enumerated type as | |||
413 | the composite type. */ | |||
414 | ||||
415 | if (code1 == ENUMERAL_TYPE | |||
416 | && (code2 == INTEGER_TYPE || code2 == BOOLEAN_TYPE)) | |||
417 | return t1; | |||
418 | if (code2 == ENUMERAL_TYPE | |||
419 | && (code1 == INTEGER_TYPE || code1 == BOOLEAN_TYPE)) | |||
420 | return t2; | |||
421 | ||||
422 | gcc_assert (code1 == code2)((void)(!(code1 == code2) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 422, __FUNCTION__), 0 : 0)); | |||
423 | ||||
424 | switch (code1) | |||
425 | { | |||
426 | case POINTER_TYPE: | |||
427 | /* For two pointers, do this recursively on the target type. */ | |||
428 | { | |||
429 | tree pointed_to_1 = TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 429, __FUNCTION__))->typed.type); | |||
430 | tree pointed_to_2 = TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 430, __FUNCTION__))->typed.type); | |||
431 | tree target = composite_type (pointed_to_1, pointed_to_2); | |||
432 | t1 = build_pointer_type_for_mode (target, TYPE_MODE (t1)((((enum tree_code) ((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 432, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode (t1) : (t1)->type_common.mode), false); | |||
433 | t1 = build_type_attribute_variant (t1, attributes); | |||
434 | return qualify_type (t1, t2); | |||
435 | } | |||
436 | ||||
437 | case ARRAY_TYPE: | |||
438 | { | |||
439 | tree elt = composite_type (TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 439, __FUNCTION__))->typed.type), TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 439, __FUNCTION__))->typed.type)); | |||
440 | int quals; | |||
441 | tree unqual_elt; | |||
442 | tree d1 = TYPE_DOMAIN (t1)((tree_check ((t1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 442, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ); | |||
443 | tree d2 = TYPE_DOMAIN (t2)((tree_check ((t2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 443, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ); | |||
444 | bool d1_variable, d2_variable; | |||
445 | bool d1_zero, d2_zero; | |||
446 | bool t1_complete, t2_complete; | |||
447 | ||||
448 | /* We should not have any type quals on arrays at all. */ | |||
449 | gcc_assert (!TYPE_QUALS_NO_ADDR_SPACE (t1)((void)(!(!((int) ((((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 449, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 449, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 449, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 449, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ))) && !((int) ((((tree_class_check ((t2), (tcc_type) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 450, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 450, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 450, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 450, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT )))) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 450, __FUNCTION__), 0 : 0)) | |||
450 | && !TYPE_QUALS_NO_ADDR_SPACE (t2))((void)(!(!((int) ((((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 449, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 449, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 449, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 449, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ))) && !((int) ((((tree_class_check ((t2), (tcc_type) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 450, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 450, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 450, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 450, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT )))) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 450, __FUNCTION__), 0 : 0)); | |||
451 | ||||
452 | t1_complete = COMPLETE_TYPE_P (t1)(((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 452, __FUNCTION__))->type_common.size) != (tree) __null); | |||
453 | t2_complete = COMPLETE_TYPE_P (t2)(((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 453, __FUNCTION__))->type_common.size) != (tree) __null); | |||
454 | ||||
455 | d1_zero = d1 == NULL_TREE(tree) __null || !TYPE_MAX_VALUE (d1)((tree_check5 ((d1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 455, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval ); | |||
456 | d2_zero = d2 == NULL_TREE(tree) __null || !TYPE_MAX_VALUE (d2)((tree_check5 ((d2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 456, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval ); | |||
457 | ||||
458 | d1_variable = (!d1_zero | |||
459 | && (TREE_CODE (TYPE_MIN_VALUE (d1))((enum tree_code) (((tree_check5 ((d1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 459, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.minval ))->base.code) != INTEGER_CST | |||
460 | || TREE_CODE (TYPE_MAX_VALUE (d1))((enum tree_code) (((tree_check5 ((d1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 460, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval ))->base.code) != INTEGER_CST)); | |||
461 | d2_variable = (!d2_zero | |||
462 | && (TREE_CODE (TYPE_MIN_VALUE (d2))((enum tree_code) (((tree_check5 ((d2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 462, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.minval ))->base.code) != INTEGER_CST | |||
463 | || TREE_CODE (TYPE_MAX_VALUE (d2))((enum tree_code) (((tree_check5 ((d2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 463, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval ))->base.code) != INTEGER_CST)); | |||
464 | d1_variable = d1_variable || (d1_zero && C_TYPE_VARIABLE_SIZE (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 464, __FUNCTION__))->type_common.lang_flag_1)); | |||
465 | d2_variable = d2_variable || (d2_zero && C_TYPE_VARIABLE_SIZE (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 465, __FUNCTION__))->type_common.lang_flag_1)); | |||
466 | ||||
467 | /* Save space: see if the result is identical to one of the args. */ | |||
468 | if (elt == TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 468, __FUNCTION__))->typed.type) && TYPE_DOMAIN (t1)((tree_check ((t1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 468, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) | |||
469 | && (d2_variable || d2_zero || !d1_variable)) | |||
470 | return build_type_attribute_variant (t1, attributes); | |||
471 | if (elt == TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 471, __FUNCTION__))->typed.type) && TYPE_DOMAIN (t2)((tree_check ((t2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 471, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) | |||
472 | && (d1_variable || d1_zero || !d2_variable)) | |||
473 | return build_type_attribute_variant (t2, attributes); | |||
474 | ||||
475 | if (elt == TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 475, __FUNCTION__))->typed.type) && !TYPE_DOMAIN (t2)((tree_check ((t2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 475, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) && !TYPE_DOMAIN (t1)((tree_check ((t1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 475, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values )) | |||
476 | return build_type_attribute_variant (t1, attributes); | |||
477 | if (elt == TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 477, __FUNCTION__))->typed.type) && !TYPE_DOMAIN (t2)((tree_check ((t2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 477, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) && !TYPE_DOMAIN (t1)((tree_check ((t1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 477, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values )) | |||
478 | return build_type_attribute_variant (t2, attributes); | |||
479 | ||||
480 | /* Merge the element types, and have a size if either arg has | |||
481 | one. We may have qualifiers on the element types. To set | |||
482 | up TYPE_MAIN_VARIANT correctly, we need to form the | |||
483 | composite of the unqualified types and add the qualifiers | |||
484 | back at the end. */ | |||
485 | quals = TYPE_QUALS (strip_array_types (elt))((int) ((((tree_class_check ((strip_array_types (elt)), (tcc_type ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 485, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((strip_array_types (elt)), (tcc_type ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 485, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((strip_array_types (elt)), (tcc_type ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 485, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((strip_array_types (elt)), (tcc_type ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 485, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ) | (((((tree_class_check ((strip_array_types (elt)), (tcc_type ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 485, __FUNCTION__))->base.u.bits.address_space) & 0xFF ) << 8)))); | |||
486 | unqual_elt = c_build_qualified_type (elt, TYPE_UNQUALIFIED); | |||
487 | t1 = build_array_type (unqual_elt, | |||
488 | TYPE_DOMAIN ((TYPE_DOMAIN (t1)((tree_check (((((tree_check ((t1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 488, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) && (d2_variable || d2_zero || !d1_variable)) ? t1 : t2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 493, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) | |||
489 | && (d2_variable((tree_check (((((tree_check ((t1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 488, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) && (d2_variable || d2_zero || !d1_variable)) ? t1 : t2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 493, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) | |||
490 | || d2_zero((tree_check (((((tree_check ((t1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 488, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) && (d2_variable || d2_zero || !d1_variable)) ? t1 : t2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 493, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) | |||
491 | || !d1_variable))((tree_check (((((tree_check ((t1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 488, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) && (d2_variable || d2_zero || !d1_variable)) ? t1 : t2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 493, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) | |||
492 | ? t1((tree_check (((((tree_check ((t1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 488, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) && (d2_variable || d2_zero || !d1_variable)) ? t1 : t2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 493, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) | |||
493 | : t2)((tree_check (((((tree_check ((t1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 488, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) && (d2_variable || d2_zero || !d1_variable)) ? t1 : t2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 493, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values )); | |||
494 | /* Ensure a composite type involving a zero-length array type | |||
495 | is a zero-length type not an incomplete type. */ | |||
496 | if (d1_zero && d2_zero | |||
497 | && (t1_complete || t2_complete) | |||
498 | && !COMPLETE_TYPE_P (t1)(((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 498, __FUNCTION__))->type_common.size) != (tree) __null)) | |||
499 | { | |||
500 | TYPE_SIZE (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 500, __FUNCTION__))->type_common.size) = bitsize_zero_nodeglobal_trees[TI_BITSIZE_ZERO]; | |||
501 | TYPE_SIZE_UNIT (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 501, __FUNCTION__))->type_common.size_unit) = size_zero_nodeglobal_trees[TI_SIZE_ZERO]; | |||
502 | } | |||
503 | t1 = c_build_qualified_type (t1, quals); | |||
504 | return build_type_attribute_variant (t1, attributes); | |||
505 | } | |||
506 | ||||
507 | case ENUMERAL_TYPE: | |||
508 | case RECORD_TYPE: | |||
509 | case UNION_TYPE: | |||
510 | if (attributes != NULL__null) | |||
511 | { | |||
512 | /* Try harder not to create a new aggregate type. */ | |||
513 | if (attribute_list_equal (TYPE_ATTRIBUTES (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 513, __FUNCTION__))->type_common.attributes), attributes)) | |||
514 | return t1; | |||
515 | if (attribute_list_equal (TYPE_ATTRIBUTES (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 515, __FUNCTION__))->type_common.attributes), attributes)) | |||
516 | return t2; | |||
517 | } | |||
518 | return build_type_attribute_variant (t1, attributes); | |||
519 | ||||
520 | case FUNCTION_TYPE: | |||
521 | /* Function types: prefer the one that specified arg types. | |||
522 | If both do, merge the arg types. Also merge the return types. */ | |||
523 | { | |||
524 | tree valtype = composite_type (TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 524, __FUNCTION__))->typed.type), TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 524, __FUNCTION__))->typed.type)); | |||
525 | tree p1 = TYPE_ARG_TYPES (t1)((tree_check2 ((t1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 525, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values); | |||
526 | tree p2 = TYPE_ARG_TYPES (t2)((tree_check2 ((t2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 526, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values); | |||
527 | int len; | |||
528 | tree newargs, n; | |||
529 | int i; | |||
530 | ||||
531 | /* Save space: see if the result is identical to one of the args. */ | |||
532 | if (valtype == TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 532, __FUNCTION__))->typed.type) && !TYPE_ARG_TYPES (t2)((tree_check2 ((t2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 532, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values)) | |||
533 | return build_functype_attribute_variant (t1, t2, attributes); | |||
534 | if (valtype == TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 534, __FUNCTION__))->typed.type) && !TYPE_ARG_TYPES (t1)((tree_check2 ((t1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 534, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values)) | |||
535 | return build_functype_attribute_variant (t2, t1, attributes); | |||
536 | ||||
537 | /* Simple way if one arg fails to specify argument types. */ | |||
538 | if (TYPE_ARG_TYPES (t1)((tree_check2 ((t1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 538, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values) == NULL_TREE(tree) __null) | |||
539 | { | |||
540 | t1 = build_function_type (valtype, TYPE_ARG_TYPES (t2)((tree_check2 ((t2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 540, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values), | |||
541 | TYPE_NO_NAMED_ARGS_STDARG_P (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 541, __FUNCTION__))->type_common.no_named_args_stdarg_p)); | |||
542 | t1 = build_type_attribute_variant (t1, attributes); | |||
543 | return qualify_type (t1, t2); | |||
544 | } | |||
545 | if (TYPE_ARG_TYPES (t2)((tree_check2 ((t2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 545, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values) == NULL_TREE(tree) __null) | |||
546 | { | |||
547 | t1 = build_function_type (valtype, TYPE_ARG_TYPES (t1)((tree_check2 ((t1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 547, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values), | |||
548 | TYPE_NO_NAMED_ARGS_STDARG_P (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 548, __FUNCTION__))->type_common.no_named_args_stdarg_p)); | |||
549 | t1 = build_type_attribute_variant (t1, attributes); | |||
550 | return qualify_type (t1, t2); | |||
551 | } | |||
552 | ||||
553 | /* If both args specify argument types, we must merge the two | |||
554 | lists, argument by argument. */ | |||
555 | ||||
556 | for (len = 0, newargs = p1; | |||
557 | newargs && newargs != void_list_nodeglobal_trees[TI_VOID_LIST_NODE]; | |||
558 | len++, newargs = TREE_CHAIN (newargs)((contains_struct_check ((newargs), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 558, __FUNCTION__))->common.chain)) | |||
559 | ; | |||
560 | ||||
561 | for (i = 0; i < len; i++) | |||
562 | newargs = tree_cons (NULL_TREE(tree) __null, NULL_TREE(tree) __null, newargs); | |||
563 | ||||
564 | n = newargs; | |||
565 | ||||
566 | for (; p1 && p1 != void_list_nodeglobal_trees[TI_VOID_LIST_NODE]; | |||
567 | p1 = TREE_CHAIN (p1)((contains_struct_check ((p1), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 567, __FUNCTION__))->common.chain), p2 = TREE_CHAIN (p2)((contains_struct_check ((p2), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 567, __FUNCTION__))->common.chain), n = TREE_CHAIN (n)((contains_struct_check ((n), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 567, __FUNCTION__))->common.chain)) | |||
568 | { | |||
569 | /* A null type means arg type is not specified. | |||
570 | Take whatever the other function type has. */ | |||
571 | if (TREE_VALUE (p1)((tree_check ((p1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 571, __FUNCTION__, (TREE_LIST)))->list.value) == NULL_TREE(tree) __null) | |||
572 | { | |||
573 | TREE_VALUE (n)((tree_check ((n), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 573, __FUNCTION__, (TREE_LIST)))->list.value) = TREE_VALUE (p2)((tree_check ((p2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 573, __FUNCTION__, (TREE_LIST)))->list.value); | |||
574 | goto parm_done; | |||
575 | } | |||
576 | if (TREE_VALUE (p2)((tree_check ((p2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 576, __FUNCTION__, (TREE_LIST)))->list.value) == NULL_TREE(tree) __null) | |||
577 | { | |||
578 | TREE_VALUE (n)((tree_check ((n), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 578, __FUNCTION__, (TREE_LIST)))->list.value) = TREE_VALUE (p1)((tree_check ((p1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 578, __FUNCTION__, (TREE_LIST)))->list.value); | |||
579 | goto parm_done; | |||
580 | } | |||
581 | ||||
582 | /* Given wait (union {union wait *u; int *i} *) | |||
583 | and wait (union wait *), | |||
584 | prefer union wait * as type of parm. */ | |||
585 | if (TREE_CODE (TREE_VALUE (p1))((enum tree_code) (((tree_check ((p1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 585, __FUNCTION__, (TREE_LIST)))->list.value))->base. code) == UNION_TYPE | |||
586 | && TREE_VALUE (p1)((tree_check ((p1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 586, __FUNCTION__, (TREE_LIST)))->list.value) != TREE_VALUE (p2)((tree_check ((p2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 586, __FUNCTION__, (TREE_LIST)))->list.value)) | |||
587 | { | |||
588 | tree memb; | |||
589 | tree mv2 = TREE_VALUE (p2)((tree_check ((p2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 589, __FUNCTION__, (TREE_LIST)))->list.value); | |||
590 | if (mv2 && mv2 != error_mark_nodeglobal_trees[TI_ERROR_MARK] | |||
591 | && TREE_CODE (mv2)((enum tree_code) (mv2)->base.code) != ARRAY_TYPE) | |||
592 | mv2 = TYPE_MAIN_VARIANT (mv2)((tree_class_check ((mv2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 592, __FUNCTION__))->type_common.main_variant); | |||
593 | for (memb = TYPE_FIELDS (TREE_VALUE (p1))((tree_check3 ((((tree_check ((p1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 593, __FUNCTION__, (TREE_LIST)))->list.value)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 593, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); | |||
594 | memb; memb = DECL_CHAIN (memb)(((contains_struct_check (((contains_struct_check ((memb), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 594, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 594, __FUNCTION__))->common.chain))) | |||
595 | { | |||
596 | tree mv3 = TREE_TYPE (memb)((contains_struct_check ((memb), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 596, __FUNCTION__))->typed.type); | |||
597 | if (mv3 && mv3 != error_mark_nodeglobal_trees[TI_ERROR_MARK] | |||
598 | && TREE_CODE (mv3)((enum tree_code) (mv3)->base.code) != ARRAY_TYPE) | |||
599 | mv3 = TYPE_MAIN_VARIANT (mv3)((tree_class_check ((mv3), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 599, __FUNCTION__))->type_common.main_variant); | |||
600 | if (comptypes (mv3, mv2)) | |||
601 | { | |||
602 | TREE_VALUE (n)((tree_check ((n), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 602, __FUNCTION__, (TREE_LIST)))->list.value) = composite_type (TREE_TYPE (memb)((contains_struct_check ((memb), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 602, __FUNCTION__))->typed.type), | |||
603 | TREE_VALUE (p2)((tree_check ((p2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 603, __FUNCTION__, (TREE_LIST)))->list.value)); | |||
604 | pedwarn (input_location, OPT_Wpedantic, | |||
605 | "function types not truly compatible in ISO C"); | |||
606 | goto parm_done; | |||
607 | } | |||
608 | } | |||
609 | } | |||
610 | if (TREE_CODE (TREE_VALUE (p2))((enum tree_code) (((tree_check ((p2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 610, __FUNCTION__, (TREE_LIST)))->list.value))->base. code) == UNION_TYPE | |||
611 | && TREE_VALUE (p2)((tree_check ((p2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 611, __FUNCTION__, (TREE_LIST)))->list.value) != TREE_VALUE (p1)((tree_check ((p1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 611, __FUNCTION__, (TREE_LIST)))->list.value)) | |||
612 | { | |||
613 | tree memb; | |||
614 | tree mv1 = TREE_VALUE (p1)((tree_check ((p1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 614, __FUNCTION__, (TREE_LIST)))->list.value); | |||
615 | if (mv1 && mv1 != error_mark_nodeglobal_trees[TI_ERROR_MARK] | |||
616 | && TREE_CODE (mv1)((enum tree_code) (mv1)->base.code) != ARRAY_TYPE) | |||
617 | mv1 = TYPE_MAIN_VARIANT (mv1)((tree_class_check ((mv1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 617, __FUNCTION__))->type_common.main_variant); | |||
618 | for (memb = TYPE_FIELDS (TREE_VALUE (p2))((tree_check3 ((((tree_check ((p2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 618, __FUNCTION__, (TREE_LIST)))->list.value)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 618, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); | |||
619 | memb; memb = DECL_CHAIN (memb)(((contains_struct_check (((contains_struct_check ((memb), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 619, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 619, __FUNCTION__))->common.chain))) | |||
620 | { | |||
621 | tree mv3 = TREE_TYPE (memb)((contains_struct_check ((memb), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 621, __FUNCTION__))->typed.type); | |||
622 | if (mv3 && mv3 != error_mark_nodeglobal_trees[TI_ERROR_MARK] | |||
623 | && TREE_CODE (mv3)((enum tree_code) (mv3)->base.code) != ARRAY_TYPE) | |||
624 | mv3 = TYPE_MAIN_VARIANT (mv3)((tree_class_check ((mv3), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 624, __FUNCTION__))->type_common.main_variant); | |||
625 | if (comptypes (mv3, mv1)) | |||
626 | { | |||
627 | TREE_VALUE (n)((tree_check ((n), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 627, __FUNCTION__, (TREE_LIST)))->list.value) = composite_type (TREE_TYPE (memb)((contains_struct_check ((memb), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 627, __FUNCTION__))->typed.type), | |||
628 | TREE_VALUE (p1)((tree_check ((p1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 628, __FUNCTION__, (TREE_LIST)))->list.value)); | |||
629 | pedwarn (input_location, OPT_Wpedantic, | |||
630 | "function types not truly compatible in ISO C"); | |||
631 | goto parm_done; | |||
632 | } | |||
633 | } | |||
634 | } | |||
635 | TREE_VALUE (n)((tree_check ((n), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 635, __FUNCTION__, (TREE_LIST)))->list.value) = composite_type (TREE_VALUE (p1)((tree_check ((p1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 635, __FUNCTION__, (TREE_LIST)))->list.value), TREE_VALUE (p2)((tree_check ((p2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 635, __FUNCTION__, (TREE_LIST)))->list.value)); | |||
636 | parm_done: ; | |||
637 | } | |||
638 | ||||
639 | t1 = build_function_type (valtype, newargs); | |||
640 | t1 = qualify_type (t1, t2); | |||
641 | } | |||
642 | /* FALLTHRU */ | |||
643 | ||||
644 | default: | |||
645 | return build_type_attribute_variant (t1, attributes); | |||
646 | } | |||
647 | ||||
648 | } | |||
649 | ||||
650 | /* Return the type of a conditional expression between pointers to | |||
651 | possibly differently qualified versions of compatible types. | |||
652 | ||||
653 | We assume that comp_target_types has already been done and returned | |||
654 | nonzero; if that isn't so, this may crash. */ | |||
655 | ||||
656 | static tree | |||
657 | common_pointer_type (tree t1, tree t2) | |||
658 | { | |||
659 | tree attributes; | |||
660 | tree pointed_to_1, mv1; | |||
661 | tree pointed_to_2, mv2; | |||
662 | tree target; | |||
663 | unsigned target_quals; | |||
664 | addr_space_t as1, as2, as_common; | |||
665 | int quals1, quals2; | |||
666 | ||||
667 | /* Save time if the two types are the same. */ | |||
668 | ||||
669 | if (t1 == t2) return t1; | |||
670 | ||||
671 | /* If one type is nonsense, use the other. */ | |||
672 | if (t1 == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
673 | return t2; | |||
674 | if (t2 == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
675 | return t1; | |||
676 | ||||
677 | gcc_assert (TREE_CODE (t1) == POINTER_TYPE((void)(!(((enum tree_code) (t1)->base.code) == POINTER_TYPE && ((enum tree_code) (t2)->base.code) == POINTER_TYPE ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 678, __FUNCTION__), 0 : 0)) | |||
678 | && TREE_CODE (t2) == POINTER_TYPE)((void)(!(((enum tree_code) (t1)->base.code) == POINTER_TYPE && ((enum tree_code) (t2)->base.code) == POINTER_TYPE ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 678, __FUNCTION__), 0 : 0)); | |||
679 | ||||
680 | /* Merge the attributes. */ | |||
681 | attributes = targetm.merge_type_attributes (t1, t2); | |||
682 | ||||
683 | /* Find the composite type of the target types, and combine the | |||
684 | qualifiers of the two types' targets. Do not lose qualifiers on | |||
685 | array element types by taking the TYPE_MAIN_VARIANT. */ | |||
686 | mv1 = pointed_to_1 = TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 686, __FUNCTION__))->typed.type); | |||
687 | mv2 = pointed_to_2 = TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 687, __FUNCTION__))->typed.type); | |||
688 | if (TREE_CODE (mv1)((enum tree_code) (mv1)->base.code) != ARRAY_TYPE) | |||
689 | mv1 = TYPE_MAIN_VARIANT (pointed_to_1)((tree_class_check ((pointed_to_1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 689, __FUNCTION__))->type_common.main_variant); | |||
690 | if (TREE_CODE (mv2)((enum tree_code) (mv2)->base.code) != ARRAY_TYPE) | |||
691 | mv2 = TYPE_MAIN_VARIANT (pointed_to_2)((tree_class_check ((pointed_to_2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 691, __FUNCTION__))->type_common.main_variant); | |||
692 | target = composite_type (mv1, mv2); | |||
693 | ||||
694 | /* Strip array types to get correct qualifier for pointers to arrays */ | |||
695 | quals1 = TYPE_QUALS_NO_ADDR_SPACE (strip_array_types (pointed_to_1))((int) ((((tree_class_check ((strip_array_types (pointed_to_1 )), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 695, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((strip_array_types (pointed_to_1)), ( tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 695, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((strip_array_types (pointed_to_1)), ( tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 695, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((strip_array_types (pointed_to_1)), ( tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 695, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ))); | |||
696 | quals2 = TYPE_QUALS_NO_ADDR_SPACE (strip_array_types (pointed_to_2))((int) ((((tree_class_check ((strip_array_types (pointed_to_2 )), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 696, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((strip_array_types (pointed_to_2)), ( tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 696, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((strip_array_types (pointed_to_2)), ( tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 696, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((strip_array_types (pointed_to_2)), ( tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 696, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ))); | |||
697 | ||||
698 | /* For function types do not merge const qualifiers, but drop them | |||
699 | if used inconsistently. The middle-end uses these to mark const | |||
700 | and noreturn functions. */ | |||
701 | if (TREE_CODE (pointed_to_1)((enum tree_code) (pointed_to_1)->base.code) == FUNCTION_TYPE) | |||
702 | target_quals = (quals1 & quals2); | |||
703 | else | |||
704 | target_quals = (quals1 | quals2); | |||
705 | ||||
706 | /* If the two named address spaces are different, determine the common | |||
707 | superset address space. This is guaranteed to exist due to the | |||
708 | assumption that comp_target_type returned non-zero. */ | |||
709 | as1 = TYPE_ADDR_SPACE (pointed_to_1)((tree_class_check ((pointed_to_1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 709, __FUNCTION__))->base.u.bits.address_space); | |||
710 | as2 = TYPE_ADDR_SPACE (pointed_to_2)((tree_class_check ((pointed_to_2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 710, __FUNCTION__))->base.u.bits.address_space); | |||
711 | if (!addr_space_superset (as1, as2, &as_common)) | |||
712 | gcc_unreachable ()(fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 712, __FUNCTION__)); | |||
713 | ||||
714 | target_quals |= ENCODE_QUAL_ADDR_SPACE (as_common)((as_common & 0xFF) << 8); | |||
715 | ||||
716 | t1 = build_pointer_type (c_build_qualified_type (target, target_quals)); | |||
717 | return build_type_attribute_variant (t1, attributes); | |||
718 | } | |||
719 | ||||
720 | /* Return the common type for two arithmetic types under the usual | |||
721 | arithmetic conversions. The default conversions have already been | |||
722 | applied, and enumerated types converted to their compatible integer | |||
723 | types. The resulting type is unqualified and has no attributes. | |||
724 | ||||
725 | This is the type for the result of most arithmetic operations | |||
726 | if the operands have the given two types. */ | |||
727 | ||||
728 | static tree | |||
729 | c_common_type (tree t1, tree t2) | |||
730 | { | |||
731 | enum tree_code code1; | |||
732 | enum tree_code code2; | |||
733 | ||||
734 | /* If one type is nonsense, use the other. */ | |||
735 | if (t1 == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
736 | return t2; | |||
737 | if (t2 == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
738 | return t1; | |||
739 | ||||
740 | if (TYPE_QUALS (t1)((int) ((((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 740, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 740, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 740, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 740, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ) | (((((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 740, __FUNCTION__))->base.u.bits.address_space) & 0xFF ) << 8)))) != TYPE_UNQUALIFIED) | |||
741 | t1 = TYPE_MAIN_VARIANT (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 741, __FUNCTION__))->type_common.main_variant); | |||
742 | ||||
743 | if (TYPE_QUALS (t2)((int) ((((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 743, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 743, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 743, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 743, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ) | (((((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 743, __FUNCTION__))->base.u.bits.address_space) & 0xFF ) << 8)))) != TYPE_UNQUALIFIED) | |||
744 | t2 = TYPE_MAIN_VARIANT (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 744, __FUNCTION__))->type_common.main_variant); | |||
745 | ||||
746 | if (TYPE_ATTRIBUTES (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 746, __FUNCTION__))->type_common.attributes) != NULL_TREE(tree) __null) | |||
747 | { | |||
748 | tree attrs = affects_type_identity_attributes (TYPE_ATTRIBUTES (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 748, __FUNCTION__))->type_common.attributes)); | |||
749 | t1 = build_type_attribute_variant (t1, attrs); | |||
750 | } | |||
751 | ||||
752 | if (TYPE_ATTRIBUTES (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 752, __FUNCTION__))->type_common.attributes) != NULL_TREE(tree) __null) | |||
753 | { | |||
754 | tree attrs = affects_type_identity_attributes (TYPE_ATTRIBUTES (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 754, __FUNCTION__))->type_common.attributes)); | |||
755 | t2 = build_type_attribute_variant (t2, attrs); | |||
756 | } | |||
757 | ||||
758 | /* Save time if the two types are the same. */ | |||
759 | ||||
760 | if (t1 == t2) return t1; | |||
761 | ||||
762 | code1 = TREE_CODE (t1)((enum tree_code) (t1)->base.code); | |||
763 | code2 = TREE_CODE (t2)((enum tree_code) (t2)->base.code); | |||
764 | ||||
765 | gcc_assert (code1 == VECTOR_TYPE || code1 == COMPLEX_TYPE((void)(!(code1 == VECTOR_TYPE || code1 == COMPLEX_TYPE || code1 == FIXED_POINT_TYPE || code1 == REAL_TYPE || code1 == INTEGER_TYPE ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 767, __FUNCTION__), 0 : 0)) | |||
766 | || code1 == FIXED_POINT_TYPE || code1 == REAL_TYPE((void)(!(code1 == VECTOR_TYPE || code1 == COMPLEX_TYPE || code1 == FIXED_POINT_TYPE || code1 == REAL_TYPE || code1 == INTEGER_TYPE ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 767, __FUNCTION__), 0 : 0)) | |||
767 | || code1 == INTEGER_TYPE)((void)(!(code1 == VECTOR_TYPE || code1 == COMPLEX_TYPE || code1 == FIXED_POINT_TYPE || code1 == REAL_TYPE || code1 == INTEGER_TYPE ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 767, __FUNCTION__), 0 : 0)); | |||
768 | gcc_assert (code2 == VECTOR_TYPE || code2 == COMPLEX_TYPE((void)(!(code2 == VECTOR_TYPE || code2 == COMPLEX_TYPE || code2 == FIXED_POINT_TYPE || code2 == REAL_TYPE || code2 == INTEGER_TYPE ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 770, __FUNCTION__), 0 : 0)) | |||
769 | || code2 == FIXED_POINT_TYPE || code2 == REAL_TYPE((void)(!(code2 == VECTOR_TYPE || code2 == COMPLEX_TYPE || code2 == FIXED_POINT_TYPE || code2 == REAL_TYPE || code2 == INTEGER_TYPE ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 770, __FUNCTION__), 0 : 0)) | |||
770 | || code2 == INTEGER_TYPE)((void)(!(code2 == VECTOR_TYPE || code2 == COMPLEX_TYPE || code2 == FIXED_POINT_TYPE || code2 == REAL_TYPE || code2 == INTEGER_TYPE ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 770, __FUNCTION__), 0 : 0)); | |||
771 | ||||
772 | /* When one operand is a decimal float type, the other operand cannot be | |||
773 | a generic float type or a complex type. We also disallow vector types | |||
774 | here. */ | |||
775 | if ((DECIMAL_FLOAT_TYPE_P (t1)((((enum tree_code) (t1)->base.code) == REAL_TYPE) && (((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 775, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode (t1) : (t1)->type_common.mode)]) == MODE_DECIMAL_FLOAT)) || DECIMAL_FLOAT_TYPE_P (t2)((((enum tree_code) (t2)->base.code) == REAL_TYPE) && (((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 775, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode (t2) : (t2)->type_common.mode)]) == MODE_DECIMAL_FLOAT))) | |||
776 | && !(DECIMAL_FLOAT_TYPE_P (t1)((((enum tree_code) (t1)->base.code) == REAL_TYPE) && (((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 776, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode (t1) : (t1)->type_common.mode)]) == MODE_DECIMAL_FLOAT)) && DECIMAL_FLOAT_TYPE_P (t2)((((enum tree_code) (t2)->base.code) == REAL_TYPE) && (((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 776, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode (t2) : (t2)->type_common.mode)]) == MODE_DECIMAL_FLOAT)))) | |||
777 | { | |||
778 | if (code1 == VECTOR_TYPE || code2 == VECTOR_TYPE) | |||
779 | { | |||
780 | error ("cannot mix operands of decimal floating and vector types"); | |||
781 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
782 | } | |||
783 | if (code1 == COMPLEX_TYPE || code2 == COMPLEX_TYPE) | |||
784 | { | |||
785 | error ("cannot mix operands of decimal floating and complex types"); | |||
786 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
787 | } | |||
788 | if (code1 == REAL_TYPE && code2 == REAL_TYPE) | |||
789 | { | |||
790 | error ("cannot mix operands of decimal floating " | |||
791 | "and other floating types"); | |||
792 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
793 | } | |||
794 | } | |||
795 | ||||
796 | /* If one type is a vector type, return that type. (How the usual | |||
797 | arithmetic conversions apply to the vector types extension is not | |||
798 | precisely specified.) */ | |||
799 | if (code1 == VECTOR_TYPE) | |||
800 | return t1; | |||
801 | ||||
802 | if (code2 == VECTOR_TYPE) | |||
803 | return t2; | |||
804 | ||||
805 | /* If one type is complex, form the common type of the non-complex | |||
806 | components, then make that complex. Use T1 or T2 if it is the | |||
807 | required type. */ | |||
808 | if (code1 == COMPLEX_TYPE || code2 == COMPLEX_TYPE) | |||
809 | { | |||
810 | tree subtype1 = code1 == COMPLEX_TYPE ? TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 810, __FUNCTION__))->typed.type) : t1; | |||
811 | tree subtype2 = code2 == COMPLEX_TYPE ? TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 811, __FUNCTION__))->typed.type) : t2; | |||
812 | tree subtype = c_common_type (subtype1, subtype2); | |||
813 | ||||
814 | if (code1 == COMPLEX_TYPE && TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 814, __FUNCTION__))->typed.type) == subtype) | |||
815 | return t1; | |||
816 | else if (code2 == COMPLEX_TYPE && TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 816, __FUNCTION__))->typed.type) == subtype) | |||
817 | return t2; | |||
818 | else | |||
819 | return build_complex_type (subtype); | |||
820 | } | |||
821 | ||||
822 | /* If only one is real, use it as the result. */ | |||
823 | ||||
824 | if (code1 == REAL_TYPE && code2 != REAL_TYPE) | |||
825 | return t1; | |||
826 | ||||
827 | if (code2 == REAL_TYPE && code1 != REAL_TYPE) | |||
828 | return t2; | |||
829 | ||||
830 | /* If both are real and either are decimal floating point types, use | |||
831 | the decimal floating point type with the greater precision. */ | |||
832 | ||||
833 | if (code1 == REAL_TYPE && code2 == REAL_TYPE) | |||
834 | { | |||
835 | if (TYPE_MAIN_VARIANT (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 835, __FUNCTION__))->type_common.main_variant) == dfloat128_type_nodeglobal_trees[TI_DFLOAT128_TYPE] | |||
836 | || TYPE_MAIN_VARIANT (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 836, __FUNCTION__))->type_common.main_variant) == dfloat128_type_nodeglobal_trees[TI_DFLOAT128_TYPE]) | |||
837 | return dfloat128_type_nodeglobal_trees[TI_DFLOAT128_TYPE]; | |||
838 | else if (TYPE_MAIN_VARIANT (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 838, __FUNCTION__))->type_common.main_variant) == dfloat64_type_nodeglobal_trees[TI_DFLOAT64_TYPE] | |||
839 | || TYPE_MAIN_VARIANT (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 839, __FUNCTION__))->type_common.main_variant) == dfloat64_type_nodeglobal_trees[TI_DFLOAT64_TYPE]) | |||
840 | return dfloat64_type_nodeglobal_trees[TI_DFLOAT64_TYPE]; | |||
841 | else if (TYPE_MAIN_VARIANT (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 841, __FUNCTION__))->type_common.main_variant) == dfloat32_type_nodeglobal_trees[TI_DFLOAT32_TYPE] | |||
842 | || TYPE_MAIN_VARIANT (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 842, __FUNCTION__))->type_common.main_variant) == dfloat32_type_nodeglobal_trees[TI_DFLOAT32_TYPE]) | |||
843 | return dfloat32_type_nodeglobal_trees[TI_DFLOAT32_TYPE]; | |||
844 | } | |||
845 | ||||
846 | /* Deal with fixed-point types. */ | |||
847 | if (code1 == FIXED_POINT_TYPE || code2 == FIXED_POINT_TYPE) | |||
848 | { | |||
849 | unsigned int unsignedp = 0, satp = 0; | |||
850 | scalar_mode m1, m2; | |||
851 | unsigned int fbit1, ibit1, fbit2, ibit2, max_fbit, max_ibit; | |||
852 | ||||
853 | m1 = SCALAR_TYPE_MODE (t1)(as_a <scalar_mode> ((tree_class_check ((t1), (tcc_type ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 853, __FUNCTION__))->type_common.mode)); | |||
854 | m2 = SCALAR_TYPE_MODE (t2)(as_a <scalar_mode> ((tree_class_check ((t2), (tcc_type ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 854, __FUNCTION__))->type_common.mode)); | |||
855 | ||||
856 | /* If one input type is saturating, the result type is saturating. */ | |||
857 | if (TYPE_SATURATING (t1)((tree_not_check4 ((t1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 857, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE ), (ARRAY_TYPE)))->base.u.bits.saturating_flag) || TYPE_SATURATING (t2)((tree_not_check4 ((t2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 857, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE ), (ARRAY_TYPE)))->base.u.bits.saturating_flag)) | |||
858 | satp = 1; | |||
859 | ||||
860 | /* If both fixed-point types are unsigned, the result type is unsigned. | |||
861 | When mixing fixed-point and integer types, follow the sign of the | |||
862 | fixed-point type. | |||
863 | Otherwise, the result type is signed. */ | |||
864 | if ((TYPE_UNSIGNED (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 864, __FUNCTION__))->base.u.bits.unsigned_flag) && TYPE_UNSIGNED (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 864, __FUNCTION__))->base.u.bits.unsigned_flag) | |||
865 | && code1 == FIXED_POINT_TYPE && code2 == FIXED_POINT_TYPE) | |||
866 | || (code1 == FIXED_POINT_TYPE && code2 != FIXED_POINT_TYPE | |||
867 | && TYPE_UNSIGNED (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 867, __FUNCTION__))->base.u.bits.unsigned_flag)) | |||
868 | || (code1 != FIXED_POINT_TYPE && code2 == FIXED_POINT_TYPE | |||
869 | && TYPE_UNSIGNED (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 869, __FUNCTION__))->base.u.bits.unsigned_flag))) | |||
870 | unsignedp = 1; | |||
871 | ||||
872 | /* The result type is signed. */ | |||
873 | if (unsignedp == 0) | |||
874 | { | |||
875 | /* If the input type is unsigned, we need to convert to the | |||
876 | signed type. */ | |||
877 | if (code1 == FIXED_POINT_TYPE && TYPE_UNSIGNED (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 877, __FUNCTION__))->base.u.bits.unsigned_flag)) | |||
878 | { | |||
879 | enum mode_class mclass = (enum mode_class) 0; | |||
880 | if (GET_MODE_CLASS (m1)((enum mode_class) mode_class[m1]) == MODE_UFRACT) | |||
881 | mclass = MODE_FRACT; | |||
882 | else if (GET_MODE_CLASS (m1)((enum mode_class) mode_class[m1]) == MODE_UACCUM) | |||
883 | mclass = MODE_ACCUM; | |||
884 | else | |||
885 | gcc_unreachable ()(fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 885, __FUNCTION__)); | |||
886 | m1 = as_a <scalar_mode> | |||
887 | (mode_for_size (GET_MODE_PRECISION (m1), mclass, 0)); | |||
888 | } | |||
889 | if (code2 == FIXED_POINT_TYPE && TYPE_UNSIGNED (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 889, __FUNCTION__))->base.u.bits.unsigned_flag)) | |||
890 | { | |||
891 | enum mode_class mclass = (enum mode_class) 0; | |||
892 | if (GET_MODE_CLASS (m2)((enum mode_class) mode_class[m2]) == MODE_UFRACT) | |||
893 | mclass = MODE_FRACT; | |||
894 | else if (GET_MODE_CLASS (m2)((enum mode_class) mode_class[m2]) == MODE_UACCUM) | |||
895 | mclass = MODE_ACCUM; | |||
896 | else | |||
897 | gcc_unreachable ()(fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 897, __FUNCTION__)); | |||
898 | m2 = as_a <scalar_mode> | |||
899 | (mode_for_size (GET_MODE_PRECISION (m2), mclass, 0)); | |||
900 | } | |||
901 | } | |||
902 | ||||
903 | if (code1 == FIXED_POINT_TYPE) | |||
904 | { | |||
905 | fbit1 = GET_MODE_FBIT (m1)mode_fbit[m1]; | |||
906 | ibit1 = GET_MODE_IBIT (m1)mode_ibit[m1]; | |||
907 | } | |||
908 | else | |||
909 | { | |||
910 | fbit1 = 0; | |||
911 | /* Signed integers need to subtract one sign bit. */ | |||
912 | ibit1 = TYPE_PRECISION (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 912, __FUNCTION__))->type_common.precision) - (!TYPE_UNSIGNED (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 912, __FUNCTION__))->base.u.bits.unsigned_flag)); | |||
913 | } | |||
914 | ||||
915 | if (code2 == FIXED_POINT_TYPE) | |||
916 | { | |||
917 | fbit2 = GET_MODE_FBIT (m2)mode_fbit[m2]; | |||
918 | ibit2 = GET_MODE_IBIT (m2)mode_ibit[m2]; | |||
919 | } | |||
920 | else | |||
921 | { | |||
922 | fbit2 = 0; | |||
923 | /* Signed integers need to subtract one sign bit. */ | |||
924 | ibit2 = TYPE_PRECISION (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 924, __FUNCTION__))->type_common.precision) - (!TYPE_UNSIGNED (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 924, __FUNCTION__))->base.u.bits.unsigned_flag)); | |||
925 | } | |||
926 | ||||
927 | max_ibit = ibit1 >= ibit2 ? ibit1 : ibit2; | |||
928 | max_fbit = fbit1 >= fbit2 ? fbit1 : fbit2; | |||
929 | return c_common_fixed_point_type_for_size (max_ibit, max_fbit, unsignedp, | |||
930 | satp); | |||
931 | } | |||
932 | ||||
933 | /* Both real or both integers; use the one with greater precision. */ | |||
934 | ||||
935 | if (TYPE_PRECISION (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 935, __FUNCTION__))->type_common.precision) > TYPE_PRECISION (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 935, __FUNCTION__))->type_common.precision)) | |||
936 | return t1; | |||
937 | else if (TYPE_PRECISION (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 937, __FUNCTION__))->type_common.precision) > TYPE_PRECISION (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 937, __FUNCTION__))->type_common.precision)) | |||
938 | return t2; | |||
939 | ||||
940 | /* Same precision. Prefer long longs to longs to ints when the | |||
941 | same precision, following the C99 rules on integer type rank | |||
942 | (which are equivalent to the C90 rules for C90 types). */ | |||
943 | ||||
944 | if (TYPE_MAIN_VARIANT (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 944, __FUNCTION__))->type_common.main_variant) == long_long_unsigned_type_nodeinteger_types[itk_unsigned_long_long] | |||
945 | || TYPE_MAIN_VARIANT (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 945, __FUNCTION__))->type_common.main_variant) == long_long_unsigned_type_nodeinteger_types[itk_unsigned_long_long]) | |||
946 | return long_long_unsigned_type_nodeinteger_types[itk_unsigned_long_long]; | |||
947 | ||||
948 | if (TYPE_MAIN_VARIANT (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 948, __FUNCTION__))->type_common.main_variant) == long_long_integer_type_nodeinteger_types[itk_long_long] | |||
949 | || TYPE_MAIN_VARIANT (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 949, __FUNCTION__))->type_common.main_variant) == long_long_integer_type_nodeinteger_types[itk_long_long]) | |||
950 | { | |||
951 | if (TYPE_UNSIGNED (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 951, __FUNCTION__))->base.u.bits.unsigned_flag) || TYPE_UNSIGNED (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 951, __FUNCTION__))->base.u.bits.unsigned_flag)) | |||
952 | return long_long_unsigned_type_nodeinteger_types[itk_unsigned_long_long]; | |||
953 | else | |||
954 | return long_long_integer_type_nodeinteger_types[itk_long_long]; | |||
955 | } | |||
956 | ||||
957 | if (TYPE_MAIN_VARIANT (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 957, __FUNCTION__))->type_common.main_variant) == long_unsigned_type_nodeinteger_types[itk_unsigned_long] | |||
958 | || TYPE_MAIN_VARIANT (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 958, __FUNCTION__))->type_common.main_variant) == long_unsigned_type_nodeinteger_types[itk_unsigned_long]) | |||
959 | return long_unsigned_type_nodeinteger_types[itk_unsigned_long]; | |||
960 | ||||
961 | if (TYPE_MAIN_VARIANT (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 961, __FUNCTION__))->type_common.main_variant) == long_integer_type_nodeinteger_types[itk_long] | |||
962 | || TYPE_MAIN_VARIANT (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 962, __FUNCTION__))->type_common.main_variant) == long_integer_type_nodeinteger_types[itk_long]) | |||
963 | { | |||
964 | /* But preserve unsignedness from the other type, | |||
965 | since long cannot hold all the values of an unsigned int. */ | |||
966 | if (TYPE_UNSIGNED (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 966, __FUNCTION__))->base.u.bits.unsigned_flag) || TYPE_UNSIGNED (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 966, __FUNCTION__))->base.u.bits.unsigned_flag)) | |||
967 | return long_unsigned_type_nodeinteger_types[itk_unsigned_long]; | |||
968 | else | |||
969 | return long_integer_type_nodeinteger_types[itk_long]; | |||
970 | } | |||
971 | ||||
972 | /* For floating types of the same TYPE_PRECISION (which we here | |||
973 | assume means either the same set of values, or sets of values | |||
974 | neither a subset of the other, with behavior being undefined in | |||
975 | the latter case), follow the rules from TS 18661-3: prefer | |||
976 | interchange types _FloatN, then standard types long double, | |||
977 | double, float, then extended types _FloatNx. For extended types, | |||
978 | check them starting with _Float128x as that seems most consistent | |||
979 | in spirit with preferring long double to double; for interchange | |||
980 | types, also check in that order for consistency although it's not | |||
981 | possible for more than one of them to have the same | |||
982 | precision. */ | |||
983 | tree mv1 = TYPE_MAIN_VARIANT (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 983, __FUNCTION__))->type_common.main_variant); | |||
984 | tree mv2 = TYPE_MAIN_VARIANT (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 984, __FUNCTION__))->type_common.main_variant); | |||
985 | ||||
986 | for (int i = NUM_FLOATN_TYPES(TI_FLOATN_TYPE_LAST - TI_FLOATN_TYPE_FIRST + 1) - 1; i >= 0; i--) | |||
987 | if (mv1 == FLOATN_TYPE_NODE (i)global_trees[TI_FLOATN_TYPE_FIRST + (i)] || mv2 == FLOATN_TYPE_NODE (i)global_trees[TI_FLOATN_TYPE_FIRST + (i)]) | |||
988 | return FLOATN_TYPE_NODE (i)global_trees[TI_FLOATN_TYPE_FIRST + (i)]; | |||
989 | ||||
990 | /* Likewise, prefer long double to double even if same size. */ | |||
991 | if (mv1 == long_double_type_nodeglobal_trees[TI_LONG_DOUBLE_TYPE] || mv2 == long_double_type_nodeglobal_trees[TI_LONG_DOUBLE_TYPE]) | |||
992 | return long_double_type_nodeglobal_trees[TI_LONG_DOUBLE_TYPE]; | |||
993 | ||||
994 | /* Likewise, prefer double to float even if same size. | |||
995 | We got a couple of embedded targets with 32 bit doubles, and the | |||
996 | pdp11 might have 64 bit floats. */ | |||
997 | if (mv1 == double_type_nodeglobal_trees[TI_DOUBLE_TYPE] || mv2 == double_type_nodeglobal_trees[TI_DOUBLE_TYPE]) | |||
998 | return double_type_nodeglobal_trees[TI_DOUBLE_TYPE]; | |||
999 | ||||
1000 | if (mv1 == float_type_nodeglobal_trees[TI_FLOAT_TYPE] || mv2 == float_type_nodeglobal_trees[TI_FLOAT_TYPE]) | |||
1001 | return float_type_nodeglobal_trees[TI_FLOAT_TYPE]; | |||
1002 | ||||
1003 | for (int i = NUM_FLOATNX_TYPES(TI_FLOATNX_TYPE_LAST - TI_FLOATNX_TYPE_FIRST + 1) - 1; i >= 0; i--) | |||
1004 | if (mv1 == FLOATNX_TYPE_NODE (i)global_trees[TI_FLOATNX_TYPE_FIRST + (i)] || mv2 == FLOATNX_TYPE_NODE (i)global_trees[TI_FLOATNX_TYPE_FIRST + (i)]) | |||
1005 | return FLOATNX_TYPE_NODE (i)global_trees[TI_FLOATNX_TYPE_FIRST + (i)]; | |||
1006 | ||||
1007 | /* Otherwise prefer the unsigned one. */ | |||
1008 | ||||
1009 | if (TYPE_UNSIGNED (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1009, __FUNCTION__))->base.u.bits.unsigned_flag)) | |||
1010 | return t1; | |||
1011 | else | |||
1012 | return t2; | |||
1013 | } | |||
1014 | ||||
1015 | /* Wrapper around c_common_type that is used by c-common.cc and other | |||
1016 | front end optimizations that remove promotions. ENUMERAL_TYPEs | |||
1017 | are allowed here and are converted to their compatible integer types. | |||
1018 | BOOLEAN_TYPEs are allowed here and return either boolean_type_node or | |||
1019 | preferably a non-Boolean type as the common type. */ | |||
1020 | tree | |||
1021 | common_type (tree t1, tree t2) | |||
1022 | { | |||
1023 | if (TREE_CODE (t1)((enum tree_code) (t1)->base.code) == ENUMERAL_TYPE) | |||
1024 | t1 = ENUM_UNDERLYING_TYPE (t1)((contains_struct_check (((tree_check ((t1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1024, __FUNCTION__, (ENUMERAL_TYPE)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1024, __FUNCTION__))->typed.type); | |||
1025 | if (TREE_CODE (t2)((enum tree_code) (t2)->base.code) == ENUMERAL_TYPE) | |||
1026 | t2 = ENUM_UNDERLYING_TYPE (t2)((contains_struct_check (((tree_check ((t2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1026, __FUNCTION__, (ENUMERAL_TYPE)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1026, __FUNCTION__))->typed.type); | |||
1027 | ||||
1028 | /* If both types are BOOLEAN_TYPE, then return boolean_type_node. */ | |||
1029 | if (TREE_CODE (t1)((enum tree_code) (t1)->base.code) == BOOLEAN_TYPE | |||
1030 | && TREE_CODE (t2)((enum tree_code) (t2)->base.code) == BOOLEAN_TYPE) | |||
1031 | return boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE]; | |||
1032 | ||||
1033 | /* If either type is BOOLEAN_TYPE, then return the other. */ | |||
1034 | if (TREE_CODE (t1)((enum tree_code) (t1)->base.code) == BOOLEAN_TYPE) | |||
1035 | return t2; | |||
1036 | if (TREE_CODE (t2)((enum tree_code) (t2)->base.code) == BOOLEAN_TYPE) | |||
1037 | return t1; | |||
1038 | ||||
1039 | return c_common_type (t1, t2); | |||
1040 | } | |||
1041 | ||||
1042 | /* Return 1 if TYPE1 and TYPE2 are compatible types for assignment | |||
1043 | or various other operations. Return 2 if they are compatible | |||
1044 | but a warning may be needed if you use them together. */ | |||
1045 | ||||
1046 | int | |||
1047 | comptypes (tree type1, tree type2) | |||
1048 | { | |||
1049 | const struct tagged_tu_seen_cache * tagged_tu_seen_base1 = tagged_tu_seen_base; | |||
1050 | int val; | |||
1051 | ||||
1052 | val = comptypes_internal (type1, type2, NULL__null, NULL__null); | |||
1053 | free_all_tagged_tu_seen_up_to (tagged_tu_seen_base1); | |||
1054 | ||||
1055 | return val; | |||
1056 | } | |||
1057 | ||||
1058 | /* Like comptypes, but if it returns non-zero because enum and int are | |||
1059 | compatible, it sets *ENUM_AND_INT_P to true. */ | |||
1060 | ||||
1061 | int | |||
1062 | comptypes_check_enum_int (tree type1, tree type2, bool *enum_and_int_p) | |||
1063 | { | |||
1064 | const struct tagged_tu_seen_cache * tagged_tu_seen_base1 = tagged_tu_seen_base; | |||
1065 | int val; | |||
1066 | ||||
1067 | val = comptypes_internal (type1, type2, enum_and_int_p, NULL__null); | |||
1068 | free_all_tagged_tu_seen_up_to (tagged_tu_seen_base1); | |||
1069 | ||||
1070 | return val; | |||
1071 | } | |||
1072 | ||||
1073 | /* Like comptypes, but if it returns nonzero for different types, it | |||
1074 | sets *DIFFERENT_TYPES_P to true. */ | |||
1075 | ||||
1076 | int | |||
1077 | comptypes_check_different_types (tree type1, tree type2, | |||
1078 | bool *different_types_p) | |||
1079 | { | |||
1080 | const struct tagged_tu_seen_cache * tagged_tu_seen_base1 = tagged_tu_seen_base; | |||
1081 | int val; | |||
1082 | ||||
1083 | val = comptypes_internal (type1, type2, NULL__null, different_types_p); | |||
1084 | free_all_tagged_tu_seen_up_to (tagged_tu_seen_base1); | |||
1085 | ||||
1086 | return val; | |||
1087 | } | |||
1088 | ||||
1089 | /* Return 1 if TYPE1 and TYPE2 are compatible types for assignment | |||
1090 | or various other operations. Return 2 if they are compatible | |||
1091 | but a warning may be needed if you use them together. If | |||
1092 | ENUM_AND_INT_P is not NULL, and one type is an enum and the other a | |||
1093 | compatible integer type, then this sets *ENUM_AND_INT_P to true; | |||
1094 | *ENUM_AND_INT_P is never set to false. If DIFFERENT_TYPES_P is not | |||
1095 | NULL, and the types are compatible but different enough not to be | |||
1096 | permitted in C11 typedef redeclarations, then this sets | |||
1097 | *DIFFERENT_TYPES_P to true; *DIFFERENT_TYPES_P is never set to | |||
1098 | false, but may or may not be set if the types are incompatible. | |||
1099 | This differs from comptypes, in that we don't free the seen | |||
1100 | types. */ | |||
1101 | ||||
1102 | static int | |||
1103 | comptypes_internal (const_tree type1, const_tree type2, bool *enum_and_int_p, | |||
1104 | bool *different_types_p) | |||
1105 | { | |||
1106 | const_tree t1 = type1; | |||
1107 | const_tree t2 = type2; | |||
1108 | int attrval, val; | |||
1109 | ||||
1110 | /* Suppress errors caused by previously reported errors. */ | |||
1111 | ||||
1112 | if (t1 == t2 || !t1 || !t2 | |||
1113 | || TREE_CODE (t1)((enum tree_code) (t1)->base.code) == ERROR_MARK || TREE_CODE (t2)((enum tree_code) (t2)->base.code) == ERROR_MARK) | |||
1114 | return 1; | |||
1115 | ||||
1116 | /* Enumerated types are compatible with integer types, but this is | |||
1117 | not transitive: two enumerated types in the same translation unit | |||
1118 | are compatible with each other only if they are the same type. */ | |||
1119 | ||||
1120 | if (TREE_CODE (t1)((enum tree_code) (t1)->base.code) == ENUMERAL_TYPE | |||
1121 | && COMPLETE_TYPE_P (t1)(((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1121, __FUNCTION__))->type_common.size) != (tree) __null ) | |||
1122 | && TREE_CODE (t2)((enum tree_code) (t2)->base.code) != ENUMERAL_TYPE) | |||
1123 | { | |||
1124 | t1 = ENUM_UNDERLYING_TYPE (t1)((contains_struct_check (((tree_check ((t1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1124, __FUNCTION__, (ENUMERAL_TYPE)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1124, __FUNCTION__))->typed.type); | |||
1125 | if (TREE_CODE (t2)((enum tree_code) (t2)->base.code) != VOID_TYPE) | |||
1126 | { | |||
1127 | if (enum_and_int_p != NULL__null) | |||
1128 | *enum_and_int_p = true; | |||
1129 | if (different_types_p != NULL__null) | |||
1130 | *different_types_p = true; | |||
1131 | } | |||
1132 | } | |||
1133 | else if (TREE_CODE (t2)((enum tree_code) (t2)->base.code) == ENUMERAL_TYPE | |||
1134 | && COMPLETE_TYPE_P (t2)(((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1134, __FUNCTION__))->type_common.size) != (tree) __null ) | |||
1135 | && TREE_CODE (t1)((enum tree_code) (t1)->base.code) != ENUMERAL_TYPE) | |||
1136 | { | |||
1137 | t2 = ENUM_UNDERLYING_TYPE (t2)((contains_struct_check (((tree_check ((t2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1137, __FUNCTION__, (ENUMERAL_TYPE)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1137, __FUNCTION__))->typed.type); | |||
1138 | if (TREE_CODE (t1)((enum tree_code) (t1)->base.code) != VOID_TYPE) | |||
1139 | { | |||
1140 | if (enum_and_int_p != NULL__null) | |||
1141 | *enum_and_int_p = true; | |||
1142 | if (different_types_p != NULL__null) | |||
1143 | *different_types_p = true; | |||
1144 | } | |||
1145 | } | |||
1146 | ||||
1147 | if (t1 == t2) | |||
1148 | return 1; | |||
1149 | ||||
1150 | /* Different classes of types can't be compatible. */ | |||
1151 | ||||
1152 | if (TREE_CODE (t1)((enum tree_code) (t1)->base.code) != TREE_CODE (t2)((enum tree_code) (t2)->base.code)) | |||
1153 | return 0; | |||
1154 | ||||
1155 | /* Qualifiers must match. C99 6.7.3p9 */ | |||
1156 | ||||
1157 | if (TYPE_QUALS (t1)((int) ((((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1157, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1157, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1157, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1157, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ) | (((((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1157, __FUNCTION__))->base.u.bits.address_space) & 0xFF ) << 8)))) != TYPE_QUALS (t2)((int) ((((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1157, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1157, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1157, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1157, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ) | (((((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1157, __FUNCTION__))->base.u.bits.address_space) & 0xFF ) << 8))))) | |||
1158 | return 0; | |||
1159 | ||||
1160 | /* Allow for two different type nodes which have essentially the same | |||
1161 | definition. Note that we already checked for equality of the type | |||
1162 | qualifiers (just above). */ | |||
1163 | ||||
1164 | if (TREE_CODE (t1)((enum tree_code) (t1)->base.code) != ARRAY_TYPE | |||
1165 | && TYPE_MAIN_VARIANT (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1165, __FUNCTION__))->type_common.main_variant) == TYPE_MAIN_VARIANT (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1165, __FUNCTION__))->type_common.main_variant)) | |||
1166 | return 1; | |||
1167 | ||||
1168 | /* 1 if no need for warning yet, 2 if warning cause has been seen. */ | |||
1169 | if (!(attrval = comp_type_attributes (t1, t2))) | |||
1170 | return 0; | |||
1171 | ||||
1172 | /* 1 if no need for warning yet, 2 if warning cause has been seen. */ | |||
1173 | val = 0; | |||
1174 | ||||
1175 | switch (TREE_CODE (t1)((enum tree_code) (t1)->base.code)) | |||
1176 | { | |||
1177 | case INTEGER_TYPE: | |||
1178 | case FIXED_POINT_TYPE: | |||
1179 | case REAL_TYPE: | |||
1180 | /* With these nodes, we can't determine type equivalence by | |||
1181 | looking at what is stored in the nodes themselves, because | |||
1182 | two nodes might have different TYPE_MAIN_VARIANTs but still | |||
1183 | represent the same type. For example, wchar_t and int could | |||
1184 | have the same properties (TYPE_PRECISION, TYPE_MIN_VALUE, | |||
1185 | TYPE_MAX_VALUE, etc.), but have different TYPE_MAIN_VARIANTs | |||
1186 | and are distinct types. On the other hand, int and the | |||
1187 | following typedef | |||
1188 | ||||
1189 | typedef int INT __attribute((may_alias)); | |||
1190 | ||||
1191 | have identical properties, different TYPE_MAIN_VARIANTs, but | |||
1192 | represent the same type. The canonical type system keeps | |||
1193 | track of equivalence in this case, so we fall back on it. */ | |||
1194 | return TYPE_CANONICAL (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1194, __FUNCTION__))->type_common.canonical) == TYPE_CANONICAL (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1194, __FUNCTION__))->type_common.canonical); | |||
1195 | ||||
1196 | case POINTER_TYPE: | |||
1197 | /* Do not remove mode information. */ | |||
1198 | if (TYPE_MODE (t1)((((enum tree_code) ((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1198, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode (t1) : (t1)->type_common.mode) != TYPE_MODE (t2)((((enum tree_code) ((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1198, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode (t2) : (t2)->type_common.mode)) | |||
1199 | break; | |||
1200 | val = (TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1200, __FUNCTION__))->typed.type) == TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1200, __FUNCTION__))->typed.type) | |||
1201 | ? 1 : comptypes_internal (TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1201, __FUNCTION__))->typed.type), TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1201, __FUNCTION__))->typed.type), | |||
1202 | enum_and_int_p, different_types_p)); | |||
1203 | break; | |||
1204 | ||||
1205 | case FUNCTION_TYPE: | |||
1206 | val = function_types_compatible_p (t1, t2, enum_and_int_p, | |||
1207 | different_types_p); | |||
1208 | break; | |||
1209 | ||||
1210 | case ARRAY_TYPE: | |||
1211 | { | |||
1212 | tree d1 = TYPE_DOMAIN (t1)((tree_check ((t1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1212, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ); | |||
1213 | tree d2 = TYPE_DOMAIN (t2)((tree_check ((t2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1213, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ); | |||
1214 | bool d1_variable, d2_variable; | |||
1215 | bool d1_zero, d2_zero; | |||
1216 | val = 1; | |||
1217 | ||||
1218 | /* Target types must match incl. qualifiers. */ | |||
1219 | if (TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1219, __FUNCTION__))->typed.type) != TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1219, __FUNCTION__))->typed.type) | |||
1220 | && (val = comptypes_internal (TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1220, __FUNCTION__))->typed.type), TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1220, __FUNCTION__))->typed.type), | |||
1221 | enum_and_int_p, | |||
1222 | different_types_p)) == 0) | |||
1223 | return 0; | |||
1224 | ||||
1225 | if (different_types_p != NULL__null | |||
1226 | && (d1 == NULL_TREE(tree) __null) != (d2 == NULL_TREE(tree) __null)) | |||
1227 | *different_types_p = true; | |||
1228 | /* Sizes must match unless one is missing or variable. */ | |||
1229 | if (d1 == NULL_TREE(tree) __null || d2 == NULL_TREE(tree) __null || d1 == d2) | |||
1230 | break; | |||
1231 | ||||
1232 | d1_zero = !TYPE_MAX_VALUE (d1)((tree_check5 ((d1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1232, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval ); | |||
1233 | d2_zero = !TYPE_MAX_VALUE (d2)((tree_check5 ((d2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1233, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval ); | |||
1234 | ||||
1235 | d1_variable = (!d1_zero | |||
1236 | && (TREE_CODE (TYPE_MIN_VALUE (d1))((enum tree_code) (((tree_check5 ((d1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1236, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.minval ))->base.code) != INTEGER_CST | |||
1237 | || TREE_CODE (TYPE_MAX_VALUE (d1))((enum tree_code) (((tree_check5 ((d1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1237, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval ))->base.code) != INTEGER_CST)); | |||
1238 | d2_variable = (!d2_zero | |||
1239 | && (TREE_CODE (TYPE_MIN_VALUE (d2))((enum tree_code) (((tree_check5 ((d2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1239, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.minval ))->base.code) != INTEGER_CST | |||
1240 | || TREE_CODE (TYPE_MAX_VALUE (d2))((enum tree_code) (((tree_check5 ((d2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1240, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval ))->base.code) != INTEGER_CST)); | |||
1241 | d1_variable = d1_variable || (d1_zero && C_TYPE_VARIABLE_SIZE (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1241, __FUNCTION__))->type_common.lang_flag_1)); | |||
1242 | d2_variable = d2_variable || (d2_zero && C_TYPE_VARIABLE_SIZE (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1242, __FUNCTION__))->type_common.lang_flag_1)); | |||
1243 | ||||
1244 | if (different_types_p != NULL__null | |||
1245 | && d1_variable != d2_variable) | |||
1246 | *different_types_p = true; | |||
1247 | if (d1_variable || d2_variable) | |||
1248 | break; | |||
1249 | if (d1_zero && d2_zero) | |||
1250 | break; | |||
1251 | if (d1_zero || d2_zero | |||
1252 | || !tree_int_cst_equal (TYPE_MIN_VALUE (d1)((tree_check5 ((d1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1252, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.minval ), TYPE_MIN_VALUE (d2)((tree_check5 ((d2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1252, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.minval )) | |||
1253 | || !tree_int_cst_equal (TYPE_MAX_VALUE (d1)((tree_check5 ((d1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1253, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval ), TYPE_MAX_VALUE (d2)((tree_check5 ((d2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1253, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval ))) | |||
1254 | val = 0; | |||
1255 | ||||
1256 | break; | |||
1257 | } | |||
1258 | ||||
1259 | case ENUMERAL_TYPE: | |||
1260 | case RECORD_TYPE: | |||
1261 | case UNION_TYPE: | |||
1262 | if (val != 1 && !same_translation_unit_p (t1, t2)) | |||
1263 | { | |||
1264 | tree a1 = TYPE_ATTRIBUTES (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1264, __FUNCTION__))->type_common.attributes); | |||
1265 | tree a2 = TYPE_ATTRIBUTES (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1265, __FUNCTION__))->type_common.attributes); | |||
1266 | ||||
1267 | if (! attribute_list_contained (a1, a2) | |||
1268 | && ! attribute_list_contained (a2, a1)) | |||
1269 | break; | |||
1270 | ||||
1271 | if (attrval != 2) | |||
1272 | return tagged_types_tu_compatible_p (t1, t2, enum_and_int_p, | |||
1273 | different_types_p); | |||
1274 | val = tagged_types_tu_compatible_p (t1, t2, enum_and_int_p, | |||
1275 | different_types_p); | |||
1276 | } | |||
1277 | break; | |||
1278 | ||||
1279 | case VECTOR_TYPE: | |||
1280 | val = (known_eq (TYPE_VECTOR_SUBPARTS (t1), TYPE_VECTOR_SUBPARTS (t2))(!maybe_ne (TYPE_VECTOR_SUBPARTS (t1), TYPE_VECTOR_SUBPARTS ( t2))) | |||
1281 | && comptypes_internal (TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1281, __FUNCTION__))->typed.type), TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1281, __FUNCTION__))->typed.type), | |||
1282 | enum_and_int_p, different_types_p)); | |||
1283 | break; | |||
1284 | ||||
1285 | default: | |||
1286 | break; | |||
1287 | } | |||
1288 | return attrval == 2 && val == 1 ? 2 : val; | |||
1289 | } | |||
1290 | ||||
1291 | /* Return 1 if TTL and TTR are pointers to types that are equivalent, ignoring | |||
1292 | their qualifiers, except for named address spaces. If the pointers point to | |||
1293 | different named addresses, then we must determine if one address space is a | |||
1294 | subset of the other. */ | |||
1295 | ||||
1296 | static int | |||
1297 | comp_target_types (location_t location, tree ttl, tree ttr) | |||
1298 | { | |||
1299 | int val; | |||
1300 | int val_ped; | |||
1301 | tree mvl = TREE_TYPE (ttl)((contains_struct_check ((ttl), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1301, __FUNCTION__))->typed.type); | |||
1302 | tree mvr = TREE_TYPE (ttr)((contains_struct_check ((ttr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1302, __FUNCTION__))->typed.type); | |||
1303 | addr_space_t asl = TYPE_ADDR_SPACE (mvl)((tree_class_check ((mvl), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1303, __FUNCTION__))->base.u.bits.address_space); | |||
1304 | addr_space_t asr = TYPE_ADDR_SPACE (mvr)((tree_class_check ((mvr), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1304, __FUNCTION__))->base.u.bits.address_space); | |||
1305 | addr_space_t as_common; | |||
1306 | bool enum_and_int_p; | |||
1307 | ||||
1308 | /* Fail if pointers point to incompatible address spaces. */ | |||
1309 | if (!addr_space_superset (asl, asr, &as_common)) | |||
1310 | return 0; | |||
1311 | ||||
1312 | /* For pedantic record result of comptypes on arrays before losing | |||
1313 | qualifiers on the element type below. */ | |||
1314 | val_ped = 1; | |||
1315 | ||||
1316 | if (TREE_CODE (mvl)((enum tree_code) (mvl)->base.code) == ARRAY_TYPE | |||
1317 | && TREE_CODE (mvr)((enum tree_code) (mvr)->base.code) == ARRAY_TYPE) | |||
1318 | val_ped = comptypes (mvl, mvr); | |||
1319 | ||||
1320 | /* Qualifiers on element types of array types that are | |||
1321 | pointer targets are lost by taking their TYPE_MAIN_VARIANT. */ | |||
1322 | ||||
1323 | mvl = (TYPE_ATOMIC (strip_array_types (mvl))((tree_class_check ((strip_array_types (mvl)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1323, __FUNCTION__))->base.u.bits.atomic_flag) | |||
1324 | ? c_build_qualified_type (TYPE_MAIN_VARIANT (mvl)((tree_class_check ((mvl), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1324, __FUNCTION__))->type_common.main_variant), TYPE_QUAL_ATOMIC) | |||
1325 | : TYPE_MAIN_VARIANT (mvl)((tree_class_check ((mvl), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1325, __FUNCTION__))->type_common.main_variant)); | |||
1326 | ||||
1327 | mvr = (TYPE_ATOMIC (strip_array_types (mvr))((tree_class_check ((strip_array_types (mvr)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1327, __FUNCTION__))->base.u.bits.atomic_flag) | |||
1328 | ? c_build_qualified_type (TYPE_MAIN_VARIANT (mvr)((tree_class_check ((mvr), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1328, __FUNCTION__))->type_common.main_variant), TYPE_QUAL_ATOMIC) | |||
1329 | : TYPE_MAIN_VARIANT (mvr)((tree_class_check ((mvr), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1329, __FUNCTION__))->type_common.main_variant)); | |||
1330 | ||||
1331 | enum_and_int_p = false; | |||
1332 | val = comptypes_check_enum_int (mvl, mvr, &enum_and_int_p); | |||
1333 | ||||
1334 | if (val == 1 && val_ped != 1) | |||
1335 | pedwarn_c11 (location, OPT_Wpedantic, "invalid use of pointers to arrays with different qualifiers " | |||
1336 | "in ISO C before C2X"); | |||
1337 | ||||
1338 | if (val == 2) | |||
1339 | pedwarn (location, OPT_Wpedantic, "types are not quite compatible"); | |||
1340 | ||||
1341 | if (val == 1 && enum_and_int_p && warn_cxx_compatglobal_options.x_warn_cxx_compat) | |||
1342 | warning_at (location, OPT_Wc___compat, | |||
1343 | "pointer target types incompatible in C++"); | |||
1344 | ||||
1345 | return val; | |||
1346 | } | |||
1347 | ||||
1348 | /* Subroutines of `comptypes'. */ | |||
1349 | ||||
1350 | /* Determine whether two trees derive from the same translation unit. | |||
1351 | If the CONTEXT chain ends in a null, that tree's context is still | |||
1352 | being parsed, so if two trees have context chains ending in null, | |||
1353 | they're in the same translation unit. */ | |||
1354 | ||||
1355 | bool | |||
1356 | same_translation_unit_p (const_tree t1, const_tree t2) | |||
1357 | { | |||
1358 | while (t1 && TREE_CODE (t1)((enum tree_code) (t1)->base.code) != TRANSLATION_UNIT_DECL) | |||
1359 | switch (TREE_CODE_CLASS (TREE_CODE (t1))tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (t1)->base.code))]) | |||
1360 | { | |||
1361 | case tcc_declaration: | |||
1362 | t1 = DECL_CONTEXT (t1)((contains_struct_check ((t1), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1362, __FUNCTION__))->decl_minimal.context); break; | |||
1363 | case tcc_type: | |||
1364 | t1 = TYPE_CONTEXT (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1364, __FUNCTION__))->type_common.context); break; | |||
1365 | case tcc_exceptional: | |||
1366 | t1 = BLOCK_SUPERCONTEXT (t1)((tree_check ((t1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1366, __FUNCTION__, (BLOCK)))->block.supercontext); break; /* assume block */ | |||
1367 | default: gcc_unreachable ()(fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1367, __FUNCTION__)); | |||
1368 | } | |||
1369 | ||||
1370 | while (t2 && TREE_CODE (t2)((enum tree_code) (t2)->base.code) != TRANSLATION_UNIT_DECL) | |||
1371 | switch (TREE_CODE_CLASS (TREE_CODE (t2))tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (t2)->base.code))]) | |||
1372 | { | |||
1373 | case tcc_declaration: | |||
1374 | t2 = DECL_CONTEXT (t2)((contains_struct_check ((t2), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1374, __FUNCTION__))->decl_minimal.context); break; | |||
1375 | case tcc_type: | |||
1376 | t2 = TYPE_CONTEXT (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1376, __FUNCTION__))->type_common.context); break; | |||
1377 | case tcc_exceptional: | |||
1378 | t2 = BLOCK_SUPERCONTEXT (t2)((tree_check ((t2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1378, __FUNCTION__, (BLOCK)))->block.supercontext); break; /* assume block */ | |||
1379 | default: gcc_unreachable ()(fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1379, __FUNCTION__)); | |||
1380 | } | |||
1381 | ||||
1382 | return t1 == t2; | |||
1383 | } | |||
1384 | ||||
1385 | /* Allocate the seen two types, assuming that they are compatible. */ | |||
1386 | ||||
1387 | static struct tagged_tu_seen_cache * | |||
1388 | alloc_tagged_tu_seen_cache (const_tree t1, const_tree t2) | |||
1389 | { | |||
1390 | struct tagged_tu_seen_cache *tu = XNEW (struct tagged_tu_seen_cache)((struct tagged_tu_seen_cache *) xmalloc (sizeof (struct tagged_tu_seen_cache ))); | |||
1391 | tu->next = tagged_tu_seen_base; | |||
1392 | tu->t1 = t1; | |||
1393 | tu->t2 = t2; | |||
1394 | ||||
1395 | tagged_tu_seen_base = tu; | |||
1396 | ||||
1397 | /* The C standard says that two structures in different translation | |||
1398 | units are compatible with each other only if the types of their | |||
1399 | fields are compatible (among other things). We assume that they | |||
1400 | are compatible until proven otherwise when building the cache. | |||
1401 | An example where this can occur is: | |||
1402 | struct a | |||
1403 | { | |||
1404 | struct a *next; | |||
1405 | }; | |||
1406 | If we are comparing this against a similar struct in another TU, | |||
1407 | and did not assume they were compatible, we end up with an infinite | |||
1408 | loop. */ | |||
1409 | tu->val = 1; | |||
1410 | return tu; | |||
1411 | } | |||
1412 | ||||
1413 | /* Free the seen types until we get to TU_TIL. */ | |||
1414 | ||||
1415 | static void | |||
1416 | free_all_tagged_tu_seen_up_to (const struct tagged_tu_seen_cache *tu_til) | |||
1417 | { | |||
1418 | const struct tagged_tu_seen_cache *tu = tagged_tu_seen_base; | |||
1419 | while (tu != tu_til) | |||
1420 | { | |||
1421 | const struct tagged_tu_seen_cache *const tu1 | |||
1422 | = (const struct tagged_tu_seen_cache *) tu; | |||
1423 | tu = tu1->next; | |||
1424 | XDELETE (CONST_CAST (struct tagged_tu_seen_cache *, tu1))free ((void*) ((const_cast<struct tagged_tu_seen_cache *> ((tu1))))); | |||
1425 | } | |||
1426 | tagged_tu_seen_base = tu_til; | |||
1427 | } | |||
1428 | ||||
1429 | /* Return 1 if two 'struct', 'union', or 'enum' types T1 and T2 are | |||
1430 | compatible. If the two types are not the same (which has been | |||
1431 | checked earlier), this can only happen when multiple translation | |||
1432 | units are being compiled. See C99 6.2.7 paragraph 1 for the exact | |||
1433 | rules. ENUM_AND_INT_P and DIFFERENT_TYPES_P are as in | |||
1434 | comptypes_internal. */ | |||
1435 | ||||
1436 | static int | |||
1437 | tagged_types_tu_compatible_p (const_tree t1, const_tree t2, | |||
1438 | bool *enum_and_int_p, bool *different_types_p) | |||
1439 | { | |||
1440 | tree s1, s2; | |||
1441 | bool needs_warning = false; | |||
1442 | ||||
1443 | /* We have to verify that the tags of the types are the same. This | |||
1444 | is harder than it looks because this may be a typedef, so we have | |||
1445 | to go look at the original type. It may even be a typedef of a | |||
1446 | typedef... | |||
1447 | In the case of compiler-created builtin structs the TYPE_DECL | |||
1448 | may be a dummy, with no DECL_ORIGINAL_TYPE. Don't fault. */ | |||
1449 | while (TYPE_NAME (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1449, __FUNCTION__))->type_common.name) | |||
1450 | && TREE_CODE (TYPE_NAME (t1))((enum tree_code) (((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1450, __FUNCTION__))->type_common.name))->base.code) == TYPE_DECL | |||
1451 | && DECL_ORIGINAL_TYPE (TYPE_NAME (t1))((tree_check ((((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1451, __FUNCTION__))->type_common.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1451, __FUNCTION__, (TYPE_DECL)))->decl_non_common.result )) | |||
1452 | t1 = DECL_ORIGINAL_TYPE (TYPE_NAME (t1))((tree_check ((((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1452, __FUNCTION__))->type_common.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1452, __FUNCTION__, (TYPE_DECL)))->decl_non_common.result ); | |||
1453 | ||||
1454 | while (TYPE_NAME (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1454, __FUNCTION__))->type_common.name) | |||
1455 | && TREE_CODE (TYPE_NAME (t2))((enum tree_code) (((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1455, __FUNCTION__))->type_common.name))->base.code) == TYPE_DECL | |||
1456 | && DECL_ORIGINAL_TYPE (TYPE_NAME (t2))((tree_check ((((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1456, __FUNCTION__))->type_common.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1456, __FUNCTION__, (TYPE_DECL)))->decl_non_common.result )) | |||
1457 | t2 = DECL_ORIGINAL_TYPE (TYPE_NAME (t2))((tree_check ((((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1457, __FUNCTION__))->type_common.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1457, __FUNCTION__, (TYPE_DECL)))->decl_non_common.result ); | |||
1458 | ||||
1459 | /* C90 didn't have the requirement that the two tags be the same. */ | |||
1460 | if (flag_isoc99 && TYPE_NAME (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1460, __FUNCTION__))->type_common.name) != TYPE_NAME (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1460, __FUNCTION__))->type_common.name)) | |||
1461 | return 0; | |||
1462 | ||||
1463 | /* C90 didn't say what happened if one or both of the types were | |||
1464 | incomplete; we choose to follow C99 rules here, which is that they | |||
1465 | are compatible. */ | |||
1466 | if (TYPE_SIZE (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1466, __FUNCTION__))->type_common.size) == NULL__null | |||
1467 | || TYPE_SIZE (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1467, __FUNCTION__))->type_common.size) == NULL__null) | |||
1468 | return 1; | |||
1469 | ||||
1470 | { | |||
1471 | const struct tagged_tu_seen_cache * tts_i; | |||
1472 | for (tts_i = tagged_tu_seen_base; tts_i != NULL__null; tts_i = tts_i->next) | |||
1473 | if (tts_i->t1 == t1 && tts_i->t2 == t2) | |||
1474 | return tts_i->val; | |||
1475 | } | |||
1476 | ||||
1477 | switch (TREE_CODE (t1)((enum tree_code) (t1)->base.code)) | |||
1478 | { | |||
1479 | case ENUMERAL_TYPE: | |||
1480 | { | |||
1481 | struct tagged_tu_seen_cache *tu = alloc_tagged_tu_seen_cache (t1, t2); | |||
1482 | /* Speed up the case where the type values are in the same order. */ | |||
1483 | tree tv1 = TYPE_VALUES (t1)((tree_check ((t1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1483, __FUNCTION__, (ENUMERAL_TYPE)))->type_non_common.values ); | |||
1484 | tree tv2 = TYPE_VALUES (t2)((tree_check ((t2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1484, __FUNCTION__, (ENUMERAL_TYPE)))->type_non_common.values ); | |||
1485 | ||||
1486 | if (tv1 == tv2) | |||
1487 | { | |||
1488 | return 1; | |||
1489 | } | |||
1490 | ||||
1491 | for (;tv1 && tv2; tv1 = TREE_CHAIN (tv1)((contains_struct_check ((tv1), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1491, __FUNCTION__))->common.chain), tv2 = TREE_CHAIN (tv2)((contains_struct_check ((tv2), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1491, __FUNCTION__))->common.chain)) | |||
1492 | { | |||
1493 | if (TREE_PURPOSE (tv1)((tree_check ((tv1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1493, __FUNCTION__, (TREE_LIST)))->list.purpose) != TREE_PURPOSE (tv2)((tree_check ((tv2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1493, __FUNCTION__, (TREE_LIST)))->list.purpose)) | |||
1494 | break; | |||
1495 | if (simple_cst_equal (TREE_VALUE (tv1)((tree_check ((tv1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1495, __FUNCTION__, (TREE_LIST)))->list.value), TREE_VALUE (tv2)((tree_check ((tv2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1495, __FUNCTION__, (TREE_LIST)))->list.value)) != 1) | |||
1496 | { | |||
1497 | tu->val = 0; | |||
1498 | return 0; | |||
1499 | } | |||
1500 | } | |||
1501 | ||||
1502 | if (tv1 == NULL_TREE(tree) __null && tv2 == NULL_TREE(tree) __null) | |||
1503 | { | |||
1504 | return 1; | |||
1505 | } | |||
1506 | if (tv1 == NULL_TREE(tree) __null || tv2 == NULL_TREE(tree) __null) | |||
1507 | { | |||
1508 | tu->val = 0; | |||
1509 | return 0; | |||
1510 | } | |||
1511 | ||||
1512 | if (list_length (TYPE_VALUES (t1)((tree_check ((t1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1512, __FUNCTION__, (ENUMERAL_TYPE)))->type_non_common.values )) != list_length (TYPE_VALUES (t2)((tree_check ((t2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1512, __FUNCTION__, (ENUMERAL_TYPE)))->type_non_common.values ))) | |||
1513 | { | |||
1514 | tu->val = 0; | |||
1515 | return 0; | |||
1516 | } | |||
1517 | ||||
1518 | for (s1 = TYPE_VALUES (t1)((tree_check ((t1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1518, __FUNCTION__, (ENUMERAL_TYPE)))->type_non_common.values ); s1; s1 = TREE_CHAIN (s1)((contains_struct_check ((s1), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1518, __FUNCTION__))->common.chain)) | |||
1519 | { | |||
1520 | s2 = purpose_member (TREE_PURPOSE (s1)((tree_check ((s1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1520, __FUNCTION__, (TREE_LIST)))->list.purpose), TYPE_VALUES (t2)((tree_check ((t2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1520, __FUNCTION__, (ENUMERAL_TYPE)))->type_non_common.values )); | |||
1521 | if (s2 == NULL__null | |||
1522 | || simple_cst_equal (TREE_VALUE (s1)((tree_check ((s1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1522, __FUNCTION__, (TREE_LIST)))->list.value), TREE_VALUE (s2)((tree_check ((s2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1522, __FUNCTION__, (TREE_LIST)))->list.value)) != 1) | |||
1523 | { | |||
1524 | tu->val = 0; | |||
1525 | return 0; | |||
1526 | } | |||
1527 | } | |||
1528 | return 1; | |||
1529 | } | |||
1530 | ||||
1531 | case UNION_TYPE: | |||
1532 | { | |||
1533 | struct tagged_tu_seen_cache *tu = alloc_tagged_tu_seen_cache (t1, t2); | |||
1534 | if (list_length (TYPE_FIELDS (t1)((tree_check3 ((t1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1534, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values)) != list_length (TYPE_FIELDS (t2)((tree_check3 ((t2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1534, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values))) | |||
1535 | { | |||
1536 | tu->val = 0; | |||
1537 | return 0; | |||
1538 | } | |||
1539 | ||||
1540 | /* Speed up the common case where the fields are in the same order. */ | |||
1541 | for (s1 = TYPE_FIELDS (t1)((tree_check3 ((t1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1541, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values), s2 = TYPE_FIELDS (t2)((tree_check3 ((t2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1541, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); s1 && s2; | |||
1542 | s1 = DECL_CHAIN (s1)(((contains_struct_check (((contains_struct_check ((s1), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1542, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1542, __FUNCTION__))->common.chain)), s2 = DECL_CHAIN (s2)(((contains_struct_check (((contains_struct_check ((s2), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1542, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1542, __FUNCTION__))->common.chain))) | |||
1543 | { | |||
1544 | int result; | |||
1545 | ||||
1546 | if (DECL_NAME (s1)((contains_struct_check ((s1), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1546, __FUNCTION__))->decl_minimal.name) != DECL_NAME (s2)((contains_struct_check ((s2), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1546, __FUNCTION__))->decl_minimal.name)) | |||
1547 | break; | |||
1548 | result = comptypes_internal (TREE_TYPE (s1)((contains_struct_check ((s1), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1548, __FUNCTION__))->typed.type), TREE_TYPE (s2)((contains_struct_check ((s2), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1548, __FUNCTION__))->typed.type), | |||
1549 | enum_and_int_p, different_types_p); | |||
1550 | ||||
1551 | if (result != 1 && !DECL_NAME (s1)((contains_struct_check ((s1), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1551, __FUNCTION__))->decl_minimal.name)) | |||
1552 | break; | |||
1553 | if (result == 0) | |||
1554 | { | |||
1555 | tu->val = 0; | |||
1556 | return 0; | |||
1557 | } | |||
1558 | if (result == 2) | |||
1559 | needs_warning = true; | |||
1560 | ||||
1561 | if (TREE_CODE (s1)((enum tree_code) (s1)->base.code) == FIELD_DECL | |||
1562 | && simple_cst_equal (DECL_FIELD_BIT_OFFSET (s1)((tree_check ((s1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1562, __FUNCTION__, (FIELD_DECL)))->field_decl.bit_offset ), | |||
1563 | DECL_FIELD_BIT_OFFSET (s2)((tree_check ((s2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1563, __FUNCTION__, (FIELD_DECL)))->field_decl.bit_offset )) != 1) | |||
1564 | { | |||
1565 | tu->val = 0; | |||
1566 | return 0; | |||
1567 | } | |||
1568 | } | |||
1569 | if (!s1 && !s2) | |||
1570 | { | |||
1571 | tu->val = needs_warning ? 2 : 1; | |||
1572 | return tu->val; | |||
1573 | } | |||
1574 | ||||
1575 | for (s1 = TYPE_FIELDS (t1)((tree_check3 ((t1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1575, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); s1; s1 = DECL_CHAIN (s1)(((contains_struct_check (((contains_struct_check ((s1), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1575, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1575, __FUNCTION__))->common.chain))) | |||
1576 | { | |||
1577 | bool ok = false; | |||
1578 | ||||
1579 | for (s2 = TYPE_FIELDS (t2)((tree_check3 ((t2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1579, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); s2; s2 = DECL_CHAIN (s2)(((contains_struct_check (((contains_struct_check ((s2), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1579, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1579, __FUNCTION__))->common.chain))) | |||
1580 | if (DECL_NAME (s1)((contains_struct_check ((s1), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1580, __FUNCTION__))->decl_minimal.name) == DECL_NAME (s2)((contains_struct_check ((s2), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1580, __FUNCTION__))->decl_minimal.name)) | |||
1581 | { | |||
1582 | int result; | |||
1583 | ||||
1584 | result = comptypes_internal (TREE_TYPE (s1)((contains_struct_check ((s1), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1584, __FUNCTION__))->typed.type), TREE_TYPE (s2)((contains_struct_check ((s2), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1584, __FUNCTION__))->typed.type), | |||
1585 | enum_and_int_p, | |||
1586 | different_types_p); | |||
1587 | ||||
1588 | if (result != 1 && !DECL_NAME (s1)((contains_struct_check ((s1), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1588, __FUNCTION__))->decl_minimal.name)) | |||
1589 | continue; | |||
1590 | if (result == 0) | |||
1591 | { | |||
1592 | tu->val = 0; | |||
1593 | return 0; | |||
1594 | } | |||
1595 | if (result == 2) | |||
1596 | needs_warning = true; | |||
1597 | ||||
1598 | if (TREE_CODE (s1)((enum tree_code) (s1)->base.code) == FIELD_DECL | |||
1599 | && simple_cst_equal (DECL_FIELD_BIT_OFFSET (s1)((tree_check ((s1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1599, __FUNCTION__, (FIELD_DECL)))->field_decl.bit_offset ), | |||
1600 | DECL_FIELD_BIT_OFFSET (s2)((tree_check ((s2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1600, __FUNCTION__, (FIELD_DECL)))->field_decl.bit_offset )) != 1) | |||
1601 | break; | |||
1602 | ||||
1603 | ok = true; | |||
1604 | break; | |||
1605 | } | |||
1606 | if (!ok) | |||
1607 | { | |||
1608 | tu->val = 0; | |||
1609 | return 0; | |||
1610 | } | |||
1611 | } | |||
1612 | tu->val = needs_warning ? 2 : 10; | |||
1613 | return tu->val; | |||
1614 | } | |||
1615 | ||||
1616 | case RECORD_TYPE: | |||
1617 | { | |||
1618 | struct tagged_tu_seen_cache *tu = alloc_tagged_tu_seen_cache (t1, t2); | |||
1619 | ||||
1620 | for (s1 = TYPE_FIELDS (t1)((tree_check3 ((t1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1620, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values), s2 = TYPE_FIELDS (t2)((tree_check3 ((t2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1620, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); | |||
1621 | s1 && s2; | |||
1622 | s1 = DECL_CHAIN (s1)(((contains_struct_check (((contains_struct_check ((s1), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1622, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1622, __FUNCTION__))->common.chain)), s2 = DECL_CHAIN (s2)(((contains_struct_check (((contains_struct_check ((s2), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1622, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1622, __FUNCTION__))->common.chain))) | |||
1623 | { | |||
1624 | int result; | |||
1625 | if (TREE_CODE (s1)((enum tree_code) (s1)->base.code) != TREE_CODE (s2)((enum tree_code) (s2)->base.code) | |||
1626 | || DECL_NAME (s1)((contains_struct_check ((s1), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1626, __FUNCTION__))->decl_minimal.name) != DECL_NAME (s2)((contains_struct_check ((s2), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1626, __FUNCTION__))->decl_minimal.name)) | |||
1627 | break; | |||
1628 | result = comptypes_internal (TREE_TYPE (s1)((contains_struct_check ((s1), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1628, __FUNCTION__))->typed.type), TREE_TYPE (s2)((contains_struct_check ((s2), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1628, __FUNCTION__))->typed.type), | |||
1629 | enum_and_int_p, different_types_p); | |||
1630 | if (result == 0) | |||
1631 | break; | |||
1632 | if (result == 2) | |||
1633 | needs_warning = true; | |||
1634 | ||||
1635 | if (TREE_CODE (s1)((enum tree_code) (s1)->base.code) == FIELD_DECL | |||
1636 | && simple_cst_equal (DECL_FIELD_BIT_OFFSET (s1)((tree_check ((s1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1636, __FUNCTION__, (FIELD_DECL)))->field_decl.bit_offset ), | |||
1637 | DECL_FIELD_BIT_OFFSET (s2)((tree_check ((s2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1637, __FUNCTION__, (FIELD_DECL)))->field_decl.bit_offset )) != 1) | |||
1638 | break; | |||
1639 | } | |||
1640 | if (s1 && s2) | |||
1641 | tu->val = 0; | |||
1642 | else | |||
1643 | tu->val = needs_warning ? 2 : 1; | |||
1644 | return tu->val; | |||
1645 | } | |||
1646 | ||||
1647 | default: | |||
1648 | gcc_unreachable ()(fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1648, __FUNCTION__)); | |||
1649 | } | |||
1650 | } | |||
1651 | ||||
1652 | /* Return 1 if two function types F1 and F2 are compatible. | |||
1653 | If either type specifies no argument types, | |||
1654 | the other must specify a fixed number of self-promoting arg types. | |||
1655 | Otherwise, if one type specifies only the number of arguments, | |||
1656 | the other must specify that number of self-promoting arg types. | |||
1657 | Otherwise, the argument types must match. | |||
1658 | ENUM_AND_INT_P and DIFFERENT_TYPES_P are as in comptypes_internal. */ | |||
1659 | ||||
1660 | static int | |||
1661 | function_types_compatible_p (const_tree f1, const_tree f2, | |||
1662 | bool *enum_and_int_p, bool *different_types_p) | |||
1663 | { | |||
1664 | tree args1, args2; | |||
1665 | /* 1 if no need for warning yet, 2 if warning cause has been seen. */ | |||
1666 | int val = 1; | |||
1667 | int val1; | |||
1668 | tree ret1, ret2; | |||
1669 | ||||
1670 | ret1 = TREE_TYPE (f1)((contains_struct_check ((f1), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1670, __FUNCTION__))->typed.type); | |||
1671 | ret2 = TREE_TYPE (f2)((contains_struct_check ((f2), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1671, __FUNCTION__))->typed.type); | |||
1672 | ||||
1673 | /* 'volatile' qualifiers on a function's return type used to mean | |||
1674 | the function is noreturn. */ | |||
1675 | if (TYPE_VOLATILE (ret1)((tree_class_check ((ret1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1675, __FUNCTION__))->base.volatile_flag) != TYPE_VOLATILE (ret2)((tree_class_check ((ret2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1675, __FUNCTION__))->base.volatile_flag)) | |||
1676 | pedwarn (input_location, 0, "function return types not compatible due to %<volatile%>"); | |||
1677 | if (TYPE_VOLATILE (ret1)((tree_class_check ((ret1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1677, __FUNCTION__))->base.volatile_flag)) | |||
1678 | ret1 = build_qualified_type (TYPE_MAIN_VARIANT (ret1)((tree_class_check ((ret1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1678, __FUNCTION__))->type_common.main_variant), | |||
1679 | TYPE_QUALS (ret1)((int) ((((tree_class_check ((ret1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1679, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((ret1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1679, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((ret1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1679, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((ret1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1679, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ) | (((((tree_class_check ((ret1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1679, __FUNCTION__))->base.u.bits.address_space) & 0xFF ) << 8)))) & ~TYPE_QUAL_VOLATILE); | |||
1680 | if (TYPE_VOLATILE (ret2)((tree_class_check ((ret2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1680, __FUNCTION__))->base.volatile_flag)) | |||
1681 | ret2 = build_qualified_type (TYPE_MAIN_VARIANT (ret2)((tree_class_check ((ret2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1681, __FUNCTION__))->type_common.main_variant), | |||
1682 | TYPE_QUALS (ret2)((int) ((((tree_class_check ((ret2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1682, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((ret2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1682, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((ret2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1682, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((ret2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1682, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ) | (((((tree_class_check ((ret2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1682, __FUNCTION__))->base.u.bits.address_space) & 0xFF ) << 8)))) & ~TYPE_QUAL_VOLATILE); | |||
1683 | val = comptypes_internal (ret1, ret2, enum_and_int_p, different_types_p); | |||
1684 | if (val == 0) | |||
1685 | return 0; | |||
1686 | ||||
1687 | args1 = TYPE_ARG_TYPES (f1)((tree_check2 ((f1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1687, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values); | |||
1688 | args2 = TYPE_ARG_TYPES (f2)((tree_check2 ((f2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1688, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values); | |||
1689 | ||||
1690 | if (different_types_p != NULL__null | |||
1691 | && (args1 == NULL_TREE(tree) __null) != (args2 == NULL_TREE(tree) __null)) | |||
1692 | *different_types_p = true; | |||
1693 | ||||
1694 | /* An unspecified parmlist matches any specified parmlist | |||
1695 | whose argument types don't need default promotions. */ | |||
1696 | ||||
1697 | if (args1 == NULL_TREE(tree) __null) | |||
1698 | { | |||
1699 | if (TYPE_NO_NAMED_ARGS_STDARG_P (f1)((tree_class_check ((f1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1699, __FUNCTION__))->type_common.no_named_args_stdarg_p ) != TYPE_NO_NAMED_ARGS_STDARG_P (f2)((tree_class_check ((f2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1699, __FUNCTION__))->type_common.no_named_args_stdarg_p )) | |||
1700 | return 0; | |||
1701 | if (!self_promoting_args_p (args2)) | |||
1702 | return 0; | |||
1703 | /* If one of these types comes from a non-prototype fn definition, | |||
1704 | compare that with the other type's arglist. | |||
1705 | If they don't match, ask for a warning (but no error). */ | |||
1706 | if (TYPE_ACTUAL_ARG_TYPES (f1)((tree_class_check (((tree_check ((f1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1706, __FUNCTION__, (FUNCTION_TYPE)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1706, __FUNCTION__))->type_non_common.lang_1) | |||
1707 | && type_lists_compatible_p (args2, TYPE_ACTUAL_ARG_TYPES (f1)((tree_class_check (((tree_check ((f1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1707, __FUNCTION__, (FUNCTION_TYPE)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1707, __FUNCTION__))->type_non_common.lang_1), | |||
1708 | enum_and_int_p, different_types_p) != 1) | |||
1709 | val = 2; | |||
1710 | return val; | |||
1711 | } | |||
1712 | if (args2 == NULL_TREE(tree) __null) | |||
1713 | { | |||
1714 | if (TYPE_NO_NAMED_ARGS_STDARG_P (f1)((tree_class_check ((f1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1714, __FUNCTION__))->type_common.no_named_args_stdarg_p ) != TYPE_NO_NAMED_ARGS_STDARG_P (f2)((tree_class_check ((f2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1714, __FUNCTION__))->type_common.no_named_args_stdarg_p )) | |||
1715 | return 0; | |||
1716 | if (!self_promoting_args_p (args1)) | |||
1717 | return 0; | |||
1718 | if (TYPE_ACTUAL_ARG_TYPES (f2)((tree_class_check (((tree_check ((f2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1718, __FUNCTION__, (FUNCTION_TYPE)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1718, __FUNCTION__))->type_non_common.lang_1) | |||
1719 | && type_lists_compatible_p (args1, TYPE_ACTUAL_ARG_TYPES (f2)((tree_class_check (((tree_check ((f2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1719, __FUNCTION__, (FUNCTION_TYPE)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1719, __FUNCTION__))->type_non_common.lang_1), | |||
1720 | enum_and_int_p, different_types_p) != 1) | |||
1721 | val = 2; | |||
1722 | return val; | |||
1723 | } | |||
1724 | ||||
1725 | /* Both types have argument lists: compare them and propagate results. */ | |||
1726 | val1 = type_lists_compatible_p (args1, args2, enum_and_int_p, | |||
1727 | different_types_p); | |||
1728 | return val1 != 1 ? val1 : val; | |||
1729 | } | |||
1730 | ||||
1731 | /* Check two lists of types for compatibility, returning 0 for | |||
1732 | incompatible, 1 for compatible, or 2 for compatible with | |||
1733 | warning. ENUM_AND_INT_P and DIFFERENT_TYPES_P are as in | |||
1734 | comptypes_internal. */ | |||
1735 | ||||
1736 | static int | |||
1737 | type_lists_compatible_p (const_tree args1, const_tree args2, | |||
1738 | bool *enum_and_int_p, bool *different_types_p) | |||
1739 | { | |||
1740 | /* 1 if no need for warning yet, 2 if warning cause has been seen. */ | |||
1741 | int val = 1; | |||
1742 | int newval = 0; | |||
1743 | ||||
1744 | while (1) | |||
1745 | { | |||
1746 | tree a1, mv1, a2, mv2; | |||
1747 | if (args1 == NULL_TREE(tree) __null && args2 == NULL_TREE(tree) __null) | |||
1748 | return val; | |||
1749 | /* If one list is shorter than the other, | |||
1750 | they fail to match. */ | |||
1751 | if (args1 == NULL_TREE(tree) __null || args2 == NULL_TREE(tree) __null) | |||
1752 | return 0; | |||
1753 | mv1 = a1 = TREE_VALUE (args1)((tree_check ((args1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1753, __FUNCTION__, (TREE_LIST)))->list.value); | |||
1754 | mv2 = a2 = TREE_VALUE (args2)((tree_check ((args2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1754, __FUNCTION__, (TREE_LIST)))->list.value); | |||
1755 | if (mv1 && mv1 != error_mark_nodeglobal_trees[TI_ERROR_MARK] && TREE_CODE (mv1)((enum tree_code) (mv1)->base.code) != ARRAY_TYPE) | |||
1756 | mv1 = (TYPE_ATOMIC (mv1)((tree_class_check ((mv1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1756, __FUNCTION__))->base.u.bits.atomic_flag) | |||
1757 | ? c_build_qualified_type (TYPE_MAIN_VARIANT (mv1)((tree_class_check ((mv1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1757, __FUNCTION__))->type_common.main_variant), | |||
1758 | TYPE_QUAL_ATOMIC) | |||
1759 | : TYPE_MAIN_VARIANT (mv1)((tree_class_check ((mv1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1759, __FUNCTION__))->type_common.main_variant)); | |||
1760 | if (mv2 && mv2 != error_mark_nodeglobal_trees[TI_ERROR_MARK] && TREE_CODE (mv2)((enum tree_code) (mv2)->base.code) != ARRAY_TYPE) | |||
1761 | mv2 = (TYPE_ATOMIC (mv2)((tree_class_check ((mv2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1761, __FUNCTION__))->base.u.bits.atomic_flag) | |||
1762 | ? c_build_qualified_type (TYPE_MAIN_VARIANT (mv2)((tree_class_check ((mv2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1762, __FUNCTION__))->type_common.main_variant), | |||
1763 | TYPE_QUAL_ATOMIC) | |||
1764 | : TYPE_MAIN_VARIANT (mv2)((tree_class_check ((mv2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1764, __FUNCTION__))->type_common.main_variant)); | |||
1765 | /* A null pointer instead of a type | |||
1766 | means there is supposed to be an argument | |||
1767 | but nothing is specified about what type it has. | |||
1768 | So match anything that self-promotes. */ | |||
1769 | if (different_types_p != NULL__null | |||
1770 | && (a1 == NULL_TREE(tree) __null) != (a2 == NULL_TREE(tree) __null)) | |||
1771 | *different_types_p = true; | |||
1772 | if (a1 == NULL_TREE(tree) __null) | |||
1773 | { | |||
1774 | if (c_type_promotes_to (a2) != a2) | |||
1775 | return 0; | |||
1776 | } | |||
1777 | else if (a2 == NULL_TREE(tree) __null) | |||
1778 | { | |||
1779 | if (c_type_promotes_to (a1) != a1) | |||
1780 | return 0; | |||
1781 | } | |||
1782 | /* If one of the lists has an error marker, ignore this arg. */ | |||
1783 | else if (TREE_CODE (a1)((enum tree_code) (a1)->base.code) == ERROR_MARK | |||
1784 | || TREE_CODE (a2)((enum tree_code) (a2)->base.code) == ERROR_MARK) | |||
1785 | ; | |||
1786 | else if (!(newval = comptypes_internal (mv1, mv2, enum_and_int_p, | |||
1787 | different_types_p))) | |||
1788 | { | |||
1789 | if (different_types_p != NULL__null) | |||
1790 | *different_types_p = true; | |||
1791 | /* Allow wait (union {union wait *u; int *i} *) | |||
1792 | and wait (union wait *) to be compatible. */ | |||
1793 | if (TREE_CODE (a1)((enum tree_code) (a1)->base.code) == UNION_TYPE | |||
1794 | && (TYPE_NAME (a1)((tree_class_check ((a1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1794, __FUNCTION__))->type_common.name) == NULL_TREE(tree) __null | |||
1795 | || TYPE_TRANSPARENT_AGGR (a1)((tree_check3 ((a1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1795, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_common.transparent_aggr_flag)) | |||
1796 | && TREE_CODE (TYPE_SIZE (a1))((enum tree_code) (((tree_class_check ((a1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1796, __FUNCTION__))->type_common.size))->base.code) == INTEGER_CST | |||
1797 | && tree_int_cst_equal (TYPE_SIZE (a1)((tree_class_check ((a1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1797, __FUNCTION__))->type_common.size), | |||
1798 | TYPE_SIZE (a2)((tree_class_check ((a2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1798, __FUNCTION__))->type_common.size))) | |||
1799 | { | |||
1800 | tree memb; | |||
1801 | for (memb = TYPE_FIELDS (a1)((tree_check3 ((a1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1801, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); | |||
1802 | memb; memb = DECL_CHAIN (memb)(((contains_struct_check (((contains_struct_check ((memb), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1802, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1802, __FUNCTION__))->common.chain))) | |||
1803 | { | |||
1804 | tree mv3 = TREE_TYPE (memb)((contains_struct_check ((memb), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1804, __FUNCTION__))->typed.type); | |||
1805 | if (mv3 && mv3 != error_mark_nodeglobal_trees[TI_ERROR_MARK] | |||
1806 | && TREE_CODE (mv3)((enum tree_code) (mv3)->base.code) != ARRAY_TYPE) | |||
1807 | mv3 = (TYPE_ATOMIC (mv3)((tree_class_check ((mv3), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1807, __FUNCTION__))->base.u.bits.atomic_flag) | |||
1808 | ? c_build_qualified_type (TYPE_MAIN_VARIANT (mv3)((tree_class_check ((mv3), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1808, __FUNCTION__))->type_common.main_variant), | |||
1809 | TYPE_QUAL_ATOMIC) | |||
1810 | : TYPE_MAIN_VARIANT (mv3)((tree_class_check ((mv3), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1810, __FUNCTION__))->type_common.main_variant)); | |||
1811 | if (comptypes_internal (mv3, mv2, enum_and_int_p, | |||
1812 | different_types_p)) | |||
1813 | break; | |||
1814 | } | |||
1815 | if (memb == NULL_TREE(tree) __null) | |||
1816 | return 0; | |||
1817 | } | |||
1818 | else if (TREE_CODE (a2)((enum tree_code) (a2)->base.code) == UNION_TYPE | |||
1819 | && (TYPE_NAME (a2)((tree_class_check ((a2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1819, __FUNCTION__))->type_common.name) == NULL_TREE(tree) __null | |||
1820 | || TYPE_TRANSPARENT_AGGR (a2)((tree_check3 ((a2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1820, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_common.transparent_aggr_flag)) | |||
1821 | && TREE_CODE (TYPE_SIZE (a2))((enum tree_code) (((tree_class_check ((a2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1821, __FUNCTION__))->type_common.size))->base.code) == INTEGER_CST | |||
1822 | && tree_int_cst_equal (TYPE_SIZE (a2)((tree_class_check ((a2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1822, __FUNCTION__))->type_common.size), | |||
1823 | TYPE_SIZE (a1)((tree_class_check ((a1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1823, __FUNCTION__))->type_common.size))) | |||
1824 | { | |||
1825 | tree memb; | |||
1826 | for (memb = TYPE_FIELDS (a2)((tree_check3 ((a2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1826, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); | |||
1827 | memb; memb = DECL_CHAIN (memb)(((contains_struct_check (((contains_struct_check ((memb), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1827, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1827, __FUNCTION__))->common.chain))) | |||
1828 | { | |||
1829 | tree mv3 = TREE_TYPE (memb)((contains_struct_check ((memb), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1829, __FUNCTION__))->typed.type); | |||
1830 | if (mv3 && mv3 != error_mark_nodeglobal_trees[TI_ERROR_MARK] | |||
1831 | && TREE_CODE (mv3)((enum tree_code) (mv3)->base.code) != ARRAY_TYPE) | |||
1832 | mv3 = (TYPE_ATOMIC (mv3)((tree_class_check ((mv3), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1832, __FUNCTION__))->base.u.bits.atomic_flag) | |||
1833 | ? c_build_qualified_type (TYPE_MAIN_VARIANT (mv3)((tree_class_check ((mv3), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1833, __FUNCTION__))->type_common.main_variant), | |||
1834 | TYPE_QUAL_ATOMIC) | |||
1835 | : TYPE_MAIN_VARIANT (mv3)((tree_class_check ((mv3), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1835, __FUNCTION__))->type_common.main_variant)); | |||
1836 | if (comptypes_internal (mv3, mv1, enum_and_int_p, | |||
1837 | different_types_p)) | |||
1838 | break; | |||
1839 | } | |||
1840 | if (memb == NULL_TREE(tree) __null) | |||
1841 | return 0; | |||
1842 | } | |||
1843 | else | |||
1844 | return 0; | |||
1845 | } | |||
1846 | ||||
1847 | /* comptypes said ok, but record if it said to warn. */ | |||
1848 | if (newval > val) | |||
1849 | val = newval; | |||
1850 | ||||
1851 | args1 = TREE_CHAIN (args1)((contains_struct_check ((args1), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1851, __FUNCTION__))->common.chain); | |||
1852 | args2 = TREE_CHAIN (args2)((contains_struct_check ((args2), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1852, __FUNCTION__))->common.chain); | |||
1853 | } | |||
1854 | } | |||
1855 | ||||
1856 | /* Compute the size to increment a pointer by. When a function type or void | |||
1857 | type or incomplete type is passed, size_one_node is returned. | |||
1858 | This function does not emit any diagnostics; the caller is responsible | |||
1859 | for that. */ | |||
1860 | ||||
1861 | static tree | |||
1862 | c_size_in_bytes (const_tree type) | |||
1863 | { | |||
1864 | enum tree_code code = TREE_CODE (type)((enum tree_code) (type)->base.code); | |||
1865 | ||||
1866 | if (code == FUNCTION_TYPE || code == VOID_TYPE || code == ERROR_MARK | |||
1867 | || !COMPLETE_TYPE_P (type)(((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1867, __FUNCTION__))->type_common.size) != (tree) __null )) | |||
1868 | return size_one_nodeglobal_trees[TI_SIZE_ONE]; | |||
1869 | ||||
1870 | /* Convert in case a char is more than one unit. */ | |||
1871 | return size_binop_loc (input_location, CEIL_DIV_EXPR, TYPE_SIZE_UNIT (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1871, __FUNCTION__))->type_common.size_unit), | |||
1872 | size_int (TYPE_PRECISION (char_type_node)size_int_kind (((tree_class_check ((integer_types[itk_char]), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1872, __FUNCTION__))->type_common.precision) / (8), stk_sizetype ) | |||
1873 | / BITS_PER_UNIT)size_int_kind (((tree_class_check ((integer_types[itk_char]), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1872, __FUNCTION__))->type_common.precision) / (8), stk_sizetype )); | |||
1874 | } | |||
1875 | ||||
1876 | /* Return either DECL or its known constant value (if it has one). */ | |||
1877 | ||||
1878 | tree | |||
1879 | decl_constant_value_1 (tree decl, bool in_init) | |||
1880 | { | |||
1881 | if (/* Note that DECL_INITIAL isn't valid for a PARM_DECL. */ | |||
1882 | TREE_CODE (decl)((enum tree_code) (decl)->base.code) != PARM_DECL | |||
1883 | && !TREE_THIS_VOLATILE (decl)((decl)->base.volatile_flag) | |||
1884 | && TREE_READONLY (decl)((non_type_check ((decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1884, __FUNCTION__))->base.readonly_flag) | |||
1885 | && DECL_INITIAL (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1885, __FUNCTION__))->decl_common.initial) != NULL_TREE(tree) __null | |||
1886 | && !error_operand_p (DECL_INITIAL (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1886, __FUNCTION__))->decl_common.initial)) | |||
1887 | /* This is invalid if initial value is not constant. | |||
1888 | If it has either a function call, a memory reference, | |||
1889 | or a variable, then re-evaluating it could give different results. */ | |||
1890 | && TREE_CONSTANT (DECL_INITIAL (decl))((non_type_check ((((contains_struct_check ((decl), (TS_DECL_COMMON ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1890, __FUNCTION__))->decl_common.initial)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1890, __FUNCTION__))->base.constant_flag) | |||
1891 | /* Check for cases where this is sub-optimal, even though valid. */ | |||
1892 | && (in_init || TREE_CODE (DECL_INITIAL (decl))((enum tree_code) (((contains_struct_check ((decl), (TS_DECL_COMMON ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1892, __FUNCTION__))->decl_common.initial))->base.code ) != CONSTRUCTOR)) | |||
1893 | return DECL_INITIAL (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1893, __FUNCTION__))->decl_common.initial); | |||
1894 | return decl; | |||
1895 | } | |||
1896 | ||||
1897 | /* Return either DECL or its known constant value (if it has one). | |||
1898 | Like the above, but always return decl outside of functions. */ | |||
1899 | ||||
1900 | tree | |||
1901 | decl_constant_value (tree decl) | |||
1902 | { | |||
1903 | /* Don't change a variable array bound or initial value to a constant | |||
1904 | in a place where a variable is invalid. */ | |||
1905 | return current_function_decl ? decl_constant_value_1 (decl, false) : decl; | |||
1906 | } | |||
1907 | ||||
1908 | /* Convert the array expression EXP to a pointer. */ | |||
1909 | static tree | |||
1910 | array_to_pointer_conversion (location_t loc, tree exp) | |||
1911 | { | |||
1912 | tree orig_exp = exp; | |||
1913 | tree type = TREE_TYPE (exp)((contains_struct_check ((exp), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1913, __FUNCTION__))->typed.type); | |||
1914 | tree adr; | |||
1915 | tree restype = TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1915, __FUNCTION__))->typed.type); | |||
1916 | tree ptrtype; | |||
1917 | ||||
1918 | gcc_assert (TREE_CODE (type) == ARRAY_TYPE)((void)(!(((enum tree_code) (type)->base.code) == ARRAY_TYPE ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1918, __FUNCTION__), 0 : 0)); | |||
1919 | ||||
1920 | STRIP_TYPE_NOPS (exp)while ((((((enum tree_code) (exp)->base.code)) == NOP_EXPR || (((enum tree_code) (exp)->base.code)) == CONVERT_EXPR) || ((enum tree_code) (exp)->base.code) == NON_LVALUE_EXPR ) && (*((const_cast<tree*> (tree_operand_check ( (exp), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1920, __FUNCTION__))))) != global_trees[TI_ERROR_MARK] && (((contains_struct_check ((exp), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1920, __FUNCTION__))->typed.type) == ((contains_struct_check (((*((const_cast<tree*> (tree_operand_check ((exp), (0 ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1920, __FUNCTION__)))))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1920, __FUNCTION__))->typed.type))) (exp) = (*((const_cast <tree*> (tree_operand_check ((exp), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1920, __FUNCTION__))))); | |||
1921 | ||||
1922 | copy_warning (exp, orig_exp); | |||
1923 | ||||
1924 | ptrtype = build_pointer_type (restype); | |||
1925 | ||||
1926 | if (INDIRECT_REF_P (exp)(((enum tree_code) (exp)->base.code) == INDIRECT_REF)) | |||
1927 | return convert (ptrtype, TREE_OPERAND (exp, 0)(*((const_cast<tree*> (tree_operand_check ((exp), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1927, __FUNCTION__)))))); | |||
1928 | ||||
1929 | /* In C++ array compound literals are temporary objects unless they are | |||
1930 | const or appear in namespace scope, so they are destroyed too soon | |||
1931 | to use them for much of anything (c++/53220). */ | |||
1932 | if (warn_cxx_compatglobal_options.x_warn_cxx_compat && TREE_CODE (exp)((enum tree_code) (exp)->base.code) == COMPOUND_LITERAL_EXPR) | |||
1933 | { | |||
1934 | tree decl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0)(*((const_cast<tree*> (tree_operand_check (((*((const_cast <tree*> (tree_operand_check ((exp), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1934, __FUNCTION__)))))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1934, __FUNCTION__))))); | |||
1935 | if (!TREE_READONLY (decl)((non_type_check ((decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1935, __FUNCTION__))->base.readonly_flag) && !TREE_STATIC (decl)((decl)->base.static_flag)) | |||
1936 | warning_at (DECL_SOURCE_LOCATION (decl)((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1936, __FUNCTION__))->decl_minimal.locus), OPT_Wc___compat, | |||
1937 | "converting an array compound literal to a pointer " | |||
1938 | "is ill-formed in C++"); | |||
1939 | } | |||
1940 | ||||
1941 | adr = build_unary_op (loc, ADDR_EXPR, exp, true); | |||
1942 | return convert (ptrtype, adr); | |||
1943 | } | |||
1944 | ||||
1945 | /* Convert the function expression EXP to a pointer. */ | |||
1946 | static tree | |||
1947 | function_to_pointer_conversion (location_t loc, tree exp) | |||
1948 | { | |||
1949 | tree orig_exp = exp; | |||
1950 | ||||
1951 | gcc_assert (TREE_CODE (TREE_TYPE (exp)) == FUNCTION_TYPE)((void)(!(((enum tree_code) (((contains_struct_check ((exp), ( TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1951, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1951, __FUNCTION__), 0 : 0)); | |||
1952 | ||||
1953 | STRIP_TYPE_NOPS (exp)while ((((((enum tree_code) (exp)->base.code)) == NOP_EXPR || (((enum tree_code) (exp)->base.code)) == CONVERT_EXPR) || ((enum tree_code) (exp)->base.code) == NON_LVALUE_EXPR ) && (*((const_cast<tree*> (tree_operand_check ( (exp), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1953, __FUNCTION__))))) != global_trees[TI_ERROR_MARK] && (((contains_struct_check ((exp), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1953, __FUNCTION__))->typed.type) == ((contains_struct_check (((*((const_cast<tree*> (tree_operand_check ((exp), (0 ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1953, __FUNCTION__)))))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1953, __FUNCTION__))->typed.type))) (exp) = (*((const_cast <tree*> (tree_operand_check ((exp), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1953, __FUNCTION__))))); | |||
1954 | ||||
1955 | copy_warning (exp, orig_exp); | |||
1956 | ||||
1957 | return build_unary_op (loc, ADDR_EXPR, exp, false); | |||
1958 | } | |||
1959 | ||||
1960 | /* Mark EXP as read, not just set, for set but not used -Wunused | |||
1961 | warning purposes. */ | |||
1962 | ||||
1963 | void | |||
1964 | mark_exp_read (tree exp) | |||
1965 | { | |||
1966 | switch (TREE_CODE (exp)((enum tree_code) (exp)->base.code)) | |||
1967 | { | |||
1968 | case VAR_DECL: | |||
1969 | case PARM_DECL: | |||
1970 | DECL_READ_P (exp)((tree_check2 ((exp), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1970, __FUNCTION__, (VAR_DECL), (PARM_DECL)))->decl_common .decl_read_flag) = 1; | |||
1971 | break; | |||
1972 | case ARRAY_REF: | |||
1973 | case COMPONENT_REF: | |||
1974 | case MODIFY_EXPR: | |||
1975 | case REALPART_EXPR: | |||
1976 | case IMAGPART_EXPR: | |||
1977 | CASE_CONVERTcase NOP_EXPR: case CONVERT_EXPR: | |||
1978 | case ADDR_EXPR: | |||
1979 | case VIEW_CONVERT_EXPR: | |||
1980 | mark_exp_read (TREE_OPERAND (exp, 0)(*((const_cast<tree*> (tree_operand_check ((exp), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1980, __FUNCTION__)))))); | |||
1981 | break; | |||
1982 | case COMPOUND_EXPR: | |||
1983 | /* Pattern match what build_atomic_assign produces with modifycode | |||
1984 | NOP_EXPR. */ | |||
1985 | if (VAR_P (TREE_OPERAND (exp, 1))(((enum tree_code) ((*((const_cast<tree*> (tree_operand_check ((exp), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1985, __FUNCTION__))))))->base.code) == VAR_DECL) | |||
1986 | && DECL_ARTIFICIAL (TREE_OPERAND (exp, 1))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check ((exp), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1986, __FUNCTION__)))))), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1986, __FUNCTION__))->decl_common.artificial_flag) | |||
1987 | && TREE_CODE (TREE_OPERAND (exp, 0))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check ((exp), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1987, __FUNCTION__))))))->base.code) == COMPOUND_EXPR) | |||
1988 | { | |||
1989 | tree t1 = TREE_OPERAND (TREE_OPERAND (exp, 0), 0)(*((const_cast<tree*> (tree_operand_check (((*((const_cast <tree*> (tree_operand_check ((exp), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1989, __FUNCTION__)))))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1989, __FUNCTION__))))); | |||
1990 | tree t2 = TREE_OPERAND (TREE_OPERAND (exp, 0), 1)(*((const_cast<tree*> (tree_operand_check (((*((const_cast <tree*> (tree_operand_check ((exp), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1990, __FUNCTION__)))))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1990, __FUNCTION__))))); | |||
1991 | if (TREE_CODE (t1)((enum tree_code) (t1)->base.code) == TARGET_EXPR | |||
1992 | && TARGET_EXPR_SLOT (t1)(*(tree_operand_check_code ((t1), (TARGET_EXPR), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1992, __FUNCTION__))) == TREE_OPERAND (exp, 1)(*((const_cast<tree*> (tree_operand_check ((exp), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 1992, __FUNCTION__))))) | |||
1993 | && TREE_CODE (t2)((enum tree_code) (t2)->base.code) == CALL_EXPR) | |||
1994 | { | |||
1995 | tree fndecl = get_callee_fndecl (t2); | |||
1996 | tree arg = NULL_TREE(tree) __null; | |||
1997 | if (fndecl | |||
1998 | && TREE_CODE (fndecl)((enum tree_code) (fndecl)->base.code) == FUNCTION_DECL | |||
1999 | && fndecl_built_in_p (fndecl, BUILT_IN_NORMAL) | |||
2000 | && call_expr_nargs (t2)(((int)((unsigned long) (*tree_int_cst_elt_check (((tree_class_check ((t2), (tcc_vl_exp), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2000, __FUNCTION__))->exp.operands[0]), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2000, __FUNCTION__)))) - 3) >= 2) | |||
2001 | switch (DECL_FUNCTION_CODE (fndecl)) | |||
2002 | { | |||
2003 | case BUILT_IN_ATOMIC_STORE: | |||
2004 | arg = CALL_EXPR_ARG (t2, 1)(*((const_cast<tree*> (tree_operand_check (((tree_check ((t2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2004, __FUNCTION__, (CALL_EXPR)))), ((1) + 3), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2004, __FUNCTION__))))); | |||
2005 | break; | |||
2006 | case BUILT_IN_ATOMIC_STORE_1: | |||
2007 | case BUILT_IN_ATOMIC_STORE_2: | |||
2008 | case BUILT_IN_ATOMIC_STORE_4: | |||
2009 | case BUILT_IN_ATOMIC_STORE_8: | |||
2010 | case BUILT_IN_ATOMIC_STORE_16: | |||
2011 | arg = CALL_EXPR_ARG (t2, 0)(*((const_cast<tree*> (tree_operand_check (((tree_check ((t2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2011, __FUNCTION__, (CALL_EXPR)))), ((0) + 3), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2011, __FUNCTION__))))); | |||
2012 | break; | |||
2013 | default: | |||
2014 | break; | |||
2015 | } | |||
2016 | if (arg) | |||
2017 | { | |||
2018 | STRIP_NOPS (arg)(arg) = tree_strip_nop_conversions ((const_cast<union tree_node *> (((arg))))); | |||
2019 | if (TREE_CODE (arg)((enum tree_code) (arg)->base.code) == ADDR_EXPR | |||
2020 | && DECL_P (TREE_OPERAND (arg, 0))(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) ((*((const_cast<tree*> (tree_operand_check ((arg), (0 ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2020, __FUNCTION__))))))->base.code))] == tcc_declaration ) | |||
2021 | && TYPE_ATOMIC (TREE_TYPE (TREE_OPERAND (arg, 0)))((tree_class_check ((((contains_struct_check (((*((const_cast <tree*> (tree_operand_check ((arg), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2021, __FUNCTION__)))))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2021, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2021, __FUNCTION__))->base.u.bits.atomic_flag)) | |||
2022 | mark_exp_read (TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2022, __FUNCTION__)))))); | |||
2023 | } | |||
2024 | } | |||
2025 | } | |||
2026 | /* FALLTHRU */ | |||
2027 | case C_MAYBE_CONST_EXPR: | |||
2028 | mark_exp_read (TREE_OPERAND (exp, 1)(*((const_cast<tree*> (tree_operand_check ((exp), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2028, __FUNCTION__)))))); | |||
2029 | break; | |||
2030 | default: | |||
2031 | break; | |||
2032 | } | |||
2033 | } | |||
2034 | ||||
2035 | /* Perform the default conversion of arrays and functions to pointers. | |||
2036 | Return the result of converting EXP. For any other expression, just | |||
2037 | return EXP. | |||
2038 | ||||
2039 | LOC is the location of the expression. */ | |||
2040 | ||||
2041 | struct c_expr | |||
2042 | default_function_array_conversion (location_t loc, struct c_expr exp) | |||
2043 | { | |||
2044 | tree orig_exp = exp.value; | |||
2045 | tree type = TREE_TYPE (exp.value)((contains_struct_check ((exp.value), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2045, __FUNCTION__))->typed.type); | |||
2046 | enum tree_code code = TREE_CODE (type)((enum tree_code) (type)->base.code); | |||
2047 | ||||
2048 | switch (code) | |||
2049 | { | |||
2050 | case ARRAY_TYPE: | |||
2051 | { | |||
2052 | bool not_lvalue = false; | |||
2053 | bool lvalue_array_p; | |||
2054 | ||||
2055 | while ((TREE_CODE (exp.value)((enum tree_code) (exp.value)->base.code) == NON_LVALUE_EXPR | |||
2056 | || CONVERT_EXPR_P (exp.value)((((enum tree_code) (exp.value)->base.code)) == NOP_EXPR || (((enum tree_code) (exp.value)->base.code)) == CONVERT_EXPR )) | |||
2057 | && TREE_TYPE (TREE_OPERAND (exp.value, 0))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check ((exp.value), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2057, __FUNCTION__)))))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2057, __FUNCTION__))->typed.type) == type) | |||
2058 | { | |||
2059 | if (TREE_CODE (exp.value)((enum tree_code) (exp.value)->base.code) == NON_LVALUE_EXPR) | |||
2060 | not_lvalue = true; | |||
2061 | exp.value = TREE_OPERAND (exp.value, 0)(*((const_cast<tree*> (tree_operand_check ((exp.value), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2061, __FUNCTION__))))); | |||
2062 | } | |||
2063 | ||||
2064 | copy_warning (exp.value, orig_exp); | |||
2065 | ||||
2066 | lvalue_array_p = !not_lvalue && lvalue_p (exp.value); | |||
2067 | if (!flag_isoc99 && !lvalue_array_p) | |||
2068 | { | |||
2069 | /* Before C99, non-lvalue arrays do not decay to pointers. | |||
2070 | Normally, using such an array would be invalid; but it can | |||
2071 | be used correctly inside sizeof or as a statement expression. | |||
2072 | Thus, do not give an error here; an error will result later. */ | |||
2073 | return exp; | |||
2074 | } | |||
2075 | ||||
2076 | exp.value = array_to_pointer_conversion (loc, exp.value); | |||
2077 | } | |||
2078 | break; | |||
2079 | case FUNCTION_TYPE: | |||
2080 | exp.value = function_to_pointer_conversion (loc, exp.value); | |||
2081 | break; | |||
2082 | default: | |||
2083 | break; | |||
2084 | } | |||
2085 | ||||
2086 | return exp; | |||
2087 | } | |||
2088 | ||||
2089 | struct c_expr | |||
2090 | default_function_array_read_conversion (location_t loc, struct c_expr exp) | |||
2091 | { | |||
2092 | mark_exp_read (exp.value); | |||
2093 | return default_function_array_conversion (loc, exp); | |||
2094 | } | |||
2095 | ||||
2096 | /* Return whether EXPR should be treated as an atomic lvalue for the | |||
2097 | purposes of load and store handling. */ | |||
2098 | ||||
2099 | static bool | |||
2100 | really_atomic_lvalue (tree expr) | |||
2101 | { | |||
2102 | if (error_operand_p (expr)) | |||
2103 | return false; | |||
2104 | if (!TYPE_ATOMIC (TREE_TYPE (expr))((tree_class_check ((((contains_struct_check ((expr), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2104, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2104, __FUNCTION__))->base.u.bits.atomic_flag)) | |||
2105 | return false; | |||
2106 | if (!lvalue_p (expr)) | |||
2107 | return false; | |||
2108 | ||||
2109 | /* Ignore _Atomic on register variables, since their addresses can't | |||
2110 | be taken so (a) atomicity is irrelevant and (b) the normal atomic | |||
2111 | sequences wouldn't work. Ignore _Atomic on structures containing | |||
2112 | bit-fields, since accessing elements of atomic structures or | |||
2113 | unions is undefined behavior (C11 6.5.2.3#5), but it's unclear if | |||
2114 | it's undefined at translation time or execution time, and the | |||
2115 | normal atomic sequences again wouldn't work. */ | |||
2116 | while (handled_component_p (expr)) | |||
2117 | { | |||
2118 | if (TREE_CODE (expr)((enum tree_code) (expr)->base.code) == COMPONENT_REF | |||
2119 | && DECL_C_BIT_FIELD (TREE_OPERAND (expr, 1))(((contains_struct_check (((tree_check (((*((const_cast<tree *> (tree_operand_check ((expr), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2119, __FUNCTION__)))))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2119, __FUNCTION__, (FIELD_DECL)))), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2119, __FUNCTION__))->decl_common.lang_flag_4) == 1)) | |||
2120 | return false; | |||
2121 | expr = TREE_OPERAND (expr, 0)(*((const_cast<tree*> (tree_operand_check ((expr), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2121, __FUNCTION__))))); | |||
2122 | } | |||
2123 | if (DECL_P (expr)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (expr)->base.code))] == tcc_declaration) && C_DECL_REGISTER (expr)((contains_struct_check ((expr), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2123, __FUNCTION__))->decl_common.lang_flag_4)) | |||
2124 | return false; | |||
2125 | return true; | |||
2126 | } | |||
2127 | ||||
2128 | /* If EXPR is a named constant (C2x) derived from a constexpr variable | |||
2129 | - that is, a reference to such a variable, or a member extracted by | |||
2130 | a sequence of structure and union (but not array) member accesses | |||
2131 | (where union member accesses must access the same member as | |||
2132 | initialized) - then return the corresponding initializer; | |||
2133 | otherwise, return NULL_TREE. */ | |||
2134 | ||||
2135 | static tree | |||
2136 | maybe_get_constexpr_init (tree expr) | |||
2137 | { | |||
2138 | tree decl = NULL_TREE(tree) __null; | |||
2139 | if (TREE_CODE (expr)((enum tree_code) (expr)->base.code) == VAR_DECL) | |||
2140 | decl = expr; | |||
2141 | else if (TREE_CODE (expr)((enum tree_code) (expr)->base.code) == COMPOUND_LITERAL_EXPR) | |||
2142 | decl = COMPOUND_LITERAL_EXPR_DECL (expr)(*((const_cast<tree*> (tree_operand_check (((tree_check (((*((const_cast<tree*> (tree_operand_check (((tree_check ((expr), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2142, __FUNCTION__, (COMPOUND_LITERAL_EXPR)))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2142, __FUNCTION__)))))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2142, __FUNCTION__, (DECL_EXPR)))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2142, __FUNCTION__))))); | |||
2143 | if (decl | |||
2144 | && C_DECL_DECLARED_CONSTEXPR (decl)((contains_struct_check (((tree_check ((decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2144, __FUNCTION__, (VAR_DECL)))), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2144, __FUNCTION__))->decl_common.lang_flag_8) | |||
2145 | && DECL_INITIAL (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2145, __FUNCTION__))->decl_common.initial) != NULL_TREE(tree) __null | |||
2146 | && !error_operand_p (DECL_INITIAL (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2146, __FUNCTION__))->decl_common.initial))) | |||
2147 | return DECL_INITIAL (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2147, __FUNCTION__))->decl_common.initial); | |||
2148 | if (TREE_CODE (expr)((enum tree_code) (expr)->base.code) != COMPONENT_REF) | |||
2149 | return NULL_TREE(tree) __null; | |||
2150 | tree inner = maybe_get_constexpr_init (TREE_OPERAND (expr, 0)(*((const_cast<tree*> (tree_operand_check ((expr), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2150, __FUNCTION__)))))); | |||
2151 | if (inner == NULL_TREE(tree) __null) | |||
2152 | return NULL_TREE(tree) __null; | |||
2153 | while ((CONVERT_EXPR_P (inner)((((enum tree_code) (inner)->base.code)) == NOP_EXPR || (( (enum tree_code) (inner)->base.code)) == CONVERT_EXPR) || TREE_CODE (inner)((enum tree_code) (inner)->base.code) == NON_LVALUE_EXPR) | |||
2154 | && !error_operand_p (inner) | |||
2155 | && (TYPE_MAIN_VARIANT (TREE_TYPE (inner))((tree_class_check ((((contains_struct_check ((inner), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2155, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2155, __FUNCTION__))->type_common.main_variant) | |||
2156 | == TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (inner, 0)))((tree_class_check ((((contains_struct_check (((*((const_cast <tree*> (tree_operand_check ((inner), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2156, __FUNCTION__)))))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2156, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2156, __FUNCTION__))->type_common.main_variant))) | |||
2157 | inner = TREE_OPERAND (inner, 0)(*((const_cast<tree*> (tree_operand_check ((inner), (0) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2157, __FUNCTION__))))); | |||
2158 | if (TREE_CODE (inner)((enum tree_code) (inner)->base.code) != CONSTRUCTOR) | |||
2159 | return NULL_TREE(tree) __null; | |||
2160 | tree field = TREE_OPERAND (expr, 1)(*((const_cast<tree*> (tree_operand_check ((expr), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2160, __FUNCTION__))))); | |||
2161 | unsigned HOST_WIDE_INTlong cidx; | |||
2162 | tree cfield, cvalue; | |||
2163 | bool have_other_init = false; | |||
2164 | FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (inner), cidx, cfield, cvalue)for (cidx = 0; (cidx >= vec_safe_length (((tree_check ((inner ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2164, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))) ? false : (((void) (cvalue = (*((tree_check ((inner), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2164, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[ cidx].value)), (cfield = (*((tree_check ((inner), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2164, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[ cidx].index), true); (cidx)++) | |||
2165 | { | |||
2166 | if (cfield == field) | |||
2167 | return cvalue; | |||
2168 | have_other_init = true; | |||
2169 | } | |||
2170 | if (TREE_CODE (TREE_TYPE (inner))((enum tree_code) (((contains_struct_check ((inner), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2170, __FUNCTION__))->typed.type))->base.code) == UNION_TYPE | |||
2171 | && (have_other_init || field != TYPE_FIELDS (TREE_TYPE (inner))((tree_check3 ((((contains_struct_check ((inner), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2171, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2171, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values))) | |||
2172 | return NULL_TREE(tree) __null; | |||
2173 | /* Return a default initializer. */ | |||
2174 | if (RECORD_OR_UNION_TYPE_P (TREE_TYPE (expr))(((enum tree_code) (((contains_struct_check ((expr), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2174, __FUNCTION__))->typed.type))->base.code) == RECORD_TYPE || ((enum tree_code) (((contains_struct_check ((expr), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2174, __FUNCTION__))->typed.type))->base.code) == UNION_TYPE || ((enum tree_code) (((contains_struct_check ((expr), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2174, __FUNCTION__))->typed.type))->base.code) == QUAL_UNION_TYPE )) | |||
2175 | return build_constructor (TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2175, __FUNCTION__))->typed.type), NULL__null); | |||
2176 | return build_zero_cst (TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2176, __FUNCTION__))->typed.type)); | |||
2177 | } | |||
2178 | ||||
2179 | /* Convert expression EXP (location LOC) from lvalue to rvalue, | |||
2180 | including converting functions and arrays to pointers if CONVERT_P. | |||
2181 | If READ_P, also mark the expression as having been read. If | |||
2182 | FOR_INIT, constexpr expressions of structure and union type should | |||
2183 | be replaced by the corresponding CONSTRUCTOR; otherwise, only | |||
2184 | constexpr scalars (including elements of structures and unions) are | |||
2185 | replaced by their initializers. */ | |||
2186 | ||||
2187 | struct c_expr | |||
2188 | convert_lvalue_to_rvalue (location_t loc, struct c_expr exp, | |||
2189 | bool convert_p, bool read_p, bool for_init) | |||
2190 | { | |||
2191 | bool force_non_npc = false; | |||
2192 | if (read_p) | |||
2193 | mark_exp_read (exp.value); | |||
2194 | if (convert_p) | |||
2195 | exp = default_function_array_conversion (loc, exp); | |||
2196 | if (!VOID_TYPE_P (TREE_TYPE (exp.value))(((enum tree_code) (((contains_struct_check ((exp.value), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2196, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE )) | |||
2197 | exp.value = require_complete_type (loc, exp.value); | |||
2198 | if (for_init || !RECORD_OR_UNION_TYPE_P (TREE_TYPE (exp.value))(((enum tree_code) (((contains_struct_check ((exp.value), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2198, __FUNCTION__))->typed.type))->base.code) == RECORD_TYPE || ((enum tree_code) (((contains_struct_check ((exp.value), ( TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2198, __FUNCTION__))->typed.type))->base.code) == UNION_TYPE || ((enum tree_code) (((contains_struct_check ((exp.value), ( TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2198, __FUNCTION__))->typed.type))->base.code) == QUAL_UNION_TYPE )) | |||
2199 | { | |||
2200 | tree init = maybe_get_constexpr_init (exp.value); | |||
2201 | if (init != NULL_TREE(tree) __null) | |||
2202 | { | |||
2203 | /* A named constant of pointer type or type nullptr_t is not | |||
2204 | a null pointer constant even if the initializer is | |||
2205 | one. */ | |||
2206 | if (TREE_CODE (init)((enum tree_code) (init)->base.code) == INTEGER_CST | |||
2207 | && !INTEGRAL_TYPE_P (TREE_TYPE (init))(((enum tree_code) (((contains_struct_check ((init), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2207, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE || ((enum tree_code) (((contains_struct_check ((init), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2207, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE || ((enum tree_code) (((contains_struct_check ((init), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2207, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE ) | |||
2208 | && integer_zerop (init)) | |||
2209 | force_non_npc = true; | |||
2210 | exp.value = init; | |||
2211 | } | |||
2212 | } | |||
2213 | if (really_atomic_lvalue (exp.value)) | |||
2214 | { | |||
2215 | vec<tree, va_gc> *params; | |||
2216 | tree nonatomic_type, tmp, tmp_addr, fndecl, func_call; | |||
2217 | tree expr_type = TREE_TYPE (exp.value)((contains_struct_check ((exp.value), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2217, __FUNCTION__))->typed.type); | |||
2218 | tree expr_addr = build_unary_op (loc, ADDR_EXPR, exp.value, false); | |||
2219 | tree seq_cst = build_int_cst (integer_type_nodeinteger_types[itk_int], MEMMODEL_SEQ_CST); | |||
2220 | ||||
2221 | gcc_assert (TYPE_ATOMIC (expr_type))((void)(!(((tree_class_check ((expr_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2221, __FUNCTION__))->base.u.bits.atomic_flag)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2221, __FUNCTION__), 0 : 0)); | |||
2222 | ||||
2223 | /* Expansion of a generic atomic load may require an addition | |||
2224 | element, so allocate enough to prevent a resize. */ | |||
2225 | vec_alloc (params, 4); | |||
2226 | ||||
2227 | /* Remove the qualifiers for the rest of the expressions and | |||
2228 | create the VAL temp variable to hold the RHS. */ | |||
2229 | nonatomic_type = build_qualified_type (expr_type, TYPE_UNQUALIFIED); | |||
2230 | tmp = create_tmp_var_raw (nonatomic_type); | |||
2231 | tmp_addr = build_unary_op (loc, ADDR_EXPR, tmp, false); | |||
2232 | TREE_ADDRESSABLE (tmp)((tmp)->base.addressable_flag) = 1; | |||
2233 | /* Do not disable warnings for TMP even though it's artificial. | |||
2234 | -Winvalid-memory-model depends on it. */ | |||
2235 | ||||
2236 | /* Issue __atomic_load (&expr, &tmp, SEQ_CST); */ | |||
2237 | fndecl = builtin_decl_explicit (BUILT_IN_ATOMIC_LOAD); | |||
2238 | params->quick_push (expr_addr); | |||
2239 | params->quick_push (tmp_addr); | |||
2240 | params->quick_push (seq_cst); | |||
2241 | func_call = c_build_function_call_vec (loc, vNULL, fndecl, params, NULL__null); | |||
2242 | ||||
2243 | /* EXPR is always read. */ | |||
2244 | mark_exp_read (exp.value); | |||
2245 | ||||
2246 | /* Return tmp which contains the value loaded. */ | |||
2247 | exp.value = build4 (TARGET_EXPR, nonatomic_type, tmp, func_call, | |||
2248 | NULL_TREE(tree) __null, NULL_TREE(tree) __null); | |||
2249 | } | |||
2250 | if (convert_p && !error_operand_p (exp.value) | |||
2251 | && (TREE_CODE (TREE_TYPE (exp.value))((enum tree_code) (((contains_struct_check ((exp.value), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2251, __FUNCTION__))->typed.type))->base.code) != ARRAY_TYPE)) | |||
2252 | exp.value = convert (build_qualified_type (TREE_TYPE (exp.value)((contains_struct_check ((exp.value), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2252, __FUNCTION__))->typed.type), TYPE_UNQUALIFIED), exp.value); | |||
2253 | if (force_non_npc) | |||
2254 | exp.value = build1 (NOP_EXPR, TREE_TYPE (exp.value)((contains_struct_check ((exp.value), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2254, __FUNCTION__))->typed.type), exp.value); | |||
2255 | return exp; | |||
2256 | } | |||
2257 | ||||
2258 | /* EXP is an expression of integer type. Apply the integer promotions | |||
2259 | to it and return the promoted value. */ | |||
2260 | ||||
2261 | tree | |||
2262 | perform_integral_promotions (tree exp) | |||
2263 | { | |||
2264 | tree type = TREE_TYPE (exp)((contains_struct_check ((exp), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2264, __FUNCTION__))->typed.type); | |||
2265 | enum tree_code code = TREE_CODE (type)((enum tree_code) (type)->base.code); | |||
2266 | ||||
2267 | gcc_assert (INTEGRAL_TYPE_P (type))((void)(!((((enum tree_code) (type)->base.code) == ENUMERAL_TYPE || ((enum tree_code) (type)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type)->base.code) == INTEGER_TYPE)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2267, __FUNCTION__), 0 : 0)); | |||
2268 | ||||
2269 | /* Convert enums to the result of applying the integer promotions to | |||
2270 | their underlying type. */ | |||
2271 | if (code == ENUMERAL_TYPE) | |||
2272 | { | |||
2273 | type = ENUM_UNDERLYING_TYPE (type)((contains_struct_check (((tree_check ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2273, __FUNCTION__, (ENUMERAL_TYPE)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2273, __FUNCTION__))->typed.type); | |||
2274 | if (c_promoting_integer_type_p (type)) | |||
2275 | { | |||
2276 | if (TYPE_UNSIGNED (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2276, __FUNCTION__))->base.u.bits.unsigned_flag) | |||
2277 | && TYPE_PRECISION (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2277, __FUNCTION__))->type_common.precision) == TYPE_PRECISION (integer_type_node)((tree_class_check ((integer_types[itk_int]), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2277, __FUNCTION__))->type_common.precision)) | |||
2278 | type = unsigned_type_nodeinteger_types[itk_unsigned_int]; | |||
2279 | else | |||
2280 | type = integer_type_nodeinteger_types[itk_int]; | |||
2281 | } | |||
2282 | ||||
2283 | return convert (type, exp); | |||
2284 | } | |||
2285 | ||||
2286 | /* ??? This should no longer be needed now bit-fields have their | |||
2287 | proper types. */ | |||
2288 | if (TREE_CODE (exp)((enum tree_code) (exp)->base.code) == COMPONENT_REF | |||
2289 | && DECL_C_BIT_FIELD (TREE_OPERAND (exp, 1))(((contains_struct_check (((tree_check (((*((const_cast<tree *> (tree_operand_check ((exp), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2289, __FUNCTION__)))))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2289, __FUNCTION__, (FIELD_DECL)))), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2289, __FUNCTION__))->decl_common.lang_flag_4) == 1) | |||
2290 | /* If it's thinner than an int, promote it like a | |||
2291 | c_promoting_integer_type_p, otherwise leave it alone. */ | |||
2292 | && compare_tree_int (DECL_SIZE (TREE_OPERAND (exp, 1))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check ((exp), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2292, __FUNCTION__)))))), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2292, __FUNCTION__))->decl_common.size), | |||
2293 | TYPE_PRECISION (integer_type_node)((tree_class_check ((integer_types[itk_int]), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2293, __FUNCTION__))->type_common.precision)) < 0) | |||
2294 | return convert (integer_type_nodeinteger_types[itk_int], exp); | |||
2295 | ||||
2296 | if (c_promoting_integer_type_p (type)) | |||
2297 | { | |||
2298 | /* Preserve unsignedness if not really getting any wider. */ | |||
2299 | if (TYPE_UNSIGNED (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2299, __FUNCTION__))->base.u.bits.unsigned_flag) | |||
2300 | && TYPE_PRECISION (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2300, __FUNCTION__))->type_common.precision) == TYPE_PRECISION (integer_type_node)((tree_class_check ((integer_types[itk_int]), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2300, __FUNCTION__))->type_common.precision)) | |||
2301 | return convert (unsigned_type_nodeinteger_types[itk_unsigned_int], exp); | |||
2302 | ||||
2303 | return convert (integer_type_nodeinteger_types[itk_int], exp); | |||
2304 | } | |||
2305 | ||||
2306 | return exp; | |||
2307 | } | |||
2308 | ||||
2309 | ||||
2310 | /* Perform default promotions for C data used in expressions. | |||
2311 | Enumeral types or short or char are converted to int. | |||
2312 | In addition, manifest constants symbols are replaced by their values. */ | |||
2313 | ||||
2314 | tree | |||
2315 | default_conversion (tree exp) | |||
2316 | { | |||
2317 | tree orig_exp; | |||
2318 | tree type = TREE_TYPE (exp)((contains_struct_check ((exp), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2318, __FUNCTION__))->typed.type); | |||
2319 | enum tree_code code = TREE_CODE (type)((enum tree_code) (type)->base.code); | |||
2320 | tree promoted_type; | |||
2321 | ||||
2322 | mark_exp_read (exp); | |||
2323 | ||||
2324 | /* Functions and arrays have been converted during parsing. */ | |||
2325 | gcc_assert (code != FUNCTION_TYPE)((void)(!(code != FUNCTION_TYPE) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2325, __FUNCTION__), 0 : 0)); | |||
2326 | if (code == ARRAY_TYPE) | |||
2327 | return exp; | |||
2328 | ||||
2329 | /* Constants can be used directly unless they're not loadable. */ | |||
2330 | if (TREE_CODE (exp)((enum tree_code) (exp)->base.code) == CONST_DECL) | |||
2331 | exp = DECL_INITIAL (exp)((contains_struct_check ((exp), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2331, __FUNCTION__))->decl_common.initial); | |||
2332 | ||||
2333 | /* Strip no-op conversions. */ | |||
2334 | orig_exp = exp; | |||
2335 | STRIP_TYPE_NOPS (exp)while ((((((enum tree_code) (exp)->base.code)) == NOP_EXPR || (((enum tree_code) (exp)->base.code)) == CONVERT_EXPR) || ((enum tree_code) (exp)->base.code) == NON_LVALUE_EXPR ) && (*((const_cast<tree*> (tree_operand_check ( (exp), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2335, __FUNCTION__))))) != global_trees[TI_ERROR_MARK] && (((contains_struct_check ((exp), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2335, __FUNCTION__))->typed.type) == ((contains_struct_check (((*((const_cast<tree*> (tree_operand_check ((exp), (0 ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2335, __FUNCTION__)))))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2335, __FUNCTION__))->typed.type))) (exp) = (*((const_cast <tree*> (tree_operand_check ((exp), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2335, __FUNCTION__))))); | |||
2336 | ||||
2337 | copy_warning (exp, orig_exp); | |||
2338 | ||||
2339 | if (code == VOID_TYPE) | |||
2340 | { | |||
2341 | error_at (EXPR_LOC_OR_LOC (exp, input_location)((((IS_ADHOC_LOC (((((exp)) && ((tree_code_type_tmpl < 0>::tree_code_type[(int) (((enum tree_code) ((exp))->base .code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) ((exp))-> base.code))]) <= tcc_expression)) ? (exp)->exp.locus : ( (location_t) 0)))) ? get_location_from_adhoc_loc (line_table, ((((exp)) && ((tree_code_type_tmpl <0>::tree_code_type [(int) (((enum tree_code) ((exp))->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) ((exp))->base.code))]) <= tcc_expression )) ? (exp)->exp.locus : ((location_t) 0))) : (((((exp)) && ((tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) ((exp))->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) ((exp))->base.code))]) <= tcc_expression)) ? (exp)->exp.locus : ((location_t) 0)))) != ((location_t) 0 )) ? (exp)->exp.locus : (input_location)), | |||
2342 | "void value not ignored as it ought to be"); | |||
2343 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
2344 | } | |||
2345 | ||||
2346 | exp = require_complete_type (EXPR_LOC_OR_LOC (exp, input_location)((((IS_ADHOC_LOC (((((exp)) && ((tree_code_type_tmpl < 0>::tree_code_type[(int) (((enum tree_code) ((exp))->base .code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) ((exp))-> base.code))]) <= tcc_expression)) ? (exp)->exp.locus : ( (location_t) 0)))) ? get_location_from_adhoc_loc (line_table, ((((exp)) && ((tree_code_type_tmpl <0>::tree_code_type [(int) (((enum tree_code) ((exp))->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) ((exp))->base.code))]) <= tcc_expression )) ? (exp)->exp.locus : ((location_t) 0))) : (((((exp)) && ((tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) ((exp))->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) ((exp))->base.code))]) <= tcc_expression)) ? (exp)->exp.locus : ((location_t) 0)))) != ((location_t) 0 )) ? (exp)->exp.locus : (input_location)), exp); | |||
2347 | if (exp == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
2348 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
2349 | ||||
2350 | promoted_type = targetm.promoted_type (type); | |||
2351 | if (promoted_type) | |||
2352 | return convert (promoted_type, exp); | |||
2353 | ||||
2354 | if (INTEGRAL_TYPE_P (type)(((enum tree_code) (type)->base.code) == ENUMERAL_TYPE || ( (enum tree_code) (type)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type)->base.code) == INTEGER_TYPE)) | |||
2355 | return perform_integral_promotions (exp); | |||
2356 | ||||
2357 | return exp; | |||
2358 | } | |||
2359 | ||||
2360 | /* Look up COMPONENT in a structure or union TYPE. | |||
2361 | ||||
2362 | If the component name is not found, returns NULL_TREE. Otherwise, | |||
2363 | the return value is a TREE_LIST, with each TREE_VALUE a FIELD_DECL | |||
2364 | stepping down the chain to the component, which is in the last | |||
2365 | TREE_VALUE of the list. Normally the list is of length one, but if | |||
2366 | the component is embedded within (nested) anonymous structures or | |||
2367 | unions, the list steps down the chain to the component. */ | |||
2368 | ||||
2369 | static tree | |||
2370 | lookup_field (tree type, tree component) | |||
2371 | { | |||
2372 | tree field; | |||
2373 | ||||
2374 | /* If TYPE_LANG_SPECIFIC is set, then it is a sorted array of pointers | |||
2375 | to the field elements. Use a binary search on this array to quickly | |||
2376 | find the element. Otherwise, do a linear search. TYPE_LANG_SPECIFIC | |||
2377 | will always be set for structures which have many elements. | |||
2378 | ||||
2379 | Duplicate field checking replaces duplicates with NULL_TREE so | |||
2380 | TYPE_LANG_SPECIFIC arrays are potentially no longer sorted. In that | |||
2381 | case just iterate using DECL_CHAIN. */ | |||
2382 | ||||
2383 | if (TYPE_LANG_SPECIFIC (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2383, __FUNCTION__))->type_with_lang_specific.lang_specific ) && TYPE_LANG_SPECIFIC (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2383, __FUNCTION__))->type_with_lang_specific.lang_specific )->s | |||
2384 | && !seen_error ()) | |||
2385 | { | |||
2386 | int bot, top, half; | |||
2387 | tree *field_array = &TYPE_LANG_SPECIFIC (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2387, __FUNCTION__))->type_with_lang_specific.lang_specific )->s->elts[0]; | |||
2388 | ||||
2389 | field = TYPE_FIELDS (type)((tree_check3 ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2389, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); | |||
2390 | bot = 0; | |||
2391 | top = TYPE_LANG_SPECIFIC (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2391, __FUNCTION__))->type_with_lang_specific.lang_specific )->s->len; | |||
2392 | while (top - bot > 1) | |||
2393 | { | |||
2394 | half = (top - bot + 1) >> 1; | |||
2395 | field = field_array[bot+half]; | |||
2396 | ||||
2397 | if (DECL_NAME (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2397, __FUNCTION__))->decl_minimal.name) == NULL_TREE(tree) __null) | |||
2398 | { | |||
2399 | /* Step through all anon unions in linear fashion. */ | |||
2400 | while (DECL_NAME (field_array[bot])((contains_struct_check ((field_array[bot]), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2400, __FUNCTION__))->decl_minimal.name) == NULL_TREE(tree) __null) | |||
2401 | { | |||
2402 | field = field_array[bot++]; | |||
2403 | if (RECORD_OR_UNION_TYPE_P (TREE_TYPE (field))(((enum tree_code) (((contains_struct_check ((field), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2403, __FUNCTION__))->typed.type))->base.code) == RECORD_TYPE || ((enum tree_code) (((contains_struct_check ((field), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2403, __FUNCTION__))->typed.type))->base.code) == UNION_TYPE || ((enum tree_code) (((contains_struct_check ((field), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2403, __FUNCTION__))->typed.type))->base.code) == QUAL_UNION_TYPE )) | |||
2404 | { | |||
2405 | tree anon = lookup_field (TREE_TYPE (field)((contains_struct_check ((field), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2405, __FUNCTION__))->typed.type), component); | |||
2406 | ||||
2407 | if (anon) | |||
2408 | return tree_cons (NULL_TREE(tree) __null, field, anon); | |||
2409 | ||||
2410 | /* The Plan 9 compiler permits referring | |||
2411 | directly to an anonymous struct/union field | |||
2412 | using a typedef name. */ | |||
2413 | if (flag_plan9_extensionsglobal_options.x_flag_plan9_extensions | |||
2414 | && TYPE_NAME (TREE_TYPE (field))((tree_class_check ((((contains_struct_check ((field), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2414, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2414, __FUNCTION__))->type_common.name) != NULL_TREE(tree) __null | |||
2415 | && (TREE_CODE (TYPE_NAME (TREE_TYPE (field)))((enum tree_code) (((tree_class_check ((((contains_struct_check ((field), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2415, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2415, __FUNCTION__))->type_common.name))->base.code) | |||
2416 | == TYPE_DECL) | |||
2417 | && (DECL_NAME (TYPE_NAME (TREE_TYPE (field)))((contains_struct_check ((((tree_class_check ((((contains_struct_check ((field), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2417, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2417, __FUNCTION__))->type_common.name)), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2417, __FUNCTION__))->decl_minimal.name) | |||
2418 | == component)) | |||
2419 | break; | |||
2420 | } | |||
2421 | } | |||
2422 | ||||
2423 | /* Entire record is only anon unions. */ | |||
2424 | if (bot > top) | |||
2425 | return NULL_TREE(tree) __null; | |||
2426 | ||||
2427 | /* Restart the binary search, with new lower bound. */ | |||
2428 | continue; | |||
2429 | } | |||
2430 | ||||
2431 | if (DECL_NAME (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2431, __FUNCTION__))->decl_minimal.name) == component) | |||
2432 | break; | |||
2433 | if (DECL_NAME (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2433, __FUNCTION__))->decl_minimal.name) < component) | |||
2434 | bot += half; | |||
2435 | else | |||
2436 | top = bot + half; | |||
2437 | } | |||
2438 | ||||
2439 | if (DECL_NAME (field_array[bot])((contains_struct_check ((field_array[bot]), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2439, __FUNCTION__))->decl_minimal.name) == component) | |||
2440 | field = field_array[bot]; | |||
2441 | else if (DECL_NAME (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2441, __FUNCTION__))->decl_minimal.name) != component) | |||
2442 | return NULL_TREE(tree) __null; | |||
2443 | } | |||
2444 | else | |||
2445 | { | |||
2446 | for (field = TYPE_FIELDS (type)((tree_check3 ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2446, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); field; field = DECL_CHAIN (field)(((contains_struct_check (((contains_struct_check ((field), ( TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2446, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2446, __FUNCTION__))->common.chain))) | |||
2447 | { | |||
2448 | if (DECL_NAME (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2448, __FUNCTION__))->decl_minimal.name) == NULL_TREE(tree) __null | |||
2449 | && RECORD_OR_UNION_TYPE_P (TREE_TYPE (field))(((enum tree_code) (((contains_struct_check ((field), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2449, __FUNCTION__))->typed.type))->base.code) == RECORD_TYPE || ((enum tree_code) (((contains_struct_check ((field), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2449, __FUNCTION__))->typed.type))->base.code) == UNION_TYPE || ((enum tree_code) (((contains_struct_check ((field), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2449, __FUNCTION__))->typed.type))->base.code) == QUAL_UNION_TYPE )) | |||
2450 | { | |||
2451 | tree anon = lookup_field (TREE_TYPE (field)((contains_struct_check ((field), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2451, __FUNCTION__))->typed.type), component); | |||
2452 | ||||
2453 | if (anon) | |||
2454 | return tree_cons (NULL_TREE(tree) __null, field, anon); | |||
2455 | ||||
2456 | /* The Plan 9 compiler permits referring directly to an | |||
2457 | anonymous struct/union field using a typedef | |||
2458 | name. */ | |||
2459 | if (flag_plan9_extensionsglobal_options.x_flag_plan9_extensions | |||
2460 | && TYPE_NAME (TREE_TYPE (field))((tree_class_check ((((contains_struct_check ((field), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2460, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2460, __FUNCTION__))->type_common.name) != NULL_TREE(tree) __null | |||
2461 | && TREE_CODE (TYPE_NAME (TREE_TYPE (field)))((enum tree_code) (((tree_class_check ((((contains_struct_check ((field), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2461, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2461, __FUNCTION__))->type_common.name))->base.code) == TYPE_DECL | |||
2462 | && (DECL_NAME (TYPE_NAME (TREE_TYPE (field)))((contains_struct_check ((((tree_class_check ((((contains_struct_check ((field), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2462, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2462, __FUNCTION__))->type_common.name)), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2462, __FUNCTION__))->decl_minimal.name) | |||
2463 | == component)) | |||
2464 | break; | |||
2465 | } | |||
2466 | ||||
2467 | if (DECL_NAME (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2467, __FUNCTION__))->decl_minimal.name) == component) | |||
2468 | break; | |||
2469 | } | |||
2470 | ||||
2471 | if (field == NULL_TREE(tree) __null) | |||
2472 | return NULL_TREE(tree) __null; | |||
2473 | } | |||
2474 | ||||
2475 | return tree_cons (NULL_TREE(tree) __null, field, NULL_TREE(tree) __null); | |||
2476 | } | |||
2477 | ||||
2478 | /* Recursively append candidate IDENTIFIER_NODEs to CANDIDATES. */ | |||
2479 | ||||
2480 | static void | |||
2481 | lookup_field_fuzzy_find_candidates (tree type, tree component, | |||
2482 | vec<tree> *candidates) | |||
2483 | { | |||
2484 | tree field; | |||
2485 | for (field = TYPE_FIELDS (type)((tree_check3 ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2485, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); field; field = DECL_CHAIN (field)(((contains_struct_check (((contains_struct_check ((field), ( TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2485, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2485, __FUNCTION__))->common.chain))) | |||
2486 | { | |||
2487 | if (DECL_NAME (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2487, __FUNCTION__))->decl_minimal.name) == NULL_TREE(tree) __null | |||
2488 | && RECORD_OR_UNION_TYPE_P (TREE_TYPE (field))(((enum tree_code) (((contains_struct_check ((field), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2488, __FUNCTION__))->typed.type))->base.code) == RECORD_TYPE || ((enum tree_code) (((contains_struct_check ((field), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2488, __FUNCTION__))->typed.type))->base.code) == UNION_TYPE || ((enum tree_code) (((contains_struct_check ((field), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2488, __FUNCTION__))->typed.type))->base.code) == QUAL_UNION_TYPE )) | |||
2489 | lookup_field_fuzzy_find_candidates (TREE_TYPE (field)((contains_struct_check ((field), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2489, __FUNCTION__))->typed.type), component, | |||
2490 | candidates); | |||
2491 | ||||
2492 | if (DECL_NAME (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2492, __FUNCTION__))->decl_minimal.name)) | |||
2493 | candidates->safe_push (DECL_NAME (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2493, __FUNCTION__))->decl_minimal.name)); | |||
2494 | } | |||
2495 | } | |||
2496 | ||||
2497 | /* Like "lookup_field", but find the closest matching IDENTIFIER_NODE, | |||
2498 | rather than returning a TREE_LIST for an exact match. */ | |||
2499 | ||||
2500 | static tree | |||
2501 | lookup_field_fuzzy (tree type, tree component) | |||
2502 | { | |||
2503 | gcc_assert (TREE_CODE (component) == IDENTIFIER_NODE)((void)(!(((enum tree_code) (component)->base.code) == IDENTIFIER_NODE ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2503, __FUNCTION__), 0 : 0)); | |||
2504 | ||||
2505 | /* First, gather a list of candidates. */ | |||
2506 | auto_vec <tree> candidates; | |||
2507 | ||||
2508 | lookup_field_fuzzy_find_candidates (type, component, | |||
2509 | &candidates); | |||
2510 | ||||
2511 | return find_closest_identifier (component, &candidates); | |||
2512 | } | |||
2513 | ||||
2514 | /* Support function for build_component_ref's error-handling. | |||
2515 | ||||
2516 | Given DATUM_TYPE, and "DATUM.COMPONENT", where DATUM is *not* a | |||
2517 | struct or union, should we suggest "DATUM->COMPONENT" as a hint? */ | |||
2518 | ||||
2519 | static bool | |||
2520 | should_suggest_deref_p (tree datum_type) | |||
2521 | { | |||
2522 | /* We don't do it for Objective-C, since Objective-C 2.0 dot-syntax | |||
2523 | allows "." for ptrs; we could be handling a failed attempt | |||
2524 | to access a property. */ | |||
2525 | if (c_dialect_objc ()((c_language & clk_objc) != 0)) | |||
2526 | return false; | |||
2527 | ||||
2528 | /* Only suggest it for pointers... */ | |||
2529 | if (TREE_CODE (datum_type)((enum tree_code) (datum_type)->base.code) != POINTER_TYPE) | |||
2530 | return false; | |||
2531 | ||||
2532 | /* ...to structs/unions. */ | |||
2533 | tree underlying_type = TREE_TYPE (datum_type)((contains_struct_check ((datum_type), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2533, __FUNCTION__))->typed.type); | |||
2534 | enum tree_code code = TREE_CODE (underlying_type)((enum tree_code) (underlying_type)->base.code); | |||
2535 | if (code == RECORD_TYPE || code == UNION_TYPE) | |||
2536 | return true; | |||
2537 | else | |||
2538 | return false; | |||
2539 | } | |||
2540 | ||||
2541 | /* Make an expression to refer to the COMPONENT field of structure or | |||
2542 | union value DATUM. COMPONENT is an IDENTIFIER_NODE. LOC is the | |||
2543 | location of the COMPONENT_REF. COMPONENT_LOC is the location | |||
2544 | of COMPONENT. ARROW_LOC is the location of the first -> operand if | |||
2545 | it is from -> operator. */ | |||
2546 | ||||
2547 | tree | |||
2548 | build_component_ref (location_t loc, tree datum, tree component, | |||
2549 | location_t component_loc, location_t arrow_loc) | |||
2550 | { | |||
2551 | tree type = TREE_TYPE (datum)((contains_struct_check ((datum), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2551, __FUNCTION__))->typed.type); | |||
2552 | enum tree_code code = TREE_CODE (type)((enum tree_code) (type)->base.code); | |||
2553 | tree field = NULL__null; | |||
2554 | tree ref; | |||
2555 | bool datum_lvalue = lvalue_p (datum); | |||
2556 | ||||
2557 | if (!objc_is_public (datum, component)) | |||
2558 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
2559 | ||||
2560 | /* Detect Objective-C property syntax object.property. */ | |||
2561 | if (c_dialect_objc ()((c_language & clk_objc) != 0) | |||
2562 | && (ref = objc_maybe_build_component_ref (datum, component))) | |||
2563 | return ref; | |||
2564 | ||||
2565 | /* See if there is a field or component with name COMPONENT. */ | |||
2566 | ||||
2567 | if (code == RECORD_TYPE || code == UNION_TYPE) | |||
2568 | { | |||
2569 | if (!COMPLETE_TYPE_P (type)(((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2569, __FUNCTION__))->type_common.size) != (tree) __null )) | |||
2570 | { | |||
2571 | c_incomplete_type_error (loc, NULL_TREE(tree) __null, type); | |||
2572 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
2573 | } | |||
2574 | ||||
2575 | field = lookup_field (type, component); | |||
2576 | ||||
2577 | if (!field) | |||
2578 | { | |||
2579 | tree guessed_id = lookup_field_fuzzy (type, component); | |||
2580 | if (guessed_id) | |||
2581 | { | |||
2582 | /* Attempt to provide a fixit replacement hint, if | |||
2583 | we have a valid range for the component. */ | |||
2584 | location_t reported_loc | |||
2585 | = (component_loc != UNKNOWN_LOCATION((location_t) 0)) ? component_loc : loc; | |||
2586 | gcc_rich_location rich_loc (reported_loc); | |||
2587 | if (component_loc != UNKNOWN_LOCATION((location_t) 0)) | |||
2588 | rich_loc.add_fixit_misspelled_id (component_loc, guessed_id); | |||
2589 | error_at (&rich_loc, | |||
2590 | "%qT has no member named %qE; did you mean %qE?", | |||
2591 | type, component, guessed_id); | |||
2592 | } | |||
2593 | else | |||
2594 | error_at (loc, "%qT has no member named %qE", type, component); | |||
2595 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
2596 | } | |||
2597 | ||||
2598 | /* Accessing elements of atomic structures or unions is undefined | |||
2599 | behavior (C11 6.5.2.3#5). */ | |||
2600 | if (TYPE_ATOMIC (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2600, __FUNCTION__))->base.u.bits.atomic_flag) && c_inhibit_evaluation_warnings == 0) | |||
2601 | { | |||
2602 | if (code == RECORD_TYPE) | |||
2603 | warning_at (loc, 0, "accessing a member %qE of an atomic " | |||
2604 | "structure %qE", component, datum); | |||
2605 | else | |||
2606 | warning_at (loc, 0, "accessing a member %qE of an atomic " | |||
2607 | "union %qE", component, datum); | |||
2608 | } | |||
2609 | ||||
2610 | /* Chain the COMPONENT_REFs if necessary down to the FIELD. | |||
2611 | This might be better solved in future the way the C++ front | |||
2612 | end does it - by giving the anonymous entities each a | |||
2613 | separate name and type, and then have build_component_ref | |||
2614 | recursively call itself. We can't do that here. */ | |||
2615 | do | |||
2616 | { | |||
2617 | tree subdatum = TREE_VALUE (field)((tree_check ((field), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2617, __FUNCTION__, (TREE_LIST)))->list.value); | |||
2618 | int quals; | |||
2619 | tree subtype; | |||
2620 | bool use_datum_quals; | |||
2621 | ||||
2622 | if (TREE_TYPE (subdatum)((contains_struct_check ((subdatum), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2622, __FUNCTION__))->typed.type) == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
2623 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
2624 | ||||
2625 | /* If this is an rvalue, it does not have qualifiers in C | |||
2626 | standard terms and we must avoid propagating such | |||
2627 | qualifiers down to a non-lvalue array that is then | |||
2628 | converted to a pointer. */ | |||
2629 | use_datum_quals = (datum_lvalue | |||
2630 | || TREE_CODE (TREE_TYPE (subdatum))((enum tree_code) (((contains_struct_check ((subdatum), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2630, __FUNCTION__))->typed.type))->base.code) != ARRAY_TYPE); | |||
2631 | ||||
2632 | quals = TYPE_QUALS (strip_array_types (TREE_TYPE (subdatum)))((int) ((((tree_class_check ((strip_array_types (((contains_struct_check ((subdatum), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2632, __FUNCTION__))->typed.type))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2632, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((strip_array_types (((contains_struct_check ((subdatum), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2632, __FUNCTION__))->typed.type))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2632, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((strip_array_types (((contains_struct_check ((subdatum), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2632, __FUNCTION__))->typed.type))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2632, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((strip_array_types (((contains_struct_check ((subdatum), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2632, __FUNCTION__))->typed.type))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2632, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ) | (((((tree_class_check ((strip_array_types (((contains_struct_check ((subdatum), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2632, __FUNCTION__))->typed.type))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2632, __FUNCTION__))->base.u.bits.address_space) & 0xFF ) << 8)))); | |||
2633 | if (use_datum_quals) | |||
2634 | quals |= TYPE_QUALS (TREE_TYPE (datum))((int) ((((tree_class_check ((((contains_struct_check ((datum ), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2634, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2634, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((((contains_struct_check ((datum), ( TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2634, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2634, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((((contains_struct_check ((datum), ( TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2634, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2634, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((((contains_struct_check ((datum), ( TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2634, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2634, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ) | (((((tree_class_check ((((contains_struct_check ((datum), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2634, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2634, __FUNCTION__))->base.u.bits.address_space) & 0xFF ) << 8)))); | |||
2635 | subtype = c_build_qualified_type (TREE_TYPE (subdatum)((contains_struct_check ((subdatum), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2635, __FUNCTION__))->typed.type), quals); | |||
2636 | ||||
2637 | ref = build3 (COMPONENT_REF, subtype, datum, subdatum, | |||
2638 | NULL_TREE(tree) __null); | |||
2639 | SET_EXPR_LOCATION (ref, loc)(expr_check (((ref)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2639, __FUNCTION__))->exp.locus = (loc); | |||
2640 | if (TREE_READONLY (subdatum)((non_type_check ((subdatum), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2640, __FUNCTION__))->base.readonly_flag) | |||
2641 | || (use_datum_quals && TREE_READONLY (datum)((non_type_check ((datum), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2641, __FUNCTION__))->base.readonly_flag))) | |||
2642 | TREE_READONLY (ref)((non_type_check ((ref), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2642, __FUNCTION__))->base.readonly_flag) = 1; | |||
2643 | if (TREE_THIS_VOLATILE (subdatum)((subdatum)->base.volatile_flag) | |||
2644 | || (use_datum_quals && TREE_THIS_VOLATILE (datum)((datum)->base.volatile_flag))) | |||
2645 | TREE_THIS_VOLATILE (ref)((ref)->base.volatile_flag) = 1; | |||
2646 | ||||
2647 | if (TREE_UNAVAILABLE (subdatum)((subdatum)->base.u.bits.unavailable_flag)) | |||
2648 | error_unavailable_use (subdatum, NULL_TREE(tree) __null); | |||
2649 | else if (TREE_DEPRECATED (subdatum)((subdatum)->base.deprecated_flag)) | |||
2650 | warn_deprecated_use (subdatum, NULL_TREE(tree) __null); | |||
2651 | ||||
2652 | datum = ref; | |||
2653 | ||||
2654 | field = TREE_CHAIN (field)((contains_struct_check ((field), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2654, __FUNCTION__))->common.chain); | |||
2655 | } | |||
2656 | while (field); | |||
2657 | ||||
2658 | return ref; | |||
2659 | } | |||
2660 | else if (should_suggest_deref_p (type)) | |||
2661 | { | |||
2662 | /* Special-case the error message for "ptr.field" for the case | |||
2663 | where the user has confused "." vs "->". */ | |||
2664 | rich_location richloc (line_table, loc); | |||
2665 | if (TREE_CODE (datum)((enum tree_code) (datum)->base.code) == INDIRECT_REF && arrow_loc != UNKNOWN_LOCATION((location_t) 0)) | |||
2666 | { | |||
2667 | richloc.add_fixit_insert_before (arrow_loc, "(*"); | |||
2668 | richloc.add_fixit_insert_after (arrow_loc, ")"); | |||
2669 | error_at (&richloc, | |||
2670 | "%qE is a pointer to pointer; did you mean to dereference " | |||
2671 | "it before applying %<->%> to it?", | |||
2672 | TREE_OPERAND (datum, 0)(*((const_cast<tree*> (tree_operand_check ((datum), (0) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2672, __FUNCTION__)))))); | |||
2673 | } | |||
2674 | else | |||
2675 | { | |||
2676 | /* "loc" should be the "." token. */ | |||
2677 | richloc.add_fixit_replace ("->"); | |||
2678 | error_at (&richloc, | |||
2679 | "%qE is a pointer; did you mean to use %<->%>?", | |||
2680 | datum); | |||
2681 | } | |||
2682 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
2683 | } | |||
2684 | else if (code != ERROR_MARK) | |||
2685 | error_at (loc, | |||
2686 | "request for member %qE in something not a structure or union", | |||
2687 | component); | |||
2688 | ||||
2689 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
2690 | } | |||
2691 | ||||
2692 | /* Given an expression PTR for a pointer, return an expression | |||
2693 | for the value pointed to. | |||
2694 | ERRORSTRING is the name of the operator to appear in error messages. | |||
2695 | ||||
2696 | LOC is the location to use for the generated tree. */ | |||
2697 | ||||
2698 | tree | |||
2699 | build_indirect_ref (location_t loc, tree ptr, ref_operator errstring) | |||
2700 | { | |||
2701 | tree pointer = default_conversion (ptr); | |||
2702 | tree type = TREE_TYPE (pointer)((contains_struct_check ((pointer), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2702, __FUNCTION__))->typed.type); | |||
2703 | tree ref; | |||
2704 | ||||
2705 | if (TREE_CODE (type)((enum tree_code) (type)->base.code) == POINTER_TYPE) | |||
2706 | { | |||
2707 | if (CONVERT_EXPR_P (pointer)((((enum tree_code) (pointer)->base.code)) == NOP_EXPR || ( ((enum tree_code) (pointer)->base.code)) == CONVERT_EXPR) | |||
2708 | || TREE_CODE (pointer)((enum tree_code) (pointer)->base.code) == VIEW_CONVERT_EXPR) | |||
2709 | { | |||
2710 | /* If a warning is issued, mark it to avoid duplicates from | |||
2711 | the backend. This only needs to be done at | |||
2712 | warn_strict_aliasing > 2. */ | |||
2713 | if (warn_strict_aliasingglobal_options.x_warn_strict_aliasing > 2) | |||
2714 | if (strict_aliasing_warning (EXPR_LOCATION (pointer)((((pointer)) && ((tree_code_type_tmpl <0>::tree_code_type [(int) (((enum tree_code) ((pointer))->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type [(int) (((enum tree_code) ((pointer))->base.code))]) <= tcc_expression)) ? (pointer)->exp.locus : ((location_t) 0 )), | |||
2715 | type, TREE_OPERAND (pointer, 0)(*((const_cast<tree*> (tree_operand_check ((pointer), ( 0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2715, __FUNCTION__))))))) | |||
2716 | suppress_warning (pointer, OPT_Wstrict_aliasing_); | |||
2717 | } | |||
2718 | ||||
2719 | if (TREE_CODE (pointer)((enum tree_code) (pointer)->base.code) == ADDR_EXPR | |||
2720 | && (TREE_TYPE (TREE_OPERAND (pointer, 0))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check ((pointer), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2720, __FUNCTION__)))))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2720, __FUNCTION__))->typed.type) | |||
2721 | == TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2721, __FUNCTION__))->typed.type))) | |||
2722 | { | |||
2723 | ref = TREE_OPERAND (pointer, 0)(*((const_cast<tree*> (tree_operand_check ((pointer), ( 0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2723, __FUNCTION__))))); | |||
2724 | protected_set_expr_location (ref, loc); | |||
2725 | return ref; | |||
2726 | } | |||
2727 | else | |||
2728 | { | |||
2729 | tree t = TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2729, __FUNCTION__))->typed.type); | |||
2730 | ||||
2731 | ref = build1 (INDIRECT_REF, t, pointer); | |||
2732 | ||||
2733 | if (VOID_TYPE_P (t)(((enum tree_code) (t)->base.code) == VOID_TYPE) && c_inhibit_evaluation_warnings == 0) | |||
2734 | warning_at (loc, 0, "dereferencing %<void *%> pointer"); | |||
2735 | ||||
2736 | /* We *must* set TREE_READONLY when dereferencing a pointer to const, | |||
2737 | so that we get the proper error message if the result is used | |||
2738 | to assign to. Also, &* is supposed to be a no-op. | |||
2739 | And ANSI C seems to specify that the type of the result | |||
2740 | should be the const type. */ | |||
2741 | /* A de-reference of a pointer to const is not a const. It is valid | |||
2742 | to change it via some other pointer. */ | |||
2743 | TREE_READONLY (ref)((non_type_check ((ref), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2743, __FUNCTION__))->base.readonly_flag) = TYPE_READONLY (t)((tree_class_check ((t), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2743, __FUNCTION__))->base.readonly_flag); | |||
2744 | TREE_SIDE_EFFECTS (ref)((non_type_check ((ref), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2744, __FUNCTION__))->base.side_effects_flag) | |||
2745 | = TYPE_VOLATILE (t)((tree_class_check ((t), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2745, __FUNCTION__))->base.volatile_flag) || TREE_SIDE_EFFECTS (pointer)((non_type_check ((pointer), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2745, __FUNCTION__))->base.side_effects_flag); | |||
2746 | TREE_THIS_VOLATILE (ref)((ref)->base.volatile_flag) = TYPE_VOLATILE (t)((tree_class_check ((t), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2746, __FUNCTION__))->base.volatile_flag); | |||
2747 | protected_set_expr_location (ref, loc); | |||
2748 | return ref; | |||
2749 | } | |||
2750 | } | |||
2751 | else if (TREE_CODE (pointer)((enum tree_code) (pointer)->base.code) != ERROR_MARK) | |||
2752 | invalid_indirection_error (loc, type, errstring); | |||
2753 | ||||
2754 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
2755 | } | |||
2756 | ||||
2757 | /* This handles expressions of the form "a[i]", which denotes | |||
2758 | an array reference. | |||
2759 | ||||
2760 | This is logically equivalent in C to *(a+i), but we may do it differently. | |||
2761 | If A is a variable or a member, we generate a primitive ARRAY_REF. | |||
2762 | This avoids forcing the array out of registers, and can work on | |||
2763 | arrays that are not lvalues (for example, members of structures returned | |||
2764 | by functions). | |||
2765 | ||||
2766 | For vector types, allow vector[i] but not i[vector], and create | |||
2767 | *(((type*)&vectortype) + i) for the expression. | |||
2768 | ||||
2769 | LOC is the location to use for the returned expression. */ | |||
2770 | ||||
2771 | tree | |||
2772 | build_array_ref (location_t loc, tree array, tree index) | |||
2773 | { | |||
2774 | tree ret; | |||
2775 | bool swapped = false; | |||
2776 | if (TREE_TYPE (array)((contains_struct_check ((array), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2776, __FUNCTION__))->typed.type) == error_mark_nodeglobal_trees[TI_ERROR_MARK] | |||
2777 | || TREE_TYPE (index)((contains_struct_check ((index), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2777, __FUNCTION__))->typed.type) == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
2778 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
2779 | ||||
2780 | if (TREE_CODE (TREE_TYPE (array))((enum tree_code) (((contains_struct_check ((array), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2780, __FUNCTION__))->typed.type))->base.code) != ARRAY_TYPE | |||
2781 | && TREE_CODE (TREE_TYPE (array))((enum tree_code) (((contains_struct_check ((array), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2781, __FUNCTION__))->typed.type))->base.code) != POINTER_TYPE | |||
2782 | /* Allow vector[index] but not index[vector]. */ | |||
2783 | && !gnu_vector_type_p (TREE_TYPE (array)((contains_struct_check ((array), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2783, __FUNCTION__))->typed.type))) | |||
2784 | { | |||
2785 | if (TREE_CODE (TREE_TYPE (index))((enum tree_code) (((contains_struct_check ((index), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2785, __FUNCTION__))->typed.type))->base.code) != ARRAY_TYPE | |||
2786 | && TREE_CODE (TREE_TYPE (index))((enum tree_code) (((contains_struct_check ((index), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2786, __FUNCTION__))->typed.type))->base.code) != POINTER_TYPE) | |||
2787 | { | |||
2788 | error_at (loc, | |||
2789 | "subscripted value is neither array nor pointer nor vector"); | |||
2790 | ||||
2791 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
2792 | } | |||
2793 | std::swap (array, index); | |||
2794 | swapped = true; | |||
2795 | } | |||
2796 | ||||
2797 | if (!INTEGRAL_TYPE_P (TREE_TYPE (index))(((enum tree_code) (((contains_struct_check ((index), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2797, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE || ((enum tree_code) (((contains_struct_check ((index), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2797, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE || ((enum tree_code) (((contains_struct_check ((index), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2797, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE )) | |||
2798 | { | |||
2799 | error_at (loc, "array subscript is not an integer"); | |||
2800 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
2801 | } | |||
2802 | ||||
2803 | if (TREE_CODE (TREE_TYPE (TREE_TYPE (array)))((enum tree_code) (((contains_struct_check ((((contains_struct_check ((array), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2803, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2803, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE) | |||
2804 | { | |||
2805 | error_at (loc, "subscripted value is pointer to function"); | |||
2806 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
2807 | } | |||
2808 | ||||
2809 | /* ??? Existing practice has been to warn only when the char | |||
2810 | index is syntactically the index, not for char[array]. */ | |||
2811 | if (!swapped) | |||
2812 | warn_array_subscript_with_type_char (loc, index); | |||
2813 | ||||
2814 | /* Apply default promotions *after* noticing character types. */ | |||
2815 | index = default_conversion (index); | |||
2816 | if (index == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
2817 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
2818 | ||||
2819 | gcc_assert (TREE_CODE (TREE_TYPE (index)) == INTEGER_TYPE)((void)(!(((enum tree_code) (((contains_struct_check ((index) , (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2819, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2819, __FUNCTION__), 0 : 0)); | |||
2820 | ||||
2821 | bool was_vector = VECTOR_TYPE_P (TREE_TYPE (array))(((enum tree_code) (((contains_struct_check ((array), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2821, __FUNCTION__))->typed.type))->base.code) == VECTOR_TYPE ); | |||
2822 | bool non_lvalue = convert_vector_to_array_for_subscript (loc, &array, index); | |||
2823 | ||||
2824 | if (TREE_CODE (TREE_TYPE (array))((enum tree_code) (((contains_struct_check ((array), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2824, __FUNCTION__))->typed.type))->base.code) == ARRAY_TYPE) | |||
2825 | { | |||
2826 | tree rval, type; | |||
2827 | ||||
2828 | /* An array that is indexed by a non-constant | |||
2829 | cannot be stored in a register; we must be able to do | |||
2830 | address arithmetic on its address. | |||
2831 | Likewise an array of elements of variable size. */ | |||
2832 | if (TREE_CODE (index)((enum tree_code) (index)->base.code) != INTEGER_CST | |||
2833 | || (COMPLETE_TYPE_P (TREE_TYPE (TREE_TYPE (array)))(((tree_class_check ((((contains_struct_check ((((contains_struct_check ((array), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2833, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2833, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2833, __FUNCTION__))->type_common.size) != (tree) __null ) | |||
2834 | && TREE_CODE (TYPE_SIZE (TREE_TYPE (TREE_TYPE (array))))((enum tree_code) (((tree_class_check ((((contains_struct_check ((((contains_struct_check ((array), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2834, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2834, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2834, __FUNCTION__))->type_common.size))->base.code) != INTEGER_CST)) | |||
2835 | { | |||
2836 | if (!c_mark_addressable (array, true)) | |||
2837 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
2838 | } | |||
2839 | /* An array that is indexed by a constant value which is not within | |||
2840 | the array bounds cannot be stored in a register either; because we | |||
2841 | would get a crash in store_bit_field/extract_bit_field when trying | |||
2842 | to access a non-existent part of the register. */ | |||
2843 | if (TREE_CODE (index)((enum tree_code) (index)->base.code) == INTEGER_CST | |||
2844 | && TYPE_DOMAIN (TREE_TYPE (array))((tree_check ((((contains_struct_check ((array), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2844, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2844, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) | |||
2845 | && !int_fits_type_p (index, TYPE_DOMAIN (TREE_TYPE (array))((tree_check ((((contains_struct_check ((array), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2845, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2845, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ))) | |||
2846 | { | |||
2847 | if (!c_mark_addressable (array)) | |||
2848 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
2849 | } | |||
2850 | ||||
2851 | if ((pedanticglobal_options.x_pedantic || warn_c90_c99_compatglobal_options.x_warn_c90_c99_compat) | |||
2852 | && ! was_vector) | |||
2853 | { | |||
2854 | tree foo = array; | |||
2855 | while (TREE_CODE (foo)((enum tree_code) (foo)->base.code) == COMPONENT_REF) | |||
2856 | foo = TREE_OPERAND (foo, 0)(*((const_cast<tree*> (tree_operand_check ((foo), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2856, __FUNCTION__))))); | |||
2857 | if (VAR_P (foo)(((enum tree_code) (foo)->base.code) == VAR_DECL) && C_DECL_REGISTER (foo)((contains_struct_check ((foo), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2857, __FUNCTION__))->decl_common.lang_flag_4)) | |||
2858 | pedwarn (loc, OPT_Wpedantic, | |||
2859 | "ISO C forbids subscripting %<register%> array"); | |||
2860 | else if (!lvalue_p (foo)) | |||
2861 | pedwarn_c90 (loc, OPT_Wpedantic, | |||
2862 | "ISO C90 forbids subscripting non-lvalue " | |||
2863 | "array"); | |||
2864 | } | |||
2865 | ||||
2866 | type = TREE_TYPE (TREE_TYPE (array))((contains_struct_check ((((contains_struct_check ((array), ( TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2866, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2866, __FUNCTION__))->typed.type); | |||
2867 | rval = build4 (ARRAY_REF, type, array, index, NULL_TREE(tree) __null, NULL_TREE(tree) __null); | |||
2868 | /* Array ref is const/volatile if the array elements are | |||
2869 | or if the array is. */ | |||
2870 | TREE_READONLY (rval)((non_type_check ((rval), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2870, __FUNCTION__))->base.readonly_flag) | |||
2871 | |= (TYPE_READONLY (TREE_TYPE (TREE_TYPE (array)))((tree_class_check ((((contains_struct_check ((((contains_struct_check ((array), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2871, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2871, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2871, __FUNCTION__))->base.readonly_flag) | |||
2872 | | TREE_READONLY (array)((non_type_check ((array), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2872, __FUNCTION__))->base.readonly_flag)); | |||
2873 | TREE_SIDE_EFFECTS (rval)((non_type_check ((rval), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2873, __FUNCTION__))->base.side_effects_flag) | |||
2874 | |= (TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (array)))((tree_class_check ((((contains_struct_check ((((contains_struct_check ((array), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2874, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2874, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2874, __FUNCTION__))->base.volatile_flag) | |||
2875 | | TREE_SIDE_EFFECTS (array)((non_type_check ((array), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2875, __FUNCTION__))->base.side_effects_flag)); | |||
2876 | TREE_THIS_VOLATILE (rval)((rval)->base.volatile_flag) | |||
2877 | |= (TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (array)))((tree_class_check ((((contains_struct_check ((((contains_struct_check ((array), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2877, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2877, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2877, __FUNCTION__))->base.volatile_flag) | |||
2878 | /* This was added by rms on 16 Nov 91. | |||
2879 | It fixes vol struct foo *a; a->elts[1] | |||
2880 | in an inline function. | |||
2881 | Hope it doesn't break something else. */ | |||
2882 | | TREE_THIS_VOLATILE (array)((array)->base.volatile_flag)); | |||
2883 | ret = require_complete_type (loc, rval); | |||
2884 | protected_set_expr_location (ret, loc); | |||
2885 | if (non_lvalue) | |||
2886 | ret = non_lvalue_loc (loc, ret); | |||
2887 | return ret; | |||
2888 | } | |||
2889 | else | |||
2890 | { | |||
2891 | tree ar = default_conversion (array); | |||
2892 | ||||
2893 | if (ar == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
2894 | return ar; | |||
2895 | ||||
2896 | gcc_assert (TREE_CODE (TREE_TYPE (ar)) == POINTER_TYPE)((void)(!(((enum tree_code) (((contains_struct_check ((ar), ( TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2896, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2896, __FUNCTION__), 0 : 0)); | |||
2897 | gcc_assert (TREE_CODE (TREE_TYPE (TREE_TYPE (ar))) != FUNCTION_TYPE)((void)(!(((enum tree_code) (((contains_struct_check ((((contains_struct_check ((ar), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2897, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2897, __FUNCTION__))->typed.type))->base.code) != FUNCTION_TYPE ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2897, __FUNCTION__), 0 : 0)); | |||
2898 | ||||
2899 | ret = build_indirect_ref (loc, build_binary_op (loc, PLUS_EXPR, ar, | |||
2900 | index, false), | |||
2901 | RO_ARRAY_INDEXING); | |||
2902 | if (non_lvalue) | |||
2903 | ret = non_lvalue_loc (loc, ret); | |||
2904 | return ret; | |||
2905 | } | |||
2906 | } | |||
2907 | ||||
2908 | /* Build an external reference to identifier ID. FUN indicates | |||
2909 | whether this will be used for a function call. LOC is the source | |||
2910 | location of the identifier. This sets *TYPE to the type of the | |||
2911 | identifier, which is not the same as the type of the returned value | |||
2912 | for CONST_DECLs defined as enum constants. If the type of the | |||
2913 | identifier is not available, *TYPE is set to NULL. */ | |||
2914 | tree | |||
2915 | build_external_ref (location_t loc, tree id, bool fun, tree *type) | |||
2916 | { | |||
2917 | tree ref; | |||
2918 | tree decl = lookup_name (id); | |||
2919 | ||||
2920 | /* In Objective-C, an instance variable (ivar) may be preferred to | |||
2921 | whatever lookup_name() found. */ | |||
2922 | decl = objc_lookup_ivar (decl, id); | |||
2923 | ||||
2924 | *type = NULL__null; | |||
2925 | if (decl && decl != error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
2926 | { | |||
2927 | ref = decl; | |||
2928 | *type = TREE_TYPE (ref)((contains_struct_check ((ref), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2928, __FUNCTION__))->typed.type); | |||
2929 | if (DECL_P (decl)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (decl)->base.code))] == tcc_declaration) && C_DECL_UNDERSPECIFIED (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2929, __FUNCTION__))->decl_common.lang_flag_7)) | |||
2930 | error_at (loc, "underspecified %qD referenced in its initializer", | |||
2931 | decl); | |||
2932 | } | |||
2933 | else if (fun) | |||
2934 | /* Implicit function declaration. */ | |||
2935 | ref = implicitly_declare (loc, id); | |||
2936 | else if (decl == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
2937 | /* Don't complain about something that's already been | |||
2938 | complained about. */ | |||
2939 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
2940 | else | |||
2941 | { | |||
2942 | undeclared_variable (loc, id); | |||
2943 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
2944 | } | |||
2945 | ||||
2946 | if (TREE_TYPE (ref)((contains_struct_check ((ref), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2946, __FUNCTION__))->typed.type) == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
2947 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
2948 | ||||
2949 | if (TREE_UNAVAILABLE (ref)((ref)->base.u.bits.unavailable_flag)) | |||
2950 | error_unavailable_use (ref, NULL_TREE(tree) __null); | |||
2951 | else if (TREE_DEPRECATED (ref)((ref)->base.deprecated_flag)) | |||
2952 | warn_deprecated_use (ref, NULL_TREE(tree) __null); | |||
2953 | ||||
2954 | /* Recursive call does not count as usage. */ | |||
2955 | if (ref != current_function_decl) | |||
2956 | { | |||
2957 | TREE_USED (ref)((ref)->base.used_flag) = 1; | |||
2958 | } | |||
2959 | ||||
2960 | if (TREE_CODE (ref)((enum tree_code) (ref)->base.code) == FUNCTION_DECL && !in_alignof) | |||
2961 | { | |||
2962 | if (!in_sizeof && !in_typeof) | |||
2963 | C_DECL_USED (ref)((contains_struct_check (((tree_check ((ref), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2963, __FUNCTION__, (FUNCTION_DECL)))), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2963, __FUNCTION__))->decl_common.lang_flag_5) = 1; | |||
2964 | else if (DECL_INITIAL (ref)((contains_struct_check ((ref), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2964, __FUNCTION__))->decl_common.initial) == NULL_TREE(tree) __null | |||
2965 | && DECL_EXTERNAL (ref)((contains_struct_check ((ref), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2965, __FUNCTION__))->decl_common.decl_flag_1) | |||
2966 | && !TREE_PUBLIC (ref)((ref)->base.public_flag)) | |||
2967 | record_maybe_used_decl (ref); | |||
2968 | } | |||
2969 | ||||
2970 | if (TREE_CODE (ref)((enum tree_code) (ref)->base.code) == CONST_DECL) | |||
2971 | { | |||
2972 | used_types_insert (TREE_TYPE (ref)((contains_struct_check ((ref), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2972, __FUNCTION__))->typed.type)); | |||
2973 | ||||
2974 | if (warn_cxx_compatglobal_options.x_warn_cxx_compat | |||
2975 | && TREE_CODE (TREE_TYPE (ref))((enum tree_code) (((contains_struct_check ((ref), (TS_TYPED) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2975, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE | |||
2976 | && C_TYPE_DEFINED_IN_STRUCT (TREE_TYPE (ref))((tree_class_check ((((contains_struct_check ((ref), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2976, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2976, __FUNCTION__))->type_common.lang_flag_2)) | |||
2977 | { | |||
2978 | warning_at (loc, OPT_Wc___compat, | |||
2979 | ("enum constant defined in struct or union " | |||
2980 | "is not visible in C++")); | |||
2981 | inform (DECL_SOURCE_LOCATION (ref)((contains_struct_check ((ref), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2981, __FUNCTION__))->decl_minimal.locus), "enum constant defined here"); | |||
2982 | } | |||
2983 | ||||
2984 | ref = DECL_INITIAL (ref)((contains_struct_check ((ref), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2984, __FUNCTION__))->decl_common.initial); | |||
2985 | TREE_CONSTANT (ref)((non_type_check ((ref), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2985, __FUNCTION__))->base.constant_flag) = 1; | |||
2986 | } | |||
2987 | else if (current_function_decl != NULL_TREE(tree) __null | |||
2988 | && !DECL_FILE_SCOPE_P (current_function_decl)(! (((contains_struct_check ((current_function_decl), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2988, __FUNCTION__))->decl_minimal.context)) || ((enum tree_code ) (((contains_struct_check ((current_function_decl), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2988, __FUNCTION__))->decl_minimal.context))->base.code ) == TRANSLATION_UNIT_DECL) | |||
2989 | && (VAR_OR_FUNCTION_DECL_P (ref)(((enum tree_code) (ref)->base.code) == VAR_DECL || ((enum tree_code) (ref)->base.code) == FUNCTION_DECL) | |||
2990 | || TREE_CODE (ref)((enum tree_code) (ref)->base.code) == PARM_DECL)) | |||
2991 | { | |||
2992 | tree context = decl_function_context (ref); | |||
2993 | ||||
2994 | if (context != NULL_TREE(tree) __null && context != current_function_decl) | |||
2995 | DECL_NONLOCAL (ref)((contains_struct_check ((ref), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 2995, __FUNCTION__))->decl_common.nonlocal_flag) = 1; | |||
2996 | } | |||
2997 | /* C99 6.7.4p3: An inline definition of a function with external | |||
2998 | linkage ... shall not contain a reference to an identifier with | |||
2999 | internal linkage. */ | |||
3000 | else if (current_function_decl != NULL_TREE(tree) __null | |||
3001 | && DECL_DECLARED_INLINE_P (current_function_decl)((tree_check ((current_function_decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3001, __FUNCTION__, (FUNCTION_DECL)))->function_decl.declared_inline_flag ) | |||
3002 | && DECL_EXTERNAL (current_function_decl)((contains_struct_check ((current_function_decl), (TS_DECL_COMMON ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3002, __FUNCTION__))->decl_common.decl_flag_1) | |||
3003 | && VAR_OR_FUNCTION_DECL_P (ref)(((enum tree_code) (ref)->base.code) == VAR_DECL || ((enum tree_code) (ref)->base.code) == FUNCTION_DECL) | |||
3004 | && (!VAR_P (ref)(((enum tree_code) (ref)->base.code) == VAR_DECL) || TREE_STATIC (ref)((ref)->base.static_flag)) | |||
3005 | && ! TREE_PUBLIC (ref)((ref)->base.public_flag) | |||
3006 | && DECL_CONTEXT (ref)((contains_struct_check ((ref), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3006, __FUNCTION__))->decl_minimal.context) != current_function_decl) | |||
3007 | record_inline_static (loc, current_function_decl, ref, | |||
3008 | csi_internal); | |||
3009 | ||||
3010 | return ref; | |||
3011 | } | |||
3012 | ||||
3013 | /* Record details of decls possibly used inside sizeof or typeof. */ | |||
3014 | struct maybe_used_decl | |||
3015 | { | |||
3016 | /* The decl. */ | |||
3017 | tree decl; | |||
3018 | /* The level seen at (in_sizeof + in_typeof). */ | |||
3019 | int level; | |||
3020 | /* The next one at this level or above, or NULL. */ | |||
3021 | struct maybe_used_decl *next; | |||
3022 | }; | |||
3023 | ||||
3024 | static struct maybe_used_decl *maybe_used_decls; | |||
3025 | ||||
3026 | /* Record that DECL, an undefined static function reference seen | |||
3027 | inside sizeof or typeof, might be used if the operand of sizeof is | |||
3028 | a VLA type or the operand of typeof is a variably modified | |||
3029 | type. */ | |||
3030 | ||||
3031 | static void | |||
3032 | record_maybe_used_decl (tree decl) | |||
3033 | { | |||
3034 | struct maybe_used_decl *t = XOBNEW (&parser_obstack, struct maybe_used_decl)((struct maybe_used_decl *) __extension__ ({ struct obstack * __h = ((&parser_obstack)); __extension__ ({ struct obstack *__o = (__h); size_t __len = ((sizeof (struct maybe_used_decl ))); if (__extension__ ({ struct obstack const *__o1 = (__o); (size_t) (__o1->chunk_limit - __o1->next_free); }) < __len) _obstack_newchunk (__o, __len); ((void) ((__o)->next_free += (__len))); }); __extension__ ({ struct obstack *__o1 = (__h ); void *__value = (void *) __o1->object_base; if (__o1-> next_free == __value) __o1->maybe_empty_object = 1; __o1-> next_free = (sizeof (ptrdiff_t) < sizeof (void *) ? ((__o1 ->object_base) + (((__o1->next_free) - (__o1->object_base ) + (__o1->alignment_mask)) & ~(__o1->alignment_mask ))) : (char *) (((ptrdiff_t) (__o1->next_free) + (__o1-> alignment_mask)) & ~(__o1->alignment_mask))); if ((size_t ) (__o1->next_free - (char *) __o1->chunk) > (size_t ) (__o1->chunk_limit - (char *) __o1->chunk)) __o1-> next_free = __o1->chunk_limit; __o1->object_base = __o1 ->next_free; __value; }); })); | |||
3035 | t->decl = decl; | |||
3036 | t->level = in_sizeof + in_typeof; | |||
3037 | t->next = maybe_used_decls; | |||
3038 | maybe_used_decls = t; | |||
3039 | } | |||
3040 | ||||
3041 | /* Pop the stack of decls possibly used inside sizeof or typeof. If | |||
3042 | USED is false, just discard them. If it is true, mark them used | |||
3043 | (if no longer inside sizeof or typeof) or move them to the next | |||
3044 | level up (if still inside sizeof or typeof). */ | |||
3045 | ||||
3046 | void | |||
3047 | pop_maybe_used (bool used) | |||
3048 | { | |||
3049 | struct maybe_used_decl *p = maybe_used_decls; | |||
3050 | int cur_level = in_sizeof + in_typeof; | |||
3051 | while (p && p->level > cur_level) | |||
3052 | { | |||
3053 | if (used) | |||
3054 | { | |||
3055 | if (cur_level == 0) | |||
3056 | C_DECL_USED (p->decl)((contains_struct_check (((tree_check ((p->decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3056, __FUNCTION__, (FUNCTION_DECL)))), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3056, __FUNCTION__))->decl_common.lang_flag_5) = 1; | |||
3057 | else | |||
3058 | p->level = cur_level; | |||
3059 | } | |||
3060 | p = p->next; | |||
3061 | } | |||
3062 | if (!used || cur_level == 0) | |||
3063 | maybe_used_decls = p; | |||
3064 | } | |||
3065 | ||||
3066 | /* Return the result of sizeof applied to EXPR. */ | |||
3067 | ||||
3068 | struct c_expr | |||
3069 | c_expr_sizeof_expr (location_t loc, struct c_expr expr) | |||
3070 | { | |||
3071 | struct c_expr ret; | |||
3072 | if (expr.value == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
3073 | { | |||
3074 | ret.value = error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
3075 | ret.original_code = ERROR_MARK; | |||
3076 | ret.original_type = NULL__null; | |||
3077 | ret.m_decimal = 0; | |||
3078 | pop_maybe_used (false); | |||
3079 | } | |||
3080 | else | |||
3081 | { | |||
3082 | bool expr_const_operands = true; | |||
3083 | ||||
3084 | if (TREE_CODE (expr.value)((enum tree_code) (expr.value)->base.code) == PARM_DECL | |||
3085 | && C_ARRAY_PARAMETER (expr.value)((contains_struct_check ((expr.value), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3085, __FUNCTION__))->decl_common.lang_flag_0)) | |||
3086 | { | |||
3087 | auto_diagnostic_group d; | |||
3088 | if (warning_at (loc, OPT_Wsizeof_array_argument, | |||
3089 | "%<sizeof%> on array function parameter %qE will " | |||
3090 | "return size of %qT", expr.value, | |||
3091 | TREE_TYPE (expr.value)((contains_struct_check ((expr.value), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3091, __FUNCTION__))->typed.type))) | |||
3092 | inform (DECL_SOURCE_LOCATION (expr.value)((contains_struct_check ((expr.value), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3092, __FUNCTION__))->decl_minimal.locus), "declared here"); | |||
3093 | } | |||
3094 | tree folded_expr = c_fully_fold (expr.value, require_constant_value, | |||
3095 | &expr_const_operands); | |||
3096 | ret.value = c_sizeof (loc, TREE_TYPE (folded_expr))c_sizeof_or_alignof_type (loc, ((contains_struct_check ((folded_expr ), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3096, __FUNCTION__))->typed.type), true, false, 1); | |||
3097 | c_last_sizeof_arg = expr.value; | |||
3098 | c_last_sizeof_loc = loc; | |||
3099 | ret.original_code = SIZEOF_EXPR; | |||
3100 | ret.original_type = NULL__null; | |||
3101 | ret.m_decimal = 0; | |||
3102 | if (C_TYPE_VARIABLE_SIZE (TREE_TYPE (folded_expr))((tree_class_check ((((contains_struct_check ((folded_expr), ( TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3102, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3102, __FUNCTION__))->type_common.lang_flag_1)) | |||
3103 | { | |||
3104 | /* sizeof is evaluated when given a vla (C99 6.5.3.4p2). */ | |||
3105 | ret.value = build2 (C_MAYBE_CONST_EXPR, TREE_TYPE (ret.value)((contains_struct_check ((ret.value), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3105, __FUNCTION__))->typed.type), | |||
3106 | folded_expr, ret.value); | |||
3107 | C_MAYBE_CONST_EXPR_NON_CONST (ret.value)((tree_not_check2 (((tree_check ((ret.value), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3107, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3107, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_1) = !expr_const_operands; | |||
3108 | SET_EXPR_LOCATION (ret.value, loc)(expr_check (((ret.value)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3108, __FUNCTION__))->exp.locus = (loc); | |||
3109 | } | |||
3110 | pop_maybe_used (C_TYPE_VARIABLE_SIZE (TREE_TYPE (folded_expr))((tree_class_check ((((contains_struct_check ((folded_expr), ( TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3110, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3110, __FUNCTION__))->type_common.lang_flag_1)); | |||
3111 | } | |||
3112 | return ret; | |||
3113 | } | |||
3114 | ||||
3115 | /* Return the result of sizeof applied to T, a structure for the type | |||
3116 | name passed to sizeof (rather than the type itself). LOC is the | |||
3117 | location of the original expression. */ | |||
3118 | ||||
3119 | struct c_expr | |||
3120 | c_expr_sizeof_type (location_t loc, struct c_type_name *t) | |||
3121 | { | |||
3122 | tree type; | |||
3123 | struct c_expr ret; | |||
3124 | tree type_expr = NULL_TREE(tree) __null; | |||
3125 | bool type_expr_const = true; | |||
3126 | type = groktypename (t, &type_expr, &type_expr_const); | |||
3127 | ret.value = c_sizeof (loc, type)c_sizeof_or_alignof_type (loc, type, true, false, 1); | |||
3128 | c_last_sizeof_arg = type; | |||
3129 | c_last_sizeof_loc = loc; | |||
3130 | ret.original_code = SIZEOF_EXPR; | |||
3131 | ret.original_type = NULL__null; | |||
3132 | ret.m_decimal = 0; | |||
3133 | if (type == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
3134 | { | |||
3135 | ret.value = error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
3136 | ret.original_code = ERROR_MARK; | |||
3137 | } | |||
3138 | else | |||
3139 | if ((type_expr || TREE_CODE (ret.value)((enum tree_code) (ret.value)->base.code) == INTEGER_CST) | |||
3140 | && C_TYPE_VARIABLE_SIZE (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3140, __FUNCTION__))->type_common.lang_flag_1)) | |||
3141 | { | |||
3142 | /* If the type is a [*] array, it is a VLA but is represented as | |||
3143 | having a size of zero. In such a case we must ensure that | |||
3144 | the result of sizeof does not get folded to a constant by | |||
3145 | c_fully_fold, because if the size is evaluated the result is | |||
3146 | not constant and so constraints on zero or negative size | |||
3147 | arrays must not be applied when this sizeof call is inside | |||
3148 | another array declarator. */ | |||
3149 | if (!type_expr) | |||
3150 | type_expr = integer_zero_nodeglobal_trees[TI_INTEGER_ZERO]; | |||
3151 | ret.value = build2 (C_MAYBE_CONST_EXPR, TREE_TYPE (ret.value)((contains_struct_check ((ret.value), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3151, __FUNCTION__))->typed.type), | |||
3152 | type_expr, ret.value); | |||
3153 | C_MAYBE_CONST_EXPR_NON_CONST (ret.value)((tree_not_check2 (((tree_check ((ret.value), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3153, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3153, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_1) = !type_expr_const; | |||
3154 | } | |||
3155 | pop_maybe_used (type != error_mark_nodeglobal_trees[TI_ERROR_MARK] | |||
3156 | ? C_TYPE_VARIABLE_SIZE (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3156, __FUNCTION__))->type_common.lang_flag_1) : false); | |||
3157 | return ret; | |||
3158 | } | |||
3159 | ||||
3160 | /* Build a function call to function FUNCTION with parameters PARAMS. | |||
3161 | The function call is at LOC. | |||
3162 | PARAMS is a list--a chain of TREE_LIST nodes--in which the | |||
3163 | TREE_VALUE of each node is a parameter-expression. | |||
3164 | FUNCTION's data type may be a function type or a pointer-to-function. */ | |||
3165 | ||||
3166 | tree | |||
3167 | build_function_call (location_t loc, tree function, tree params) | |||
3168 | { | |||
3169 | vec<tree, va_gc> *v; | |||
3170 | tree ret; | |||
3171 | ||||
3172 | vec_alloc (v, list_length (params)); | |||
| ||||
3173 | for (; params; params = TREE_CHAIN (params)((contains_struct_check ((params), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3173, __FUNCTION__))->common.chain)) | |||
3174 | v->quick_push (TREE_VALUE (params)((tree_check ((params), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3174, __FUNCTION__, (TREE_LIST)))->list.value)); | |||
| ||||
3175 | ret = c_build_function_call_vec (loc, vNULL, function, v, NULL__null); | |||
3176 | vec_free (v); | |||
3177 | return ret; | |||
3178 | } | |||
3179 | ||||
3180 | /* Give a note about the location of the declaration of DECL. */ | |||
3181 | ||||
3182 | static void | |||
3183 | inform_declaration (tree decl) | |||
3184 | { | |||
3185 | if (decl && (TREE_CODE (decl)((enum tree_code) (decl)->base.code) != FUNCTION_DECL | |||
3186 | || !DECL_IS_UNDECLARED_BUILTIN (decl)(((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3186, __FUNCTION__))->decl_minimal.locus) <= ((location_t ) 1)))) | |||
3187 | inform (DECL_SOURCE_LOCATION (decl)((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3187, __FUNCTION__))->decl_minimal.locus), "declared here"); | |||
3188 | } | |||
3189 | ||||
3190 | /* Build a function call to function FUNCTION with parameters PARAMS. | |||
3191 | If FUNCTION is the result of resolving an overloaded target built-in, | |||
3192 | ORIG_FUNDECL is the original function decl, otherwise it is null. | |||
3193 | ORIGTYPES, if not NULL, is a vector of types; each element is | |||
3194 | either NULL or the original type of the corresponding element in | |||
3195 | PARAMS. The original type may differ from TREE_TYPE of the | |||
3196 | parameter for enums. FUNCTION's data type may be a function type | |||
3197 | or pointer-to-function. This function changes the elements of | |||
3198 | PARAMS. */ | |||
3199 | ||||
3200 | tree | |||
3201 | build_function_call_vec (location_t loc, vec<location_t> arg_loc, | |||
3202 | tree function, vec<tree, va_gc> *params, | |||
3203 | vec<tree, va_gc> *origtypes, tree orig_fundecl) | |||
3204 | { | |||
3205 | tree fntype, fundecl = NULL_TREE(tree) __null; | |||
3206 | tree name = NULL_TREE(tree) __null, result; | |||
3207 | tree tem; | |||
3208 | int nargs; | |||
3209 | tree *argarray; | |||
3210 | ||||
3211 | ||||
3212 | /* Strip NON_LVALUE_EXPRs, etc., since we aren't using as an lvalue. */ | |||
3213 | STRIP_TYPE_NOPS (function)while ((((((enum tree_code) (function)->base.code)) == NOP_EXPR || (((enum tree_code) (function)->base.code)) == CONVERT_EXPR ) || ((enum tree_code) (function)->base.code) == NON_LVALUE_EXPR ) && (*((const_cast<tree*> (tree_operand_check ( (function), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3213, __FUNCTION__))))) != global_trees[TI_ERROR_MARK] && (((contains_struct_check ((function), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3213, __FUNCTION__))->typed.type) == ((contains_struct_check (((*((const_cast<tree*> (tree_operand_check ((function ), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3213, __FUNCTION__)))))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3213, __FUNCTION__))->typed.type))) (function) = (*((const_cast <tree*> (tree_operand_check ((function), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3213, __FUNCTION__))))); | |||
3214 | ||||
3215 | /* Convert anything with function type to a pointer-to-function. */ | |||
3216 | if (TREE_CODE (function)((enum tree_code) (function)->base.code) == FUNCTION_DECL) | |||
3217 | { | |||
3218 | name = DECL_NAME (function)((contains_struct_check ((function), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3218, __FUNCTION__))->decl_minimal.name); | |||
3219 | ||||
3220 | if (flag_tmglobal_options.x_flag_tm) | |||
3221 | tm_malloc_replacement (function); | |||
3222 | fundecl = function; | |||
3223 | if (!orig_fundecl) | |||
3224 | orig_fundecl = fundecl; | |||
3225 | /* Atomic functions have type checking/casting already done. They are | |||
3226 | often rewritten and don't match the original parameter list. */ | |||
3227 | if (name && startswith (IDENTIFIER_POINTER (name)((const char *) (tree_check ((name), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3227, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.str ), "__atomic_")) | |||
3228 | origtypes = NULL__null; | |||
3229 | } | |||
3230 | if (TREE_CODE (TREE_TYPE (function))((enum tree_code) (((contains_struct_check ((function), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3230, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE) | |||
3231 | function = function_to_pointer_conversion (loc, function); | |||
3232 | ||||
3233 | /* For Objective-C, convert any calls via a cast to OBJC_TYPE_REF | |||
3234 | expressions, like those used for ObjC messenger dispatches. */ | |||
3235 | if (params && !params->is_empty ()) | |||
3236 | function = objc_rewrite_function_call (function, (*params)[0]); | |||
3237 | ||||
3238 | function = c_fully_fold (function, false, NULL__null); | |||
3239 | ||||
3240 | fntype = TREE_TYPE (function)((contains_struct_check ((function), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3240, __FUNCTION__))->typed.type); | |||
3241 | ||||
3242 | if (TREE_CODE (fntype)((enum tree_code) (fntype)->base.code) == ERROR_MARK) | |||
3243 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
3244 | ||||
3245 | if (!(TREE_CODE (fntype)((enum tree_code) (fntype)->base.code) == POINTER_TYPE | |||
3246 | && TREE_CODE (TREE_TYPE (fntype))((enum tree_code) (((contains_struct_check ((fntype), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3246, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE)) | |||
3247 | { | |||
3248 | if (!flag_diagnostics_show_caretglobal_options.x_flag_diagnostics_show_caret && !STATEMENT_CLASS_P (function)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (function)->base.code))] == tcc_statement)) | |||
3249 | error_at (loc, | |||
3250 | "called object %qE is not a function or function pointer", | |||
3251 | function); | |||
3252 | else if (DECL_P (function)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (function)->base.code))] == tcc_declaration)) | |||
3253 | { | |||
3254 | error_at (loc, | |||
3255 | "called object %qD is not a function or function pointer", | |||
3256 | function); | |||
3257 | inform_declaration (function); | |||
3258 | } | |||
3259 | else | |||
3260 | error_at (loc, | |||
3261 | "called object is not a function or function pointer"); | |||
3262 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
3263 | } | |||
3264 | ||||
3265 | if (fundecl && TREE_THIS_VOLATILE (fundecl)((fundecl)->base.volatile_flag)) | |||
3266 | current_function_returns_abnormally = 1; | |||
3267 | ||||
3268 | /* fntype now gets the type of function pointed to. */ | |||
3269 | fntype = TREE_TYPE (fntype)((contains_struct_check ((fntype), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3269, __FUNCTION__))->typed.type); | |||
3270 | tree return_type = TREE_TYPE (fntype)((contains_struct_check ((fntype), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3270, __FUNCTION__))->typed.type); | |||
3271 | ||||
3272 | /* Convert the parameters to the types declared in the | |||
3273 | function prototype, or apply default promotions. */ | |||
3274 | ||||
3275 | nargs = convert_arguments (loc, arg_loc, TYPE_ARG_TYPES (fntype)((tree_check2 ((fntype), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3275, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values), params, | |||
3276 | origtypes, function, fundecl); | |||
3277 | if (nargs < 0) | |||
3278 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
3279 | ||||
3280 | /* Check that the function is called through a compatible prototype. | |||
3281 | If it is not, warn. */ | |||
3282 | if (CONVERT_EXPR_P (function)((((enum tree_code) (function)->base.code)) == NOP_EXPR || (((enum tree_code) (function)->base.code)) == CONVERT_EXPR ) | |||
3283 | && TREE_CODE (tem = TREE_OPERAND (function, 0))((enum tree_code) (tem = (*((const_cast<tree*> (tree_operand_check ((function), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3283, __FUNCTION__))))))->base.code) == ADDR_EXPR | |||
3284 | && TREE_CODE (tem = TREE_OPERAND (tem, 0))((enum tree_code) (tem = (*((const_cast<tree*> (tree_operand_check ((tem), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3284, __FUNCTION__))))))->base.code) == FUNCTION_DECL | |||
3285 | && !comptypes (fntype, TREE_TYPE (tem)((contains_struct_check ((tem), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3285, __FUNCTION__))->typed.type))) | |||
3286 | { | |||
3287 | /* This situation leads to run-time undefined behavior. We can't, | |||
3288 | therefore, simply error unless we can prove that all possible | |||
3289 | executions of the program must execute the code. */ | |||
3290 | warning_at (loc, 0, "function called through a non-compatible type"); | |||
3291 | ||||
3292 | if (VOID_TYPE_P (return_type)(((enum tree_code) (return_type)->base.code) == VOID_TYPE) | |||
3293 | && TYPE_QUALS (return_type)((int) ((((tree_class_check ((return_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3293, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((return_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3293, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((return_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3293, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((return_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3293, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ) | (((((tree_class_check ((return_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3293, __FUNCTION__))->base.u.bits.address_space) & 0xFF ) << 8)))) != TYPE_UNQUALIFIED) | |||
3294 | pedwarn (loc, 0, | |||
3295 | "function with qualified void return type called"); | |||
3296 | } | |||
3297 | ||||
3298 | argarray = vec_safe_address (params); | |||
3299 | ||||
3300 | /* Check that arguments to builtin functions match the expectations. */ | |||
3301 | if (fundecl | |||
3302 | && fndecl_built_in_p (fundecl) | |||
3303 | && !check_builtin_function_arguments (loc, arg_loc, fundecl, | |||
3304 | orig_fundecl, nargs, argarray)) | |||
3305 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
3306 | ||||
3307 | /* Check that the arguments to the function are valid. */ | |||
3308 | bool warned_p = check_function_arguments (loc, fundecl, fntype, | |||
3309 | nargs, argarray, &arg_loc); | |||
3310 | ||||
3311 | if (TYPE_QUALS (return_type)((int) ((((tree_class_check ((return_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3311, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((return_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3311, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((return_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3311, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((return_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3311, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ) | (((((tree_class_check ((return_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3311, __FUNCTION__))->base.u.bits.address_space) & 0xFF ) << 8)))) != TYPE_UNQUALIFIED | |||
3312 | && !VOID_TYPE_P (return_type)(((enum tree_code) (return_type)->base.code) == VOID_TYPE)) | |||
3313 | return_type = c_build_qualified_type (return_type, TYPE_UNQUALIFIED); | |||
3314 | if (name != NULL_TREE(tree) __null | |||
3315 | && startswith (IDENTIFIER_POINTER (name)((const char *) (tree_check ((name), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3315, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.str ), "__builtin_")) | |||
3316 | { | |||
3317 | if (require_constant_value) | |||
3318 | result | |||
3319 | = fold_build_call_array_initializer_loc (loc, return_type, | |||
3320 | function, nargs, argarray); | |||
3321 | else | |||
3322 | result = fold_build_call_array_loc (loc, return_type, | |||
3323 | function, nargs, argarray); | |||
3324 | if (TREE_CODE (result)((enum tree_code) (result)->base.code) == NOP_EXPR | |||
3325 | && TREE_CODE (TREE_OPERAND (result, 0))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check ((result), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3325, __FUNCTION__))))))->base.code) == INTEGER_CST) | |||
3326 | STRIP_TYPE_NOPS (result)while ((((((enum tree_code) (result)->base.code)) == NOP_EXPR || (((enum tree_code) (result)->base.code)) == CONVERT_EXPR ) || ((enum tree_code) (result)->base.code) == NON_LVALUE_EXPR ) && (*((const_cast<tree*> (tree_operand_check ( (result), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3326, __FUNCTION__))))) != global_trees[TI_ERROR_MARK] && (((contains_struct_check ((result), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3326, __FUNCTION__))->typed.type) == ((contains_struct_check (((*((const_cast<tree*> (tree_operand_check ((result), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3326, __FUNCTION__)))))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3326, __FUNCTION__))->typed.type))) (result) = (*((const_cast <tree*> (tree_operand_check ((result), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3326, __FUNCTION__))))); | |||
3327 | } | |||
3328 | else | |||
3329 | result = build_call_array_loc (loc, return_type, | |||
3330 | function, nargs, argarray); | |||
3331 | /* If -Wnonnull warning has been diagnosed, avoid diagnosing it again | |||
3332 | later. */ | |||
3333 | if (warned_p && TREE_CODE (result)((enum tree_code) (result)->base.code) == CALL_EXPR) | |||
3334 | suppress_warning (result, OPT_Wnonnull); | |||
3335 | ||||
3336 | /* In this improbable scenario, a nested function returns a VM type. | |||
3337 | Create a TARGET_EXPR so that the call always has a LHS, much as | |||
3338 | what the C++ FE does for functions returning non-PODs. */ | |||
3339 | if (C_TYPE_VARIABLY_MODIFIED (TREE_TYPE (fntype))((tree_class_check ((((contains_struct_check ((fntype), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3339, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3339, __FUNCTION__))->type_common.lang_flag_6)) | |||
3340 | { | |||
3341 | tree tmp = create_tmp_var_raw (TREE_TYPE (fntype)((contains_struct_check ((fntype), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3341, __FUNCTION__))->typed.type)); | |||
3342 | result = build4 (TARGET_EXPR, TREE_TYPE (fntype)((contains_struct_check ((fntype), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3342, __FUNCTION__))->typed.type), tmp, result, | |||
3343 | NULL_TREE(tree) __null, NULL_TREE(tree) __null); | |||
3344 | } | |||
3345 | ||||
3346 | if (VOID_TYPE_P (TREE_TYPE (result))(((enum tree_code) (((contains_struct_check ((result), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3346, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE )) | |||
3347 | { | |||
3348 | if (TYPE_QUALS (TREE_TYPE (result))((int) ((((tree_class_check ((((contains_struct_check ((result ), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3348, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3348, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((((contains_struct_check ((result), ( TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3348, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3348, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((((contains_struct_check ((result), ( TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3348, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3348, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((((contains_struct_check ((result), ( TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3348, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3348, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ) | (((((tree_class_check ((((contains_struct_check ((result) , (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3348, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3348, __FUNCTION__))->base.u.bits.address_space) & 0xFF ) << 8)))) != TYPE_UNQUALIFIED) | |||
3349 | pedwarn (loc, 0, | |||
3350 | "function with qualified void return type called"); | |||
3351 | return result; | |||
3352 | } | |||
3353 | return require_complete_type (loc, result); | |||
3354 | } | |||
3355 | ||||
3356 | /* Like build_function_call_vec, but call also resolve_overloaded_builtin. */ | |||
3357 | ||||
3358 | tree | |||
3359 | c_build_function_call_vec (location_t loc, const vec<location_t> &arg_loc, | |||
3360 | tree function, vec<tree, va_gc> *params, | |||
3361 | vec<tree, va_gc> *origtypes) | |||
3362 | { | |||
3363 | /* Strip NON_LVALUE_EXPRs, etc., since we aren't using as an lvalue. */ | |||
3364 | STRIP_TYPE_NOPS (function)while ((((((enum tree_code) (function)->base.code)) == NOP_EXPR || (((enum tree_code) (function)->base.code)) == CONVERT_EXPR ) || ((enum tree_code) (function)->base.code) == NON_LVALUE_EXPR ) && (*((const_cast<tree*> (tree_operand_check ( (function), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3364, __FUNCTION__))))) != global_trees[TI_ERROR_MARK] && (((contains_struct_check ((function), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3364, __FUNCTION__))->typed.type) == ((contains_struct_check (((*((const_cast<tree*> (tree_operand_check ((function ), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3364, __FUNCTION__)))))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3364, __FUNCTION__))->typed.type))) (function) = (*((const_cast <tree*> (tree_operand_check ((function), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3364, __FUNCTION__))))); | |||
3365 | ||||
3366 | /* Convert anything with function type to a pointer-to-function. */ | |||
3367 | if (TREE_CODE (function)((enum tree_code) (function)->base.code) == FUNCTION_DECL) | |||
3368 | { | |||
3369 | /* Implement type-directed function overloading for builtins. | |||
3370 | resolve_overloaded_builtin and targetm.resolve_overloaded_builtin | |||
3371 | handle all the type checking. The result is a complete expression | |||
3372 | that implements this function call. */ | |||
3373 | tree tem = resolve_overloaded_builtin (loc, function, params); | |||
3374 | if (tem) | |||
3375 | return tem; | |||
3376 | } | |||
3377 | return build_function_call_vec (loc, arg_loc, function, params, origtypes); | |||
3378 | } | |||
3379 | ||||
3380 | /* Helper for convert_arguments called to convert the VALue of argument | |||
3381 | number ARGNUM from ORIGTYPE to the corresponding parameter number | |||
3382 | PARMNUM and TYPE. | |||
3383 | PLOC is the location where the conversion is being performed. | |||
3384 | FUNCTION and FUNDECL are the same as in convert_arguments. | |||
3385 | VALTYPE is the original type of VAL before the conversion and, | |||
3386 | for EXCESS_PRECISION_EXPR, the operand of the expression. | |||
3387 | NPC is true if VAL represents the null pointer constant (VAL itself | |||
3388 | will have been folded to an integer constant). | |||
3389 | RNAME is the same as FUNCTION except in Objective C when it's | |||
3390 | the function selector. | |||
3391 | EXCESS_PRECISION is true when VAL was originally represented | |||
3392 | as EXCESS_PRECISION_EXPR. | |||
3393 | WARNOPT is the same as in convert_for_assignment. */ | |||
3394 | ||||
3395 | static tree | |||
3396 | convert_argument (location_t ploc, tree function, tree fundecl, | |||
3397 | tree type, tree origtype, tree val, tree valtype, | |||
3398 | bool npc, tree rname, int parmnum, int argnum, | |||
3399 | bool excess_precision, int warnopt) | |||
3400 | { | |||
3401 | /* Formal parm type is specified by a function prototype. */ | |||
3402 | ||||
3403 | if (type == error_mark_nodeglobal_trees[TI_ERROR_MARK] || !COMPLETE_TYPE_P (type)(((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3403, __FUNCTION__))->type_common.size) != (tree) __null )) | |||
3404 | { | |||
3405 | error_at (ploc, "type of formal parameter %d is incomplete", | |||
3406 | parmnum + 1); | |||
3407 | return val; | |||
3408 | } | |||
3409 | ||||
3410 | /* Optionally warn about conversions that differ from the default | |||
3411 | conversions. */ | |||
3412 | if (warn_traditional_conversionglobal_options.x_warn_traditional_conversion || warn_traditionalglobal_options.x_warn_traditional) | |||
3413 | { | |||
3414 | unsigned int formal_prec = TYPE_PRECISION (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3414, __FUNCTION__))->type_common.precision); | |||
3415 | ||||
3416 | if (INTEGRAL_TYPE_P (type)(((enum tree_code) (type)->base.code) == ENUMERAL_TYPE || ( (enum tree_code) (type)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type)->base.code) == INTEGER_TYPE) | |||
3417 | && TREE_CODE (valtype)((enum tree_code) (valtype)->base.code) == REAL_TYPE) | |||
3418 | warning_at (ploc, OPT_Wtraditional_conversion, | |||
3419 | "passing argument %d of %qE as integer rather " | |||
3420 | "than floating due to prototype", | |||
3421 | argnum, rname); | |||
3422 | if (INTEGRAL_TYPE_P (type)(((enum tree_code) (type)->base.code) == ENUMERAL_TYPE || ( (enum tree_code) (type)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type)->base.code) == INTEGER_TYPE) | |||
3423 | && TREE_CODE (valtype)((enum tree_code) (valtype)->base.code) == COMPLEX_TYPE) | |||
3424 | warning_at (ploc, OPT_Wtraditional_conversion, | |||
3425 | "passing argument %d of %qE as integer rather " | |||
3426 | "than complex due to prototype", | |||
3427 | argnum, rname); | |||
3428 | else if (TREE_CODE (type)((enum tree_code) (type)->base.code) == COMPLEX_TYPE | |||
3429 | && TREE_CODE (valtype)((enum tree_code) (valtype)->base.code) == REAL_TYPE) | |||
3430 | warning_at (ploc, OPT_Wtraditional_conversion, | |||
3431 | "passing argument %d of %qE as complex rather " | |||
3432 | "than floating due to prototype", | |||
3433 | argnum, rname); | |||
3434 | else if (TREE_CODE (type)((enum tree_code) (type)->base.code) == REAL_TYPE | |||
3435 | && INTEGRAL_TYPE_P (valtype)(((enum tree_code) (valtype)->base.code) == ENUMERAL_TYPE || ((enum tree_code) (valtype)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (valtype)->base.code) == INTEGER_TYPE)) | |||
3436 | warning_at (ploc, OPT_Wtraditional_conversion, | |||
3437 | "passing argument %d of %qE as floating rather " | |||
3438 | "than integer due to prototype", | |||
3439 | argnum, rname); | |||
3440 | else if (TREE_CODE (type)((enum tree_code) (type)->base.code) == COMPLEX_TYPE | |||
3441 | && INTEGRAL_TYPE_P (valtype)(((enum tree_code) (valtype)->base.code) == ENUMERAL_TYPE || ((enum tree_code) (valtype)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (valtype)->base.code) == INTEGER_TYPE)) | |||
3442 | warning_at (ploc, OPT_Wtraditional_conversion, | |||
3443 | "passing argument %d of %qE as complex rather " | |||
3444 | "than integer due to prototype", | |||
3445 | argnum, rname); | |||
3446 | else if (TREE_CODE (type)((enum tree_code) (type)->base.code) == REAL_TYPE | |||
3447 | && TREE_CODE (valtype)((enum tree_code) (valtype)->base.code) == COMPLEX_TYPE) | |||
3448 | warning_at (ploc, OPT_Wtraditional_conversion, | |||
3449 | "passing argument %d of %qE as floating rather " | |||
3450 | "than complex due to prototype", | |||
3451 | argnum, rname); | |||
3452 | /* ??? At some point, messages should be written about | |||
3453 | conversions between complex types, but that's too messy | |||
3454 | to do now. */ | |||
3455 | else if (TREE_CODE (type)((enum tree_code) (type)->base.code) == REAL_TYPE | |||
3456 | && TREE_CODE (valtype)((enum tree_code) (valtype)->base.code) == REAL_TYPE) | |||
3457 | { | |||
3458 | /* Warn if any argument is passed as `float', | |||
3459 | since without a prototype it would be `double'. */ | |||
3460 | if (formal_prec == TYPE_PRECISION (float_type_node)((tree_class_check ((global_trees[TI_FLOAT_TYPE]), (tcc_type) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3460, __FUNCTION__))->type_common.precision) | |||
3461 | && type != dfloat32_type_nodeglobal_trees[TI_DFLOAT32_TYPE]) | |||
3462 | warning_at (ploc, 0, | |||
3463 | "passing argument %d of %qE as %<float%> " | |||
3464 | "rather than %<double%> due to prototype", | |||
3465 | argnum, rname); | |||
3466 | ||||
3467 | /* Warn if mismatch between argument and prototype | |||
3468 | for decimal float types. Warn of conversions with | |||
3469 | binary float types and of precision narrowing due to | |||
3470 | prototype. */ | |||
3471 | else if (type != valtype | |||
3472 | && (type == dfloat32_type_nodeglobal_trees[TI_DFLOAT32_TYPE] | |||
3473 | || type == dfloat64_type_nodeglobal_trees[TI_DFLOAT64_TYPE] | |||
3474 | || type == dfloat128_type_nodeglobal_trees[TI_DFLOAT128_TYPE] | |||
3475 | || valtype == dfloat32_type_nodeglobal_trees[TI_DFLOAT32_TYPE] | |||
3476 | || valtype == dfloat64_type_nodeglobal_trees[TI_DFLOAT64_TYPE] | |||
3477 | || valtype == dfloat128_type_nodeglobal_trees[TI_DFLOAT128_TYPE]) | |||
3478 | && (formal_prec | |||
3479 | <= TYPE_PRECISION (valtype)((tree_class_check ((valtype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3479, __FUNCTION__))->type_common.precision) | |||
3480 | || (type == dfloat128_type_nodeglobal_trees[TI_DFLOAT128_TYPE] | |||
3481 | && (valtype | |||
3482 | != dfloat64_type_nodeglobal_trees[TI_DFLOAT64_TYPE] | |||
3483 | && (valtype | |||
3484 | != dfloat32_type_nodeglobal_trees[TI_DFLOAT32_TYPE]))) | |||
3485 | || (type == dfloat64_type_nodeglobal_trees[TI_DFLOAT64_TYPE] | |||
3486 | && (valtype | |||
3487 | != dfloat32_type_nodeglobal_trees[TI_DFLOAT32_TYPE])))) | |||
3488 | warning_at (ploc, 0, | |||
3489 | "passing argument %d of %qE as %qT " | |||
3490 | "rather than %qT due to prototype", | |||
3491 | argnum, rname, type, valtype); | |||
3492 | ||||
3493 | } | |||
3494 | /* Detect integer changing in width or signedness. | |||
3495 | These warnings are only activated with | |||
3496 | -Wtraditional-conversion, not with -Wtraditional. */ | |||
3497 | else if (warn_traditional_conversionglobal_options.x_warn_traditional_conversion | |||
3498 | && INTEGRAL_TYPE_P (type)(((enum tree_code) (type)->base.code) == ENUMERAL_TYPE || ( (enum tree_code) (type)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type)->base.code) == INTEGER_TYPE) | |||
3499 | && INTEGRAL_TYPE_P (valtype)(((enum tree_code) (valtype)->base.code) == ENUMERAL_TYPE || ((enum tree_code) (valtype)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (valtype)->base.code) == INTEGER_TYPE)) | |||
3500 | { | |||
3501 | tree would_have_been = default_conversion (val); | |||
3502 | tree type1 = TREE_TYPE (would_have_been)((contains_struct_check ((would_have_been), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3502, __FUNCTION__))->typed.type); | |||
3503 | ||||
3504 | if (val == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
3505 | /* VAL could have been of incomplete type. */; | |||
3506 | else if (TREE_CODE (type)((enum tree_code) (type)->base.code) == ENUMERAL_TYPE | |||
3507 | && (TYPE_MAIN_VARIANT (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3507, __FUNCTION__))->type_common.main_variant) | |||
3508 | == TYPE_MAIN_VARIANT (valtype)((tree_class_check ((valtype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3508, __FUNCTION__))->type_common.main_variant))) | |||
3509 | /* No warning if function asks for enum | |||
3510 | and the actual arg is that enum type. */ | |||
3511 | ; | |||
3512 | else if (formal_prec != TYPE_PRECISION (type1)((tree_class_check ((type1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3512, __FUNCTION__))->type_common.precision)) | |||
3513 | warning_at (ploc, OPT_Wtraditional_conversion, | |||
3514 | "passing argument %d of %qE " | |||
3515 | "with different width due to prototype", | |||
3516 | argnum, rname); | |||
3517 | else if (TYPE_UNSIGNED (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3517, __FUNCTION__))->base.u.bits.unsigned_flag) == TYPE_UNSIGNED (type1)((tree_class_check ((type1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3517, __FUNCTION__))->base.u.bits.unsigned_flag)) | |||
3518 | ; | |||
3519 | /* Don't complain if the formal parameter type | |||
3520 | is an enum, because we can't tell now whether | |||
3521 | the value was an enum--even the same enum. */ | |||
3522 | else if (TREE_CODE (type)((enum tree_code) (type)->base.code) == ENUMERAL_TYPE) | |||
3523 | ; | |||
3524 | else if (TREE_CODE (val)((enum tree_code) (val)->base.code) == INTEGER_CST | |||
3525 | && int_fits_type_p (val, type)) | |||
3526 | /* Change in signedness doesn't matter | |||
3527 | if a constant value is unaffected. */ | |||
3528 | ; | |||
3529 | /* If the value is extended from a narrower | |||
3530 | unsigned type, it doesn't matter whether we | |||
3531 | pass it as signed or unsigned; the value | |||
3532 | certainly is the same either way. */ | |||
3533 | else if (TYPE_PRECISION (valtype)((tree_class_check ((valtype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3533, __FUNCTION__))->type_common.precision) < TYPE_PRECISION (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3533, __FUNCTION__))->type_common.precision) | |||
3534 | && TYPE_UNSIGNED (valtype)((tree_class_check ((valtype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3534, __FUNCTION__))->base.u.bits.unsigned_flag)) | |||
3535 | ; | |||
3536 | else if (TYPE_UNSIGNED (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3536, __FUNCTION__))->base.u.bits.unsigned_flag)) | |||
3537 | warning_at (ploc, OPT_Wtraditional_conversion, | |||
3538 | "passing argument %d of %qE " | |||
3539 | "as unsigned due to prototype", | |||
3540 | argnum, rname); | |||
3541 | else | |||
3542 | warning_at (ploc, OPT_Wtraditional_conversion, | |||
3543 | "passing argument %d of %qE " | |||
3544 | "as signed due to prototype", | |||
3545 | argnum, rname); | |||
3546 | } | |||
3547 | } | |||
3548 | ||||
3549 | /* Possibly restore an EXCESS_PRECISION_EXPR for the | |||
3550 | sake of better warnings from convert_and_check. */ | |||
3551 | if (excess_precision) | |||
3552 | val = build1 (EXCESS_PRECISION_EXPR, valtype, val); | |||
3553 | ||||
3554 | tree parmval = convert_for_assignment (ploc, ploc, type, | |||
3555 | val, origtype, ic_argpass, | |||
3556 | npc, fundecl, function, | |||
3557 | parmnum + 1, warnopt); | |||
3558 | ||||
3559 | if (targetm.calls.promote_prototypes (fundecl ? TREE_TYPE (fundecl)((contains_struct_check ((fundecl), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3559, __FUNCTION__))->typed.type) : 0) | |||
3560 | && INTEGRAL_TYPE_P (type)(((enum tree_code) (type)->base.code) == ENUMERAL_TYPE || ( (enum tree_code) (type)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type)->base.code) == INTEGER_TYPE) | |||
3561 | && (TYPE_PRECISION (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3561, __FUNCTION__))->type_common.precision) < TYPE_PRECISION (integer_type_node)((tree_class_check ((integer_types[itk_int]), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3561, __FUNCTION__))->type_common.precision))) | |||
3562 | parmval = default_conversion (parmval); | |||
3563 | ||||
3564 | return parmval; | |||
3565 | } | |||
3566 | ||||
3567 | /* Convert the argument expressions in the vector VALUES | |||
3568 | to the types in the list TYPELIST. | |||
3569 | ||||
3570 | If TYPELIST is exhausted, or when an element has NULL as its type, | |||
3571 | perform the default conversions. | |||
3572 | ||||
3573 | ORIGTYPES is the original types of the expressions in VALUES. This | |||
3574 | holds the type of enum values which have been converted to integral | |||
3575 | types. It may be NULL. | |||
3576 | ||||
3577 | FUNCTION is a tree for the called function. It is used only for | |||
3578 | error messages, where it is formatted with %qE. | |||
3579 | ||||
3580 | This is also where warnings about wrong number of args are generated. | |||
3581 | ||||
3582 | ARG_LOC are locations of function arguments (if any). | |||
3583 | ||||
3584 | Returns the actual number of arguments processed (which may be less | |||
3585 | than the length of VALUES in some error situations), or -1 on | |||
3586 | failure. */ | |||
3587 | ||||
3588 | static int | |||
3589 | convert_arguments (location_t loc, vec<location_t> arg_loc, tree typelist, | |||
3590 | vec<tree, va_gc> *values, vec<tree, va_gc> *origtypes, | |||
3591 | tree function, tree fundecl) | |||
3592 | { | |||
3593 | unsigned int parmnum; | |||
3594 | bool error_args = false; | |||
3595 | const bool type_generic = fundecl | |||
3596 | && lookup_attribute ("type generic", TYPE_ATTRIBUTES (TREE_TYPE (fundecl))((tree_class_check ((((contains_struct_check ((fundecl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3596, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3596, __FUNCTION__))->type_common.attributes)); | |||
3597 | bool type_generic_remove_excess_precision = false; | |||
3598 | bool type_generic_overflow_p = false; | |||
3599 | tree selector; | |||
3600 | ||||
3601 | /* Change pointer to function to the function itself for | |||
3602 | diagnostics. */ | |||
3603 | if (TREE_CODE (function)((enum tree_code) (function)->base.code) == ADDR_EXPR | |||
3604 | && TREE_CODE (TREE_OPERAND (function, 0))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check ((function), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3604, __FUNCTION__))))))->base.code) == FUNCTION_DECL) | |||
3605 | function = TREE_OPERAND (function, 0)(*((const_cast<tree*> (tree_operand_check ((function), ( 0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3605, __FUNCTION__))))); | |||
3606 | ||||
3607 | /* Handle an ObjC selector specially for diagnostics. */ | |||
3608 | selector = objc_message_selector (); | |||
3609 | ||||
3610 | /* For a call to a built-in function declared without a prototype, | |||
3611 | set to the built-in function's argument list. */ | |||
3612 | tree builtin_typelist = NULL_TREE(tree) __null; | |||
3613 | ||||
3614 | /* For type-generic built-in functions, determine whether excess | |||
3615 | precision should be removed (classification) or not | |||
3616 | (comparison). */ | |||
3617 | if (fundecl | |||
3618 | && fndecl_built_in_p (fundecl, BUILT_IN_NORMAL)) | |||
3619 | { | |||
3620 | built_in_function code = DECL_FUNCTION_CODE (fundecl); | |||
3621 | if (C_DECL_BUILTIN_PROTOTYPE (fundecl)((contains_struct_check (((tree_check ((fundecl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3621, __FUNCTION__, (FUNCTION_DECL)))), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3621, __FUNCTION__))->decl_common.lang_flag_6)) | |||
3622 | { | |||
3623 | /* For a call to a built-in function declared without a prototype | |||
3624 | use the types of the parameters of the internal built-in to | |||
3625 | match those of the arguments to. */ | |||
3626 | if (tree bdecl = builtin_decl_explicit (code)) | |||
3627 | builtin_typelist = TYPE_ARG_TYPES (TREE_TYPE (bdecl))((tree_check2 ((((contains_struct_check ((bdecl), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3627, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3627, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values); | |||
3628 | } | |||
3629 | ||||
3630 | /* For type-generic built-in functions, determine whether excess | |||
3631 | precision should be removed (classification) or not | |||
3632 | (comparison). */ | |||
3633 | if (type_generic) | |||
3634 | switch (code) | |||
3635 | { | |||
3636 | case BUILT_IN_ISFINITE: | |||
3637 | case BUILT_IN_ISINF: | |||
3638 | case BUILT_IN_ISINF_SIGN: | |||
3639 | case BUILT_IN_ISNAN: | |||
3640 | case BUILT_IN_ISNORMAL: | |||
3641 | case BUILT_IN_ISSIGNALING: | |||
3642 | case BUILT_IN_FPCLASSIFY: | |||
3643 | type_generic_remove_excess_precision = true; | |||
3644 | break; | |||
3645 | ||||
3646 | case BUILT_IN_ADD_OVERFLOW_P: | |||
3647 | case BUILT_IN_SUB_OVERFLOW_P: | |||
3648 | case BUILT_IN_MUL_OVERFLOW_P: | |||
3649 | /* The last argument of these type-generic builtins | |||
3650 | should not be promoted. */ | |||
3651 | type_generic_overflow_p = true; | |||
3652 | break; | |||
3653 | ||||
3654 | default: | |||
3655 | break; | |||
3656 | } | |||
3657 | } | |||
3658 | ||||
3659 | /* Scan the given expressions (VALUES) and types (TYPELIST), producing | |||
3660 | individual converted arguments. */ | |||
3661 | ||||
3662 | tree typetail, builtin_typetail, val; | |||
3663 | for (typetail = typelist, | |||
3664 | builtin_typetail = builtin_typelist, | |||
3665 | parmnum = 0; | |||
3666 | values && values->iterate (parmnum, &val); | |||
3667 | ++parmnum) | |||
3668 | { | |||
3669 | /* The type of the function parameter (if it was declared with one). */ | |||
3670 | tree type = typetail ? TREE_VALUE (typetail)((tree_check ((typetail), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3670, __FUNCTION__, (TREE_LIST)))->list.value) : NULL_TREE(tree) __null; | |||
3671 | /* The type of the built-in function parameter (if the function | |||
3672 | is a built-in). Used to detect type incompatibilities in | |||
3673 | calls to built-ins declared without a prototype. */ | |||
3674 | tree builtin_type = (builtin_typetail | |||
3675 | ? TREE_VALUE (builtin_typetail)((tree_check ((builtin_typetail), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3675, __FUNCTION__, (TREE_LIST)))->list.value) : NULL_TREE(tree) __null); | |||
3676 | /* The original type of the argument being passed to the function. */ | |||
3677 | tree valtype = TREE_TYPE (val)((contains_struct_check ((val), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3677, __FUNCTION__))->typed.type); | |||
3678 | /* The called function (or function selector in Objective C). */ | |||
3679 | tree rname = function; | |||
3680 | int argnum = parmnum + 1; | |||
3681 | const char *invalid_func_diag; | |||
3682 | /* Set for EXCESS_PRECISION_EXPR arguments. */ | |||
3683 | bool excess_precision = false; | |||
3684 | /* The value of the argument after conversion to the type | |||
3685 | of the function parameter it is passed to. */ | |||
3686 | tree parmval; | |||
3687 | /* Some __atomic_* builtins have additional hidden argument at | |||
3688 | position 0. */ | |||
3689 | location_t ploc | |||
3690 | = !arg_loc.is_empty () && values->length () == arg_loc.length () | |||
3691 | ? expansion_point_location_if_in_system_header (arg_loc[parmnum]) | |||
3692 | : input_location; | |||
3693 | ||||
3694 | if (type == void_type_nodeglobal_trees[TI_VOID_TYPE]) | |||
3695 | { | |||
3696 | if (selector) | |||
3697 | error_at (loc, "too many arguments to method %qE", selector); | |||
3698 | else | |||
3699 | error_at (loc, "too many arguments to function %qE", function); | |||
3700 | inform_declaration (fundecl); | |||
3701 | return error_args ? -1 : (int) parmnum; | |||
3702 | } | |||
3703 | ||||
3704 | if (builtin_type == void_type_nodeglobal_trees[TI_VOID_TYPE]) | |||
3705 | { | |||
3706 | if (warning_at (loc, OPT_Wbuiltin_declaration_mismatch, | |||
3707 | "too many arguments to built-in function %qE " | |||
3708 | "expecting %d", function, parmnum)) | |||
3709 | inform_declaration (fundecl); | |||
3710 | builtin_typetail = NULL_TREE(tree) __null; | |||
3711 | } | |||
3712 | ||||
3713 | if (selector && argnum > 2) | |||
3714 | { | |||
3715 | rname = selector; | |||
3716 | argnum -= 2; | |||
3717 | } | |||
3718 | ||||
3719 | /* Determine if VAL is a null pointer constant before folding it. */ | |||
3720 | bool npc = null_pointer_constant_p (val); | |||
3721 | ||||
3722 | /* If there is excess precision and a prototype, convert once to | |||
3723 | the required type rather than converting via the semantic | |||
3724 | type. Likewise without a prototype a float value represented | |||
3725 | as long double should be converted once to double. But for | |||
3726 | type-generic classification functions excess precision must | |||
3727 | be removed here. */ | |||
3728 | if (TREE_CODE (val)((enum tree_code) (val)->base.code) == EXCESS_PRECISION_EXPR | |||
3729 | && (type || !type_generic || !type_generic_remove_excess_precision)) | |||
3730 | { | |||
3731 | val = TREE_OPERAND (val, 0)(*((const_cast<tree*> (tree_operand_check ((val), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3731, __FUNCTION__))))); | |||
3732 | excess_precision = true; | |||
3733 | } | |||
3734 | val = c_fully_fold (val, false, NULL__null); | |||
3735 | STRIP_TYPE_NOPS (val)while ((((((enum tree_code) (val)->base.code)) == NOP_EXPR || (((enum tree_code) (val)->base.code)) == CONVERT_EXPR) || ((enum tree_code) (val)->base.code) == NON_LVALUE_EXPR ) && (*((const_cast<tree*> (tree_operand_check ( (val), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3735, __FUNCTION__))))) != global_trees[TI_ERROR_MARK] && (((contains_struct_check ((val), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3735, __FUNCTION__))->typed.type) == ((contains_struct_check (((*((const_cast<tree*> (tree_operand_check ((val), (0 ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3735, __FUNCTION__)))))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3735, __FUNCTION__))->typed.type))) (val) = (*((const_cast <tree*> (tree_operand_check ((val), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3735, __FUNCTION__))))); | |||
3736 | ||||
3737 | val = require_complete_type (ploc, val); | |||
3738 | ||||
3739 | /* Some floating-point arguments must be promoted to double when | |||
3740 | no type is specified by a prototype. This applies to | |||
3741 | arguments of type float, and to architecture-specific types | |||
3742 | (ARM __fp16), but not to _FloatN or _FloatNx types. */ | |||
3743 | bool promote_float_arg = false; | |||
3744 | if (type == NULL_TREE(tree) __null | |||
3745 | && TREE_CODE (valtype)((enum tree_code) (valtype)->base.code) == REAL_TYPE | |||
3746 | && (TYPE_PRECISION (valtype)((tree_class_check ((valtype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3746, __FUNCTION__))->type_common.precision) | |||
3747 | <= TYPE_PRECISION (double_type_node)((tree_class_check ((global_trees[TI_DOUBLE_TYPE]), (tcc_type ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3747, __FUNCTION__))->type_common.precision)) | |||
3748 | && TYPE_MAIN_VARIANT (valtype)((tree_class_check ((valtype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3748, __FUNCTION__))->type_common.main_variant) != double_type_nodeglobal_trees[TI_DOUBLE_TYPE] | |||
3749 | && TYPE_MAIN_VARIANT (valtype)((tree_class_check ((valtype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3749, __FUNCTION__))->type_common.main_variant) != long_double_type_nodeglobal_trees[TI_LONG_DOUBLE_TYPE] | |||
3750 | && !DECIMAL_FLOAT_MODE_P (TYPE_MODE (valtype))(((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check ((valtype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3750, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode (valtype) : (valtype)->type_common.mode)]) == MODE_DECIMAL_FLOAT )) | |||
3751 | { | |||
3752 | /* Promote this argument, unless it has a _FloatN or | |||
3753 | _FloatNx type. */ | |||
3754 | promote_float_arg = true; | |||
3755 | for (int i = 0; i < NUM_FLOATN_NX_TYPES(TI_FLOATN_NX_TYPE_LAST - TI_FLOATN_NX_TYPE_FIRST + 1); i++) | |||
3756 | if (TYPE_MAIN_VARIANT (valtype)((tree_class_check ((valtype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3756, __FUNCTION__))->type_common.main_variant) == FLOATN_NX_TYPE_NODE (i)global_trees[TI_FLOATN_NX_TYPE_FIRST + (i)]) | |||
3757 | { | |||
3758 | promote_float_arg = false; | |||
3759 | break; | |||
3760 | } | |||
3761 | /* Don't promote __bf16 either. */ | |||
3762 | if (TYPE_MAIN_VARIANT (valtype)((tree_class_check ((valtype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3762, __FUNCTION__))->type_common.main_variant) == bfloat16_type_nodeglobal_trees[TI_BFLOAT16_TYPE]) | |||
3763 | promote_float_arg = false; | |||
3764 | } | |||
3765 | ||||
3766 | if (type != NULL_TREE(tree) __null) | |||
3767 | { | |||
3768 | tree origtype = (!origtypes) ? NULL_TREE(tree) __null : (*origtypes)[parmnum]; | |||
3769 | parmval = convert_argument (ploc, function, fundecl, type, origtype, | |||
3770 | val, valtype, npc, rname, parmnum, argnum, | |||
3771 | excess_precision, 0); | |||
3772 | } | |||
3773 | else if (promote_float_arg) | |||
3774 | { | |||
3775 | if (type_generic) | |||
3776 | parmval = val; | |||
3777 | else | |||
3778 | { | |||
3779 | /* Convert `float' to `double'. */ | |||
3780 | if (warn_double_promotionglobal_options.x_warn_double_promotion && !c_inhibit_evaluation_warnings) | |||
3781 | warning_at (ploc, OPT_Wdouble_promotion, | |||
3782 | "implicit conversion from %qT to %qT when passing " | |||
3783 | "argument to function", | |||
3784 | valtype, double_type_nodeglobal_trees[TI_DOUBLE_TYPE]); | |||
3785 | parmval = convert (double_type_nodeglobal_trees[TI_DOUBLE_TYPE], val); | |||
3786 | } | |||
3787 | } | |||
3788 | else if ((excess_precision && !type_generic) | |||
3789 | || (type_generic_overflow_p && parmnum == 2)) | |||
3790 | /* A "double" argument with excess precision being passed | |||
3791 | without a prototype or in variable arguments. | |||
3792 | The last argument of __builtin_*_overflow_p should not be | |||
3793 | promoted. */ | |||
3794 | parmval = convert (valtype, val); | |||
3795 | else if ((invalid_func_diag = | |||
3796 | targetm.calls.invalid_arg_for_unprototyped_fn (typelist, fundecl, val))) | |||
3797 | { | |||
3798 | error (invalid_func_diag); | |||
3799 | return -1; | |||
3800 | } | |||
3801 | else if (TREE_CODE (val)((enum tree_code) (val)->base.code) == ADDR_EXPR && reject_gcc_builtin (val)) | |||
3802 | { | |||
3803 | return -1; | |||
3804 | } | |||
3805 | else | |||
3806 | /* Convert `short' and `char' to full-size `int'. */ | |||
3807 | parmval = default_conversion (val); | |||
3808 | ||||
3809 | (*values)[parmnum] = parmval; | |||
3810 | if (parmval == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
3811 | error_args = true; | |||
3812 | ||||
3813 | if (!type && builtin_type && TREE_CODE (builtin_type)((enum tree_code) (builtin_type)->base.code) != VOID_TYPE) | |||
3814 | { | |||
3815 | /* For a call to a built-in function declared without a prototype, | |||
3816 | perform the conversions from the argument to the expected type | |||
3817 | but issue warnings rather than errors for any mismatches. | |||
3818 | Ignore the converted argument and use the PARMVAL obtained | |||
3819 | above by applying default conversions instead. */ | |||
3820 | tree origtype = (!origtypes) ? NULL_TREE(tree) __null : (*origtypes)[parmnum]; | |||
3821 | convert_argument (ploc, function, fundecl, builtin_type, origtype, | |||
3822 | val, valtype, npc, rname, parmnum, argnum, | |||
3823 | excess_precision, | |||
3824 | OPT_Wbuiltin_declaration_mismatch); | |||
3825 | } | |||
3826 | ||||
3827 | if (typetail) | |||
3828 | typetail = TREE_CHAIN (typetail)((contains_struct_check ((typetail), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3828, __FUNCTION__))->common.chain); | |||
3829 | ||||
3830 | if (builtin_typetail) | |||
3831 | builtin_typetail = TREE_CHAIN (builtin_typetail)((contains_struct_check ((builtin_typetail), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3831, __FUNCTION__))->common.chain); | |||
3832 | } | |||
3833 | ||||
3834 | gcc_assert (parmnum == vec_safe_length (values))((void)(!(parmnum == vec_safe_length (values)) ? fancy_abort ( "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3834, __FUNCTION__), 0 : 0)); | |||
3835 | ||||
3836 | if (typetail != NULL_TREE(tree) __null && TREE_VALUE (typetail)((tree_check ((typetail), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3836, __FUNCTION__, (TREE_LIST)))->list.value) != void_type_nodeglobal_trees[TI_VOID_TYPE]) | |||
3837 | { | |||
3838 | error_at (loc, "too few arguments to function %qE", function); | |||
3839 | inform_declaration (fundecl); | |||
3840 | return -1; | |||
3841 | } | |||
3842 | ||||
3843 | if (builtin_typetail && TREE_VALUE (builtin_typetail)((tree_check ((builtin_typetail), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3843, __FUNCTION__, (TREE_LIST)))->list.value) != void_type_nodeglobal_trees[TI_VOID_TYPE]) | |||
3844 | { | |||
3845 | unsigned nargs = parmnum; | |||
3846 | for (tree t = builtin_typetail; t; t = TREE_CHAIN (t)((contains_struct_check ((t), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3846, __FUNCTION__))->common.chain)) | |||
3847 | ++nargs; | |||
3848 | ||||
3849 | if (warning_at (loc, OPT_Wbuiltin_declaration_mismatch, | |||
3850 | "too few arguments to built-in function %qE " | |||
3851 | "expecting %u", function, nargs - 1)) | |||
3852 | inform_declaration (fundecl); | |||
3853 | } | |||
3854 | ||||
3855 | return error_args ? -1 : (int) parmnum; | |||
3856 | } | |||
3857 | ||||
3858 | /* This is the entry point used by the parser to build unary operators | |||
3859 | in the input. CODE, a tree_code, specifies the unary operator, and | |||
3860 | ARG is the operand. For unary plus, the C parser currently uses | |||
3861 | CONVERT_EXPR for code. | |||
3862 | ||||
3863 | LOC is the location to use for the tree generated. | |||
3864 | */ | |||
3865 | ||||
3866 | struct c_expr | |||
3867 | parser_build_unary_op (location_t loc, enum tree_code code, struct c_expr arg) | |||
3868 | { | |||
3869 | struct c_expr result; | |||
3870 | ||||
3871 | result.original_code = code; | |||
3872 | result.original_type = NULL__null; | |||
3873 | result.m_decimal = 0; | |||
3874 | ||||
3875 | if (reject_gcc_builtin (arg.value)) | |||
3876 | { | |||
3877 | result.value = error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
3878 | } | |||
3879 | else | |||
3880 | { | |||
3881 | result.value = build_unary_op (loc, code, arg.value, false); | |||
3882 | ||||
3883 | if (TREE_OVERFLOW_P (result.value)((tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) (result.value)->base.code))] == tcc_constant) && ((tree_class_check ((result.value), (tcc_constant), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3883, __FUNCTION__))->base.public_flag)) && !TREE_OVERFLOW_P (arg.value)((tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) (arg.value)->base.code))] == tcc_constant) && ((tree_class_check ((arg.value), (tcc_constant), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3883, __FUNCTION__))->base.public_flag))) | |||
3884 | overflow_warning (loc, result.value, arg.value); | |||
3885 | } | |||
3886 | ||||
3887 | /* We are typically called when parsing a prefix token at LOC acting on | |||
3888 | ARG. Reflect this by updating the source range of the result to | |||
3889 | start at LOC and end at the end of ARG. */ | |||
3890 | set_c_expr_source_range (&result, | |||
3891 | loc, arg.get_finish ()); | |||
3892 | ||||
3893 | return result; | |||
3894 | } | |||
3895 | ||||
3896 | /* Returns true if TYPE is a character type, *not* including wchar_t. */ | |||
3897 | ||||
3898 | bool | |||
3899 | char_type_p (tree type) | |||
3900 | { | |||
3901 | return (type == char_type_nodeinteger_types[itk_char] | |||
3902 | || type == unsigned_char_type_nodeinteger_types[itk_unsigned_char] | |||
3903 | || type == signed_char_type_nodeinteger_types[itk_signed_char] | |||
3904 | || type == char16_type_nodec_global_trees[CTI_CHAR16_TYPE] | |||
3905 | || type == char32_type_nodec_global_trees[CTI_CHAR32_TYPE]); | |||
3906 | } | |||
3907 | ||||
3908 | /* This is the entry point used by the parser to build binary operators | |||
3909 | in the input. CODE, a tree_code, specifies the binary operator, and | |||
3910 | ARG1 and ARG2 are the operands. In addition to constructing the | |||
3911 | expression, we check for operands that were written with other binary | |||
3912 | operators in a way that is likely to confuse the user. | |||
3913 | ||||
3914 | LOCATION is the location of the binary operator. */ | |||
3915 | ||||
3916 | struct c_expr | |||
3917 | parser_build_binary_op (location_t location, enum tree_code code, | |||
3918 | struct c_expr arg1, struct c_expr arg2) | |||
3919 | { | |||
3920 | struct c_expr result; | |||
3921 | result.m_decimal = 0; | |||
3922 | ||||
3923 | enum tree_code code1 = arg1.original_code; | |||
3924 | enum tree_code code2 = arg2.original_code; | |||
3925 | tree type1 = (arg1.original_type | |||
3926 | ? arg1.original_type | |||
3927 | : TREE_TYPE (arg1.value)((contains_struct_check ((arg1.value), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3927, __FUNCTION__))->typed.type)); | |||
3928 | tree type2 = (arg2.original_type | |||
3929 | ? arg2.original_type | |||
3930 | : TREE_TYPE (arg2.value)((contains_struct_check ((arg2.value), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3930, __FUNCTION__))->typed.type)); | |||
3931 | ||||
3932 | result.value = build_binary_op (location, code, | |||
3933 | arg1.value, arg2.value, true); | |||
3934 | result.original_code = code; | |||
3935 | result.original_type = NULL__null; | |||
3936 | result.m_decimal = 0; | |||
3937 | ||||
3938 | if (TREE_CODE (result.value)((enum tree_code) (result.value)->base.code) == ERROR_MARK) | |||
3939 | { | |||
3940 | set_c_expr_source_range (&result, | |||
3941 | arg1.get_start (), | |||
3942 | arg2.get_finish ()); | |||
3943 | return result; | |||
3944 | } | |||
3945 | ||||
3946 | if (location != UNKNOWN_LOCATION((location_t) 0)) | |||
3947 | protected_set_expr_location (result.value, location); | |||
3948 | ||||
3949 | set_c_expr_source_range (&result, | |||
3950 | arg1.get_start (), | |||
3951 | arg2.get_finish ()); | |||
3952 | ||||
3953 | /* Check for cases such as x+y<<z which users are likely | |||
3954 | to misinterpret. */ | |||
3955 | if (warn_parenthesesglobal_options.x_warn_parentheses) | |||
3956 | warn_about_parentheses (location, code, code1, arg1.value, code2, | |||
3957 | arg2.value); | |||
3958 | ||||
3959 | if (warn_logical_opglobal_options.x_warn_logical_op) | |||
3960 | warn_logical_operator (location, code, TREE_TYPE (result.value)((contains_struct_check ((result.value), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3960, __FUNCTION__))->typed.type), | |||
3961 | code1, arg1.value, code2, arg2.value); | |||
3962 | ||||
3963 | if (warn_tautological_compareglobal_options.x_warn_tautological_compare) | |||
3964 | { | |||
3965 | tree lhs = arg1.value; | |||
3966 | tree rhs = arg2.value; | |||
3967 | if (TREE_CODE (lhs)((enum tree_code) (lhs)->base.code) == C_MAYBE_CONST_EXPR) | |||
3968 | { | |||
3969 | if (C_MAYBE_CONST_EXPR_PRE (lhs)(*((const_cast<tree*> (tree_operand_check (((tree_check ((lhs), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3969, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3969, __FUNCTION__))))) != NULL_TREE(tree) __null | |||
3970 | && TREE_SIDE_EFFECTS (C_MAYBE_CONST_EXPR_PRE (lhs))((non_type_check (((*((const_cast<tree*> (tree_operand_check (((tree_check ((lhs), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3970, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3970, __FUNCTION__)))))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3970, __FUNCTION__))->base.side_effects_flag)) | |||
3971 | lhs = NULL_TREE(tree) __null; | |||
3972 | else | |||
3973 | lhs = C_MAYBE_CONST_EXPR_EXPR (lhs)(*((const_cast<tree*> (tree_operand_check (((tree_check ((lhs), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3973, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3973, __FUNCTION__))))); | |||
3974 | } | |||
3975 | if (TREE_CODE (rhs)((enum tree_code) (rhs)->base.code) == C_MAYBE_CONST_EXPR) | |||
3976 | { | |||
3977 | if (C_MAYBE_CONST_EXPR_PRE (rhs)(*((const_cast<tree*> (tree_operand_check (((tree_check ((rhs), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3977, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3977, __FUNCTION__))))) != NULL_TREE(tree) __null | |||
3978 | && TREE_SIDE_EFFECTS (C_MAYBE_CONST_EXPR_PRE (rhs))((non_type_check (((*((const_cast<tree*> (tree_operand_check (((tree_check ((rhs), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3978, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3978, __FUNCTION__)))))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3978, __FUNCTION__))->base.side_effects_flag)) | |||
3979 | rhs = NULL_TREE(tree) __null; | |||
3980 | else | |||
3981 | rhs = C_MAYBE_CONST_EXPR_EXPR (rhs)(*((const_cast<tree*> (tree_operand_check (((tree_check ((rhs), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3981, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3981, __FUNCTION__))))); | |||
3982 | } | |||
3983 | if (lhs != NULL_TREE(tree) __null && rhs != NULL_TREE(tree) __null) | |||
3984 | warn_tautological_cmp (location, code, lhs, rhs); | |||
3985 | } | |||
3986 | ||||
3987 | if (warn_logical_not_parenglobal_options.x_warn_logical_not_paren | |||
3988 | && TREE_CODE_CLASS (code)tree_code_type_tmpl <0>::tree_code_type[(int) (code)] == tcc_comparison | |||
3989 | && code1 == TRUTH_NOT_EXPR | |||
3990 | && code2 != TRUTH_NOT_EXPR | |||
3991 | /* Avoid warning for !!x == y. */ | |||
3992 | && (TREE_CODE (arg1.value)((enum tree_code) (arg1.value)->base.code) != NE_EXPR | |||
3993 | || !integer_zerop (TREE_OPERAND (arg1.value, 1)(*((const_cast<tree*> (tree_operand_check ((arg1.value) , (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3993, __FUNCTION__)))))))) | |||
3994 | { | |||
3995 | /* Avoid warning for !b == y where b has _Bool type. */ | |||
3996 | tree t = integer_zero_nodeglobal_trees[TI_INTEGER_ZERO]; | |||
3997 | if (TREE_CODE (arg1.value)((enum tree_code) (arg1.value)->base.code) == EQ_EXPR | |||
3998 | && integer_zerop (TREE_OPERAND (arg1.value, 1)(*((const_cast<tree*> (tree_operand_check ((arg1.value) , (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3998, __FUNCTION__)))))) | |||
3999 | && TREE_TYPE (TREE_OPERAND (arg1.value, 0))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check ((arg1.value), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3999, __FUNCTION__)))))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 3999, __FUNCTION__))->typed.type) == integer_type_nodeinteger_types[itk_int]) | |||
4000 | { | |||
4001 | t = TREE_OPERAND (arg1.value, 0)(*((const_cast<tree*> (tree_operand_check ((arg1.value) , (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4001, __FUNCTION__))))); | |||
4002 | do | |||
4003 | { | |||
4004 | if (TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4004, __FUNCTION__))->typed.type) != integer_type_nodeinteger_types[itk_int]) | |||
4005 | break; | |||
4006 | if (TREE_CODE (t)((enum tree_code) (t)->base.code) == C_MAYBE_CONST_EXPR) | |||
4007 | t = C_MAYBE_CONST_EXPR_EXPR (t)(*((const_cast<tree*> (tree_operand_check (((tree_check ((t), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4007, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4007, __FUNCTION__))))); | |||
4008 | else if (CONVERT_EXPR_P (t)((((enum tree_code) (t)->base.code)) == NOP_EXPR || (((enum tree_code) (t)->base.code)) == CONVERT_EXPR)) | |||
4009 | t = TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4009, __FUNCTION__))))); | |||
4010 | else | |||
4011 | break; | |||
4012 | } | |||
4013 | while (1); | |||
4014 | } | |||
4015 | if (!C_BOOLEAN_TYPE_P (TREE_TYPE (t))(((enum tree_code) (((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4015, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE || (((enum tree_code) (((contains_struct_check ((t), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4015, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE && ((contains_struct_check (((tree_check ((((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4015, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4015, __FUNCTION__, (ENUMERAL_TYPE)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4015, __FUNCTION__))->typed.type) != (tree) __null && ((enum tree_code) (((contains_struct_check (((tree_check ((( (contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4015, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4015, __FUNCTION__, (ENUMERAL_TYPE)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4015, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE ))) | |||
4016 | warn_logical_not_parentheses (location, code, arg1.value, arg2.value); | |||
4017 | } | |||
4018 | ||||
4019 | /* Warn about comparisons against string literals, with the exception | |||
4020 | of testing for equality or inequality of a string literal with NULL. */ | |||
4021 | if (code == EQ_EXPR || code == NE_EXPR) | |||
4022 | { | |||
4023 | if ((code1 == STRING_CST | |||
4024 | && !integer_zerop (tree_strip_nop_conversions (arg2.value))) | |||
4025 | || (code2 == STRING_CST | |||
4026 | && !integer_zerop (tree_strip_nop_conversions (arg1.value)))) | |||
4027 | warning_at (location, OPT_Waddress, | |||
4028 | "comparison with string literal results in unspecified behavior"); | |||
4029 | /* Warn for ptr == '\0', it's likely that it should've been ptr[0]. */ | |||
4030 | if (POINTER_TYPE_P (type1)(((enum tree_code) (type1)->base.code) == POINTER_TYPE || ( (enum tree_code) (type1)->base.code) == REFERENCE_TYPE) | |||
4031 | && null_pointer_constant_p (arg2.value) | |||
4032 | && char_type_p (type2)) | |||
4033 | { | |||
4034 | auto_diagnostic_group d; | |||
4035 | if (warning_at (location, OPT_Wpointer_compare, | |||
4036 | "comparison between pointer and zero character " | |||
4037 | "constant")) | |||
4038 | inform (arg1.get_start (), | |||
4039 | "did you mean to dereference the pointer?"); | |||
4040 | } | |||
4041 | else if (POINTER_TYPE_P (type2)(((enum tree_code) (type2)->base.code) == POINTER_TYPE || ( (enum tree_code) (type2)->base.code) == REFERENCE_TYPE) | |||
4042 | && null_pointer_constant_p (arg1.value) | |||
4043 | && char_type_p (type1)) | |||
4044 | { | |||
4045 | auto_diagnostic_group d; | |||
4046 | if (warning_at (location, OPT_Wpointer_compare, | |||
4047 | "comparison between pointer and zero character " | |||
4048 | "constant")) | |||
4049 | inform (arg2.get_start (), | |||
4050 | "did you mean to dereference the pointer?"); | |||
4051 | } | |||
4052 | } | |||
4053 | else if (TREE_CODE_CLASS (code)tree_code_type_tmpl <0>::tree_code_type[(int) (code)] == tcc_comparison | |||
4054 | && (code1 == STRING_CST || code2 == STRING_CST)) | |||
4055 | warning_at (location, OPT_Waddress, | |||
4056 | "comparison with string literal results in unspecified " | |||
4057 | "behavior"); | |||
4058 | ||||
4059 | if (warn_array_compareglobal_options.x_warn_array_compare | |||
4060 | && TREE_CODE_CLASS (code)tree_code_type_tmpl <0>::tree_code_type[(int) (code)] == tcc_comparison | |||
4061 | && TREE_CODE (type1)((enum tree_code) (type1)->base.code) == ARRAY_TYPE | |||
4062 | && TREE_CODE (type2)((enum tree_code) (type2)->base.code) == ARRAY_TYPE) | |||
4063 | do_warn_array_compare (location, code, arg1.value, arg2.value); | |||
4064 | ||||
4065 | if (TREE_OVERFLOW_P (result.value)((tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) (result.value)->base.code))] == tcc_constant) && ((tree_class_check ((result.value), (tcc_constant), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4065, __FUNCTION__))->base.public_flag)) | |||
4066 | && !TREE_OVERFLOW_P (arg1.value)((tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) (arg1.value)->base.code))] == tcc_constant) && ((tree_class_check ((arg1.value), (tcc_constant), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4066, __FUNCTION__))->base.public_flag)) | |||
4067 | && !TREE_OVERFLOW_P (arg2.value)((tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) (arg2.value)->base.code))] == tcc_constant) && ((tree_class_check ((arg2.value), (tcc_constant), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4067, __FUNCTION__))->base.public_flag))) | |||
4068 | overflow_warning (location, result.value); | |||
4069 | ||||
4070 | /* Warn about comparisons of different enum types. */ | |||
4071 | if (warn_enum_compareglobal_options.x_warn_enum_compare | |||
4072 | && TREE_CODE_CLASS (code)tree_code_type_tmpl <0>::tree_code_type[(int) (code)] == tcc_comparison | |||
4073 | && TREE_CODE (type1)((enum tree_code) (type1)->base.code) == ENUMERAL_TYPE | |||
4074 | && TREE_CODE (type2)((enum tree_code) (type2)->base.code) == ENUMERAL_TYPE | |||
4075 | && TYPE_MAIN_VARIANT (type1)((tree_class_check ((type1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4075, __FUNCTION__))->type_common.main_variant) != TYPE_MAIN_VARIANT (type2)((tree_class_check ((type2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4075, __FUNCTION__))->type_common.main_variant)) | |||
4076 | warning_at (location, OPT_Wenum_compare, | |||
4077 | "comparison between %qT and %qT", | |||
4078 | type1, type2); | |||
4079 | ||||
4080 | if (warn_xor_used_as_powglobal_options.x_warn_xor_used_as_pow | |||
4081 | && code == BIT_XOR_EXPR | |||
4082 | && arg1.m_decimal | |||
4083 | && arg2.m_decimal) | |||
4084 | check_for_xor_used_as_pow (arg1.get_location (), arg1.value, | |||
4085 | location, | |||
4086 | arg2.value); | |||
4087 | ||||
4088 | return result; | |||
4089 | } | |||
4090 | ||||
4091 | /* Return a tree for the difference of pointers OP0 and OP1. | |||
4092 | The resulting tree has type ptrdiff_t. If POINTER_SUBTRACT sanitization is | |||
4093 | enabled, assign to INSTRUMENT_EXPR call to libsanitizer. */ | |||
4094 | ||||
4095 | static tree | |||
4096 | pointer_diff (location_t loc, tree op0, tree op1, tree *instrument_expr) | |||
4097 | { | |||
4098 | tree restype = ptrdiff_type_nodeglobal_trees[TI_PTRDIFF_TYPE]; | |||
4099 | tree result, inttype; | |||
4100 | ||||
4101 | addr_space_t as0 = TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (op0)))((tree_class_check ((((contains_struct_check ((((contains_struct_check ((op0), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4101, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4101, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4101, __FUNCTION__))->base.u.bits.address_space); | |||
4102 | addr_space_t as1 = TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (op1)))((tree_class_check ((((contains_struct_check ((((contains_struct_check ((op1), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4102, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4102, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4102, __FUNCTION__))->base.u.bits.address_space); | |||
4103 | tree target_type = TREE_TYPE (TREE_TYPE (op0))((contains_struct_check ((((contains_struct_check ((op0), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4103, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4103, __FUNCTION__))->typed.type); | |||
4104 | tree orig_op0 = op0; | |||
4105 | tree orig_op1 = op1; | |||
4106 | ||||
4107 | /* If the operands point into different address spaces, we need to | |||
4108 | explicitly convert them to pointers into the common address space | |||
4109 | before we can subtract the numerical address values. */ | |||
4110 | if (as0 != as1) | |||
4111 | { | |||
4112 | addr_space_t as_common; | |||
4113 | tree common_type; | |||
4114 | ||||
4115 | /* Determine the common superset address space. This is guaranteed | |||
4116 | to exist because the caller verified that comp_target_types | |||
4117 | returned non-zero. */ | |||
4118 | if (!addr_space_superset (as0, as1, &as_common)) | |||
4119 | gcc_unreachable ()(fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4119, __FUNCTION__)); | |||
4120 | ||||
4121 | common_type = common_pointer_type (TREE_TYPE (op0)((contains_struct_check ((op0), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4121, __FUNCTION__))->typed.type), TREE_TYPE (op1)((contains_struct_check ((op1), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4121, __FUNCTION__))->typed.type)); | |||
4122 | op0 = convert (common_type, op0); | |||
4123 | op1 = convert (common_type, op1); | |||
4124 | } | |||
4125 | ||||
4126 | /* Determine integer type result of the subtraction. This will usually | |||
4127 | be the same as the result type (ptrdiff_t), but may need to be a wider | |||
4128 | type if pointers for the address space are wider than ptrdiff_t. */ | |||
4129 | if (TYPE_PRECISION (restype)((tree_class_check ((restype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4129, __FUNCTION__))->type_common.precision) < TYPE_PRECISION (TREE_TYPE (op0))((tree_class_check ((((contains_struct_check ((op0), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4129, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4129, __FUNCTION__))->type_common.precision)) | |||
4130 | inttype = c_common_type_for_size (TYPE_PRECISION (TREE_TYPE (op0))((tree_class_check ((((contains_struct_check ((op0), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4130, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4130, __FUNCTION__))->type_common.precision), 0); | |||
4131 | else | |||
4132 | inttype = restype; | |||
4133 | ||||
4134 | if (TREE_CODE (target_type)((enum tree_code) (target_type)->base.code) == VOID_TYPE) | |||
4135 | pedwarn (loc, OPT_Wpointer_arith, | |||
4136 | "pointer of type %<void *%> used in subtraction"); | |||
4137 | if (TREE_CODE (target_type)((enum tree_code) (target_type)->base.code) == FUNCTION_TYPE) | |||
4138 | pedwarn (loc, OPT_Wpointer_arith, | |||
4139 | "pointer to a function used in subtraction"); | |||
4140 | ||||
4141 | if (current_function_decl != NULL_TREE(tree) __null | |||
4142 | && sanitize_flags_p (SANITIZE_POINTER_SUBTRACT)) | |||
4143 | { | |||
4144 | op0 = save_expr (op0); | |||
4145 | op1 = save_expr (op1); | |||
4146 | ||||
4147 | tree tt = builtin_decl_explicit (BUILT_IN_ASAN_POINTER_SUBTRACT); | |||
4148 | *instrument_expr = build_call_expr_loc (loc, tt, 2, op0, op1); | |||
4149 | } | |||
4150 | ||||
4151 | /* First do the subtraction, then build the divide operator | |||
4152 | and only convert at the very end. | |||
4153 | Do not do default conversions in case restype is a short type. */ | |||
4154 | ||||
4155 | /* POINTER_DIFF_EXPR requires a signed integer type of the same size as | |||
4156 | pointers. If some platform cannot provide that, or has a larger | |||
4157 | ptrdiff_type to support differences larger than half the address | |||
4158 | space, cast the pointers to some larger integer type and do the | |||
4159 | computations in that type. */ | |||
4160 | if (TYPE_PRECISION (inttype)((tree_class_check ((inttype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4160, __FUNCTION__))->type_common.precision) > TYPE_PRECISION (TREE_TYPE (op0))((tree_class_check ((((contains_struct_check ((op0), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4160, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4160, __FUNCTION__))->type_common.precision)) | |||
4161 | op0 = build_binary_op (loc, MINUS_EXPR, convert (inttype, op0), | |||
4162 | convert (inttype, op1), false); | |||
4163 | else | |||
4164 | { | |||
4165 | /* Cast away qualifiers. */ | |||
4166 | op0 = convert (c_common_type (TREE_TYPE (op0)((contains_struct_check ((op0), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4166, __FUNCTION__))->typed.type), TREE_TYPE (op0)((contains_struct_check ((op0), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4166, __FUNCTION__))->typed.type)), op0); | |||
4167 | op1 = convert (c_common_type (TREE_TYPE (op1)((contains_struct_check ((op1), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4167, __FUNCTION__))->typed.type), TREE_TYPE (op1)((contains_struct_check ((op1), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4167, __FUNCTION__))->typed.type)), op1); | |||
4168 | op0 = build2_loc (loc, POINTER_DIFF_EXPR, inttype, op0, op1); | |||
4169 | } | |||
4170 | ||||
4171 | /* This generates an error if op1 is pointer to incomplete type. */ | |||
4172 | if (!COMPLETE_OR_VOID_TYPE_P (TREE_TYPE (TREE_TYPE (orig_op1)))((((tree_class_check ((((contains_struct_check ((((contains_struct_check ((orig_op1), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4172, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4172, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4172, __FUNCTION__))->type_common.size) != (tree) __null ) || (((enum tree_code) (((contains_struct_check ((((contains_struct_check ((orig_op1), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4172, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4172, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE ))) | |||
4173 | error_at (loc, "arithmetic on pointer to an incomplete type"); | |||
4174 | else if (verify_type_context (loc, TCTX_POINTER_ARITH, | |||
4175 | TREE_TYPE (TREE_TYPE (orig_op0))((contains_struct_check ((((contains_struct_check ((orig_op0) , (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4175, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4175, __FUNCTION__))->typed.type))) | |||
4176 | verify_type_context (loc, TCTX_POINTER_ARITH, | |||
4177 | TREE_TYPE (TREE_TYPE (orig_op1))((contains_struct_check ((((contains_struct_check ((orig_op1) , (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4177, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4177, __FUNCTION__))->typed.type)); | |||
4178 | ||||
4179 | op1 = c_size_in_bytes (target_type); | |||
4180 | ||||
4181 | if (pointer_to_zero_sized_aggr_p (TREE_TYPE (orig_op1)((contains_struct_check ((orig_op1), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4181, __FUNCTION__))->typed.type))) | |||
4182 | error_at (loc, "arithmetic on pointer to an empty aggregate"); | |||
4183 | ||||
4184 | /* Divide by the size, in easiest possible way. */ | |||
4185 | result = fold_build2_loc (loc, EXACT_DIV_EXPR, inttype, | |||
4186 | op0, convert (inttype, op1)); | |||
4187 | ||||
4188 | /* Convert to final result type if necessary. */ | |||
4189 | return convert (restype, result); | |||
4190 | } | |||
4191 | ||||
4192 | /* Expand atomic compound assignments into an appropriate sequence as | |||
4193 | specified by the C11 standard section 6.5.16.2. | |||
4194 | ||||
4195 | _Atomic T1 E1 | |||
4196 | T2 E2 | |||
4197 | E1 op= E2 | |||
4198 | ||||
4199 | This sequence is used for all types for which these operations are | |||
4200 | supported. | |||
4201 | ||||
4202 | In addition, built-in versions of the 'fe' prefixed routines may | |||
4203 | need to be invoked for floating point (real, complex or vector) when | |||
4204 | floating-point exceptions are supported. See 6.5.16.2 footnote 113. | |||
4205 | ||||
4206 | T1 newval; | |||
4207 | T1 old; | |||
4208 | T1 *addr | |||
4209 | T2 val | |||
4210 | fenv_t fenv | |||
4211 | ||||
4212 | addr = &E1; | |||
4213 | val = (E2); | |||
4214 | __atomic_load (addr, &old, SEQ_CST); | |||
4215 | feholdexcept (&fenv); | |||
4216 | loop: | |||
4217 | newval = old op val; | |||
4218 | if (__atomic_compare_exchange_strong (addr, &old, &newval, SEQ_CST, | |||
4219 | SEQ_CST)) | |||
4220 | goto done; | |||
4221 | feclearexcept (FE_ALL_EXCEPT); | |||
4222 | goto loop: | |||
4223 | done: | |||
4224 | feupdateenv (&fenv); | |||
4225 | ||||
4226 | The compiler will issue the __atomic_fetch_* built-in when possible, | |||
4227 | otherwise it will generate the generic form of the atomic operations. | |||
4228 | This requires temp(s) and has their address taken. The atomic processing | |||
4229 | is smart enough to figure out when the size of an object can utilize | |||
4230 | a lock-free version, and convert the built-in call to the appropriate | |||
4231 | lock-free routine. The optimizers will then dispose of any temps that | |||
4232 | are no longer required, and lock-free implementations are utilized as | |||
4233 | long as there is target support for the required size. | |||
4234 | ||||
4235 | If the operator is NOP_EXPR, then this is a simple assignment, and | |||
4236 | an __atomic_store is issued to perform the assignment rather than | |||
4237 | the above loop. */ | |||
4238 | ||||
4239 | /* Build an atomic assignment at LOC, expanding into the proper | |||
4240 | sequence to store LHS MODIFYCODE= RHS. Return a value representing | |||
4241 | the result of the operation, unless RETURN_OLD_P, in which case | |||
4242 | return the old value of LHS (this is only for postincrement and | |||
4243 | postdecrement). */ | |||
4244 | ||||
4245 | static tree | |||
4246 | build_atomic_assign (location_t loc, tree lhs, enum tree_code modifycode, | |||
4247 | tree rhs, bool return_old_p) | |||
4248 | { | |||
4249 | tree fndecl, func_call; | |||
4250 | vec<tree, va_gc> *params; | |||
4251 | tree val, nonatomic_lhs_type, nonatomic_rhs_type, newval, newval_addr; | |||
4252 | tree old, old_addr; | |||
4253 | tree compound_stmt = NULL_TREE(tree) __null; | |||
4254 | tree stmt, goto_stmt; | |||
4255 | tree loop_label, loop_decl, done_label, done_decl; | |||
4256 | ||||
4257 | tree lhs_type = TREE_TYPE (lhs)((contains_struct_check ((lhs), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4257, __FUNCTION__))->typed.type); | |||
4258 | tree lhs_addr = build_unary_op (loc, ADDR_EXPR, lhs, false); | |||
4259 | tree seq_cst = build_int_cst (integer_type_nodeinteger_types[itk_int], MEMMODEL_SEQ_CST); | |||
4260 | tree rhs_semantic_type = TREE_TYPE (rhs)((contains_struct_check ((rhs), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4260, __FUNCTION__))->typed.type); | |||
4261 | tree nonatomic_rhs_semantic_type; | |||
4262 | tree rhs_type; | |||
4263 | ||||
4264 | gcc_assert (TYPE_ATOMIC (lhs_type))((void)(!(((tree_class_check ((lhs_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4264, __FUNCTION__))->base.u.bits.atomic_flag)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4264, __FUNCTION__), 0 : 0)); | |||
4265 | ||||
4266 | if (return_old_p) | |||
4267 | gcc_assert (modifycode == PLUS_EXPR || modifycode == MINUS_EXPR)((void)(!(modifycode == PLUS_EXPR || modifycode == MINUS_EXPR ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4267, __FUNCTION__), 0 : 0)); | |||
4268 | ||||
4269 | /* Allocate enough vector items for a compare_exchange. */ | |||
4270 | vec_alloc (params, 6); | |||
4271 | ||||
4272 | /* Create a compound statement to hold the sequence of statements | |||
4273 | with a loop. */ | |||
4274 | if (modifycode != NOP_EXPR) | |||
4275 | { | |||
4276 | compound_stmt = c_begin_compound_stmt (false); | |||
4277 | ||||
4278 | /* For consistency with build_modify_expr on non-_Atomic, | |||
4279 | mark the lhs as read. Also, it would be very hard to match | |||
4280 | such expressions in mark_exp_read. */ | |||
4281 | mark_exp_read (lhs); | |||
4282 | } | |||
4283 | ||||
4284 | /* Remove any excess precision (which is only present here in the | |||
4285 | case of compound assignments). */ | |||
4286 | if (TREE_CODE (rhs)((enum tree_code) (rhs)->base.code) == EXCESS_PRECISION_EXPR) | |||
4287 | { | |||
4288 | gcc_assert (modifycode != NOP_EXPR)((void)(!(modifycode != NOP_EXPR) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4288, __FUNCTION__), 0 : 0)); | |||
4289 | rhs = TREE_OPERAND (rhs, 0)(*((const_cast<tree*> (tree_operand_check ((rhs), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4289, __FUNCTION__))))); | |||
4290 | } | |||
4291 | rhs_type = TREE_TYPE (rhs)((contains_struct_check ((rhs), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4291, __FUNCTION__))->typed.type); | |||
4292 | ||||
4293 | /* Fold the RHS if it hasn't already been folded. */ | |||
4294 | if (modifycode != NOP_EXPR) | |||
4295 | rhs = c_fully_fold (rhs, false, NULL__null); | |||
4296 | ||||
4297 | /* Remove the qualifiers for the rest of the expressions and create | |||
4298 | the VAL temp variable to hold the RHS. */ | |||
4299 | nonatomic_lhs_type = build_qualified_type (lhs_type, TYPE_UNQUALIFIED); | |||
4300 | nonatomic_rhs_type = build_qualified_type (rhs_type, TYPE_UNQUALIFIED); | |||
4301 | nonatomic_rhs_semantic_type = build_qualified_type (rhs_semantic_type, | |||
4302 | TYPE_UNQUALIFIED); | |||
4303 | val = create_tmp_var_raw (nonatomic_rhs_type); | |||
4304 | TREE_ADDRESSABLE (val)((val)->base.addressable_flag) = 1; | |||
4305 | suppress_warning (val); | |||
4306 | rhs = build4 (TARGET_EXPR, nonatomic_rhs_type, val, rhs, NULL_TREE(tree) __null, | |||
4307 | NULL_TREE(tree) __null); | |||
4308 | TREE_SIDE_EFFECTS (rhs)((non_type_check ((rhs), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4308, __FUNCTION__))->base.side_effects_flag) = 1; | |||
4309 | SET_EXPR_LOCATION (rhs, loc)(expr_check (((rhs)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4309, __FUNCTION__))->exp.locus = (loc); | |||
4310 | if (modifycode != NOP_EXPR) | |||
4311 | add_stmt (rhs); | |||
4312 | ||||
4313 | /* NOP_EXPR indicates it's a straight store of the RHS. Simply issue | |||
4314 | an atomic_store. */ | |||
4315 | if (modifycode == NOP_EXPR) | |||
4316 | { | |||
4317 | compound_stmt = rhs; | |||
4318 | /* Build __atomic_store (&lhs, &val, SEQ_CST) */ | |||
4319 | rhs = build_unary_op (loc, ADDR_EXPR, val, false); | |||
4320 | fndecl = builtin_decl_explicit (BUILT_IN_ATOMIC_STORE); | |||
4321 | params->quick_push (lhs_addr); | |||
4322 | params->quick_push (rhs); | |||
4323 | params->quick_push (seq_cst); | |||
4324 | func_call = c_build_function_call_vec (loc, vNULL, fndecl, params, NULL__null); | |||
4325 | ||||
4326 | compound_stmt = build2 (COMPOUND_EXPR, void_type_nodeglobal_trees[TI_VOID_TYPE], | |||
4327 | compound_stmt, func_call); | |||
4328 | ||||
4329 | /* VAL is the value which was stored, return a COMPOUND_STMT of | |||
4330 | the statement and that value. */ | |||
4331 | return build2 (COMPOUND_EXPR, nonatomic_lhs_type, compound_stmt, val); | |||
4332 | } | |||
4333 | ||||
4334 | /* Attempt to implement the atomic operation as an __atomic_fetch_* or | |||
4335 | __atomic_*_fetch built-in rather than a CAS loop. atomic_bool type | |||
4336 | isn't applicable for such builtins. ??? Do we want to handle enums? */ | |||
4337 | if ((TREE_CODE (lhs_type)((enum tree_code) (lhs_type)->base.code) == INTEGER_TYPE || POINTER_TYPE_P (lhs_type)(((enum tree_code) (lhs_type)->base.code) == POINTER_TYPE || ((enum tree_code) (lhs_type)->base.code) == REFERENCE_TYPE )) | |||
4338 | && TREE_CODE (rhs_type)((enum tree_code) (rhs_type)->base.code) == INTEGER_TYPE) | |||
4339 | { | |||
4340 | built_in_function fncode; | |||
4341 | switch (modifycode) | |||
4342 | { | |||
4343 | case PLUS_EXPR: | |||
4344 | case POINTER_PLUS_EXPR: | |||
4345 | fncode = (return_old_p | |||
4346 | ? BUILT_IN_ATOMIC_FETCH_ADD_N | |||
4347 | : BUILT_IN_ATOMIC_ADD_FETCH_N); | |||
4348 | break; | |||
4349 | case MINUS_EXPR: | |||
4350 | fncode = (return_old_p | |||
4351 | ? BUILT_IN_ATOMIC_FETCH_SUB_N | |||
4352 | : BUILT_IN_ATOMIC_SUB_FETCH_N); | |||
4353 | break; | |||
4354 | case BIT_AND_EXPR: | |||
4355 | fncode = (return_old_p | |||
4356 | ? BUILT_IN_ATOMIC_FETCH_AND_N | |||
4357 | : BUILT_IN_ATOMIC_AND_FETCH_N); | |||
4358 | break; | |||
4359 | case BIT_IOR_EXPR: | |||
4360 | fncode = (return_old_p | |||
4361 | ? BUILT_IN_ATOMIC_FETCH_OR_N | |||
4362 | : BUILT_IN_ATOMIC_OR_FETCH_N); | |||
4363 | break; | |||
4364 | case BIT_XOR_EXPR: | |||
4365 | fncode = (return_old_p | |||
4366 | ? BUILT_IN_ATOMIC_FETCH_XOR_N | |||
4367 | : BUILT_IN_ATOMIC_XOR_FETCH_N); | |||
4368 | break; | |||
4369 | default: | |||
4370 | goto cas_loop; | |||
4371 | } | |||
4372 | ||||
4373 | /* We can only use "_1" through "_16" variants of the atomic fetch | |||
4374 | built-ins. */ | |||
4375 | unsigned HOST_WIDE_INTlong size = tree_to_uhwi (TYPE_SIZE_UNIT (lhs_type)((tree_class_check ((lhs_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4375, __FUNCTION__))->type_common.size_unit)); | |||
4376 | if (size != 1 && size != 2 && size != 4 && size != 8 && size != 16) | |||
4377 | goto cas_loop; | |||
4378 | ||||
4379 | /* If this is a pointer type, we need to multiply by the size of | |||
4380 | the pointer target type. */ | |||
4381 | if (POINTER_TYPE_P (lhs_type)(((enum tree_code) (lhs_type)->base.code) == POINTER_TYPE || ((enum tree_code) (lhs_type)->base.code) == REFERENCE_TYPE )) | |||
4382 | { | |||
4383 | if (!COMPLETE_TYPE_P (TREE_TYPE (lhs_type))(((tree_class_check ((((contains_struct_check ((lhs_type), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4383, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4383, __FUNCTION__))->type_common.size) != (tree) __null ) | |||
4384 | /* ??? This would introduce -Wdiscarded-qualifiers | |||
4385 | warning: __atomic_fetch_* expect volatile void * | |||
4386 | type as the first argument. (Assignments between | |||
4387 | atomic and non-atomic objects are OK.) */ | |||
4388 | || TYPE_RESTRICT (lhs_type)((tree_class_check ((lhs_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4388, __FUNCTION__))->type_common.restrict_flag)) | |||
4389 | goto cas_loop; | |||
4390 | tree sz = TYPE_SIZE_UNIT (TREE_TYPE (lhs_type))((tree_class_check ((((contains_struct_check ((lhs_type), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4390, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4390, __FUNCTION__))->type_common.size_unit); | |||
4391 | rhs = fold_build2_loc (loc, MULT_EXPR, ptrdiff_type_nodeglobal_trees[TI_PTRDIFF_TYPE], | |||
4392 | convert (ptrdiff_type_nodeglobal_trees[TI_PTRDIFF_TYPE], rhs), | |||
4393 | convert (ptrdiff_type_nodeglobal_trees[TI_PTRDIFF_TYPE], sz)); | |||
4394 | } | |||
4395 | ||||
4396 | /* Build __atomic_fetch_* (&lhs, &val, SEQ_CST), or | |||
4397 | __atomic_*_fetch (&lhs, &val, SEQ_CST). */ | |||
4398 | fndecl = builtin_decl_explicit (fncode); | |||
4399 | params->quick_push (lhs_addr); | |||
4400 | params->quick_push (rhs); | |||
4401 | params->quick_push (seq_cst); | |||
4402 | func_call = c_build_function_call_vec (loc, vNULL, fndecl, params, NULL__null); | |||
4403 | ||||
4404 | newval = create_tmp_var_raw (nonatomic_lhs_type); | |||
4405 | TREE_ADDRESSABLE (newval)((newval)->base.addressable_flag) = 1; | |||
4406 | suppress_warning (newval); | |||
4407 | rhs = build4 (TARGET_EXPR, nonatomic_lhs_type, newval, func_call, | |||
4408 | NULL_TREE(tree) __null, NULL_TREE(tree) __null); | |||
4409 | SET_EXPR_LOCATION (rhs, loc)(expr_check (((rhs)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4409, __FUNCTION__))->exp.locus = (loc); | |||
4410 | add_stmt (rhs); | |||
4411 | ||||
4412 | /* Finish the compound statement. */ | |||
4413 | compound_stmt = c_end_compound_stmt (loc, compound_stmt, false); | |||
4414 | ||||
4415 | /* NEWVAL is the value which was stored, return a COMPOUND_STMT of | |||
4416 | the statement and that value. */ | |||
4417 | return build2 (COMPOUND_EXPR, nonatomic_lhs_type, compound_stmt, newval); | |||
4418 | } | |||
4419 | ||||
4420 | cas_loop: | |||
4421 | /* Create the variables and labels required for the op= form. */ | |||
4422 | old = create_tmp_var_raw (nonatomic_lhs_type); | |||
4423 | old_addr = build_unary_op (loc, ADDR_EXPR, old, false); | |||
4424 | TREE_ADDRESSABLE (old)((old)->base.addressable_flag) = 1; | |||
4425 | suppress_warning (old); | |||
4426 | ||||
4427 | newval = create_tmp_var_raw (nonatomic_lhs_type); | |||
4428 | newval_addr = build_unary_op (loc, ADDR_EXPR, newval, false); | |||
4429 | TREE_ADDRESSABLE (newval)((newval)->base.addressable_flag) = 1; | |||
4430 | suppress_warning (newval); | |||
4431 | ||||
4432 | loop_decl = create_artificial_label (loc); | |||
4433 | loop_label = build1 (LABEL_EXPR, void_type_nodeglobal_trees[TI_VOID_TYPE], loop_decl); | |||
4434 | ||||
4435 | done_decl = create_artificial_label (loc); | |||
4436 | done_label = build1 (LABEL_EXPR, void_type_nodeglobal_trees[TI_VOID_TYPE], done_decl); | |||
4437 | ||||
4438 | /* __atomic_load (addr, &old, SEQ_CST). */ | |||
4439 | fndecl = builtin_decl_explicit (BUILT_IN_ATOMIC_LOAD); | |||
4440 | params->quick_push (lhs_addr); | |||
4441 | params->quick_push (old_addr); | |||
4442 | params->quick_push (seq_cst); | |||
4443 | func_call = c_build_function_call_vec (loc, vNULL, fndecl, params, NULL__null); | |||
4444 | old = build4 (TARGET_EXPR, nonatomic_lhs_type, old, func_call, NULL_TREE(tree) __null, | |||
4445 | NULL_TREE(tree) __null); | |||
4446 | add_stmt (old); | |||
4447 | params->truncate (0); | |||
4448 | ||||
4449 | /* Create the expressions for floating-point environment | |||
4450 | manipulation, if required. */ | |||
4451 | bool need_fenv = (flag_trapping_mathglobal_options.x_flag_trapping_math | |||
4452 | && (FLOAT_TYPE_P (lhs_type)((((enum tree_code) (lhs_type)->base.code) == REAL_TYPE) || ((((enum tree_code) (lhs_type)->base.code) == COMPLEX_TYPE || (((enum tree_code) (lhs_type)->base.code) == VECTOR_TYPE )) && (((enum tree_code) (((contains_struct_check ((lhs_type ), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4452, __FUNCTION__))->typed.type))->base.code) == REAL_TYPE ))) || FLOAT_TYPE_P (rhs_type)((((enum tree_code) (rhs_type)->base.code) == REAL_TYPE) || ((((enum tree_code) (rhs_type)->base.code) == COMPLEX_TYPE || (((enum tree_code) (rhs_type)->base.code) == VECTOR_TYPE )) && (((enum tree_code) (((contains_struct_check ((rhs_type ), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4452, __FUNCTION__))->typed.type))->base.code) == REAL_TYPE ))))); | |||
4453 | tree hold_call = NULL_TREE(tree) __null, clear_call = NULL_TREE(tree) __null, update_call = NULL_TREE(tree) __null; | |||
4454 | if (need_fenv) | |||
4455 | targetm.atomic_assign_expand_fenv (&hold_call, &clear_call, &update_call); | |||
4456 | ||||
4457 | if (hold_call) | |||
4458 | add_stmt (hold_call); | |||
4459 | ||||
4460 | /* loop: */ | |||
4461 | add_stmt (loop_label); | |||
4462 | ||||
4463 | /* newval = old + val; */ | |||
4464 | if (rhs_type != rhs_semantic_type) | |||
4465 | val = build1 (EXCESS_PRECISION_EXPR, nonatomic_rhs_semantic_type, val); | |||
4466 | rhs = build_binary_op (loc, modifycode, old, val, true); | |||
4467 | if (TREE_CODE (rhs)((enum tree_code) (rhs)->base.code) == EXCESS_PRECISION_EXPR) | |||
4468 | { | |||
4469 | tree eptype = TREE_TYPE (rhs)((contains_struct_check ((rhs), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4469, __FUNCTION__))->typed.type); | |||
4470 | rhs = c_fully_fold (TREE_OPERAND (rhs, 0)(*((const_cast<tree*> (tree_operand_check ((rhs), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4470, __FUNCTION__))))), false, NULL__null); | |||
4471 | rhs = build1 (EXCESS_PRECISION_EXPR, eptype, rhs); | |||
4472 | } | |||
4473 | else | |||
4474 | rhs = c_fully_fold (rhs, false, NULL__null); | |||
4475 | rhs = convert_for_assignment (loc, UNKNOWN_LOCATION((location_t) 0), nonatomic_lhs_type, | |||
4476 | rhs, NULL_TREE(tree) __null, ic_assign, false, NULL_TREE(tree) __null, | |||
4477 | NULL_TREE(tree) __null, 0); | |||
4478 | if (rhs != error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
4479 | { | |||
4480 | rhs = build4 (TARGET_EXPR, nonatomic_lhs_type, newval, rhs, NULL_TREE(tree) __null, | |||
4481 | NULL_TREE(tree) __null); | |||
4482 | SET_EXPR_LOCATION (rhs, loc)(expr_check (((rhs)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4482, __FUNCTION__))->exp.locus = (loc); | |||
4483 | add_stmt (rhs); | |||
4484 | } | |||
4485 | ||||
4486 | /* if (__atomic_compare_exchange (addr, &old, &new, false, SEQ_CST, SEQ_CST)) | |||
4487 | goto done; */ | |||
4488 | fndecl = builtin_decl_explicit (BUILT_IN_ATOMIC_COMPARE_EXCHANGE); | |||
4489 | params->quick_push (lhs_addr); | |||
4490 | params->quick_push (old_addr); | |||
4491 | params->quick_push (newval_addr); | |||
4492 | params->quick_push (integer_zero_nodeglobal_trees[TI_INTEGER_ZERO]); | |||
4493 | params->quick_push (seq_cst); | |||
4494 | params->quick_push (seq_cst); | |||
4495 | func_call = c_build_function_call_vec (loc, vNULL, fndecl, params, NULL__null); | |||
4496 | ||||
4497 | goto_stmt = build1 (GOTO_EXPR, void_type_nodeglobal_trees[TI_VOID_TYPE], done_decl); | |||
4498 | SET_EXPR_LOCATION (goto_stmt, loc)(expr_check (((goto_stmt)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4498, __FUNCTION__))->exp.locus = (loc); | |||
4499 | ||||
4500 | stmt = build3 (COND_EXPR, void_type_nodeglobal_trees[TI_VOID_TYPE], func_call, goto_stmt, NULL_TREE(tree) __null); | |||
4501 | SET_EXPR_LOCATION (stmt, loc)(expr_check (((stmt)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4501, __FUNCTION__))->exp.locus = (loc); | |||
4502 | add_stmt (stmt); | |||
4503 | ||||
4504 | if (clear_call) | |||
4505 | add_stmt (clear_call); | |||
4506 | ||||
4507 | /* goto loop; */ | |||
4508 | goto_stmt = build1 (GOTO_EXPR, void_type_nodeglobal_trees[TI_VOID_TYPE], loop_decl); | |||
4509 | SET_EXPR_LOCATION (goto_stmt, loc)(expr_check (((goto_stmt)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4509, __FUNCTION__))->exp.locus = (loc); | |||
4510 | add_stmt (goto_stmt); | |||
4511 | ||||
4512 | /* done: */ | |||
4513 | add_stmt (done_label); | |||
4514 | ||||
4515 | if (update_call) | |||
4516 | add_stmt (update_call); | |||
4517 | ||||
4518 | /* Finish the compound statement. */ | |||
4519 | compound_stmt = c_end_compound_stmt (loc, compound_stmt, false); | |||
4520 | ||||
4521 | /* NEWVAL is the value that was successfully stored, return a | |||
4522 | COMPOUND_EXPR of the statement and the appropriate value. */ | |||
4523 | return build2 (COMPOUND_EXPR, nonatomic_lhs_type, compound_stmt, | |||
4524 | return_old_p ? old : newval); | |||
4525 | } | |||
4526 | ||||
4527 | /* Construct and perhaps optimize a tree representation | |||
4528 | for a unary operation. CODE, a tree_code, specifies the operation | |||
4529 | and XARG is the operand. | |||
4530 | For any CODE other than ADDR_EXPR, NOCONVERT suppresses the default | |||
4531 | promotions (such as from short to int). | |||
4532 | For ADDR_EXPR, the default promotions are not applied; NOCONVERT allows | |||
4533 | non-lvalues; this is only used to handle conversion of non-lvalue arrays | |||
4534 | to pointers in C99. | |||
4535 | ||||
4536 | LOCATION is the location of the operator. */ | |||
4537 | ||||
4538 | tree | |||
4539 | build_unary_op (location_t location, enum tree_code code, tree xarg, | |||
4540 | bool noconvert) | |||
4541 | { | |||
4542 | /* No default_conversion here. It causes trouble for ADDR_EXPR. */ | |||
4543 | tree arg = xarg; | |||
4544 | tree argtype = NULL_TREE(tree) __null; | |||
4545 | enum tree_code typecode; | |||
4546 | tree val; | |||
4547 | tree ret = error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
4548 | tree eptype = NULL_TREE(tree) __null; | |||
4549 | const char *invalid_op_diag; | |||
4550 | bool int_operands; | |||
4551 | ||||
4552 | int_operands = EXPR_INT_CONST_OPERANDS (xarg)((((enum tree_code) (((contains_struct_check ((xarg), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4552, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE || ((enum tree_code) (((contains_struct_check ((xarg), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4552, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE || ((enum tree_code) (((contains_struct_check ((xarg), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4552, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE ) && (((enum tree_code) (xarg)->base.code) == INTEGER_CST || (((enum tree_code) (xarg)->base.code) == C_MAYBE_CONST_EXPR && ((tree_not_check2 (((tree_check ((xarg), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4552, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4552, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_0)))); | |||
4553 | if (int_operands) | |||
4554 | arg = remove_c_maybe_const_expr (arg); | |||
4555 | ||||
4556 | if (code != ADDR_EXPR) | |||
4557 | arg = require_complete_type (location, arg); | |||
4558 | ||||
4559 | typecode = TREE_CODE (TREE_TYPE (arg))((enum tree_code) (((contains_struct_check ((arg), (TS_TYPED) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4559, __FUNCTION__))->typed.type))->base.code); | |||
4560 | if (typecode == ERROR_MARK) | |||
4561 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
4562 | if (typecode == ENUMERAL_TYPE || typecode == BOOLEAN_TYPE) | |||
4563 | typecode = INTEGER_TYPE; | |||
4564 | ||||
4565 | if ((invalid_op_diag | |||
4566 | = targetm.invalid_unary_op (code, TREE_TYPE (xarg)((contains_struct_check ((xarg), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4566, __FUNCTION__))->typed.type)))) | |||
4567 | { | |||
4568 | error_at (location, invalid_op_diag); | |||
4569 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
4570 | } | |||
4571 | ||||
4572 | if (TREE_CODE (arg)((enum tree_code) (arg)->base.code) == EXCESS_PRECISION_EXPR) | |||
4573 | { | |||
4574 | eptype = TREE_TYPE (arg)((contains_struct_check ((arg), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4574, __FUNCTION__))->typed.type); | |||
4575 | arg = TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4575, __FUNCTION__))))); | |||
4576 | } | |||
4577 | ||||
4578 | switch (code) | |||
4579 | { | |||
4580 | case CONVERT_EXPR: | |||
4581 | /* This is used for unary plus, because a CONVERT_EXPR | |||
4582 | is enough to prevent anybody from looking inside for | |||
4583 | associativity, but won't generate any code. */ | |||
4584 | if (!(typecode == INTEGER_TYPE || typecode == REAL_TYPE | |||
4585 | || typecode == FIXED_POINT_TYPE || typecode == COMPLEX_TYPE | |||
4586 | || gnu_vector_type_p (TREE_TYPE (arg)((contains_struct_check ((arg), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4586, __FUNCTION__))->typed.type)))) | |||
4587 | { | |||
4588 | error_at (location, "wrong type argument to unary plus"); | |||
4589 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
4590 | } | |||
4591 | else if (!noconvert) | |||
4592 | arg = default_conversion (arg); | |||
4593 | arg = non_lvalue_loc (location, arg); | |||
4594 | break; | |||
4595 | ||||
4596 | case NEGATE_EXPR: | |||
4597 | if (!(typecode == INTEGER_TYPE || typecode == REAL_TYPE | |||
4598 | || typecode == FIXED_POINT_TYPE || typecode == COMPLEX_TYPE | |||
4599 | || gnu_vector_type_p (TREE_TYPE (arg)((contains_struct_check ((arg), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4599, __FUNCTION__))->typed.type)))) | |||
4600 | { | |||
4601 | error_at (location, "wrong type argument to unary minus"); | |||
4602 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
4603 | } | |||
4604 | else if (!noconvert) | |||
4605 | arg = default_conversion (arg); | |||
4606 | break; | |||
4607 | ||||
4608 | case BIT_NOT_EXPR: | |||
4609 | /* ~ works on integer types and non float vectors. */ | |||
4610 | if (typecode == INTEGER_TYPE | |||
4611 | || (gnu_vector_type_p (TREE_TYPE (arg)((contains_struct_check ((arg), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4611, __FUNCTION__))->typed.type)) | |||
4612 | && !VECTOR_FLOAT_TYPE_P (TREE_TYPE (arg))((((enum tree_code) (((contains_struct_check ((arg), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4612, __FUNCTION__))->typed.type))->base.code) == VECTOR_TYPE ) && ((enum tree_code) (((contains_struct_check ((((contains_struct_check ((arg), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4612, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4612, __FUNCTION__))->typed.type))->base.code) == REAL_TYPE ))) | |||
4613 | { | |||
4614 | tree e = arg; | |||
4615 | ||||
4616 | /* Warn if the expression has boolean value. */ | |||
4617 | while (TREE_CODE (e)((enum tree_code) (e)->base.code) == COMPOUND_EXPR) | |||
4618 | e = TREE_OPERAND (e, 1)(*((const_cast<tree*> (tree_operand_check ((e), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4618, __FUNCTION__))))); | |||
4619 | ||||
4620 | if ((C_BOOLEAN_TYPE_P (TREE_TYPE (arg))(((enum tree_code) (((contains_struct_check ((arg), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4620, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE || (((enum tree_code) (((contains_struct_check ((arg), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4620, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE && ((contains_struct_check (((tree_check ((((contains_struct_check ((arg), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4620, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4620, __FUNCTION__, (ENUMERAL_TYPE)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4620, __FUNCTION__))->typed.type) != (tree) __null && ((enum tree_code) (((contains_struct_check (((tree_check ((( (contains_struct_check ((arg), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4620, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4620, __FUNCTION__, (ENUMERAL_TYPE)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4620, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE )) | |||
4621 | || truth_value_p (TREE_CODE (e)((enum tree_code) (e)->base.code)))) | |||
4622 | { | |||
4623 | auto_diagnostic_group d; | |||
4624 | if (warning_at (location, OPT_Wbool_operation, | |||
4625 | "%<~%> on a boolean expression")) | |||
4626 | { | |||
4627 | gcc_rich_location richloc (location); | |||
4628 | richloc.add_fixit_insert_before (location, "!"); | |||
4629 | inform (&richloc, "did you mean to use logical not?"); | |||
4630 | } | |||
4631 | } | |||
4632 | if (!noconvert) | |||
4633 | arg = default_conversion (arg); | |||
4634 | } | |||
4635 | else if (typecode == COMPLEX_TYPE) | |||
4636 | { | |||
4637 | code = CONJ_EXPR; | |||
4638 | pedwarn (location, OPT_Wpedantic, | |||
4639 | "ISO C does not support %<~%> for complex conjugation"); | |||
4640 | if (!noconvert) | |||
4641 | arg = default_conversion (arg); | |||
4642 | } | |||
4643 | else | |||
4644 | { | |||
4645 | error_at (location, "wrong type argument to bit-complement"); | |||
4646 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
4647 | } | |||
4648 | break; | |||
4649 | ||||
4650 | case ABS_EXPR: | |||
4651 | if (!(typecode == INTEGER_TYPE || typecode == REAL_TYPE)) | |||
4652 | { | |||
4653 | error_at (location, "wrong type argument to abs"); | |||
4654 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
4655 | } | |||
4656 | else if (!noconvert) | |||
4657 | arg = default_conversion (arg); | |||
4658 | break; | |||
4659 | ||||
4660 | case ABSU_EXPR: | |||
4661 | if (!(typecode == INTEGER_TYPE)) | |||
4662 | { | |||
4663 | error_at (location, "wrong type argument to absu"); | |||
4664 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
4665 | } | |||
4666 | else if (!noconvert) | |||
4667 | arg = default_conversion (arg); | |||
4668 | break; | |||
4669 | ||||
4670 | case CONJ_EXPR: | |||
4671 | /* Conjugating a real value is a no-op, but allow it anyway. */ | |||
4672 | if (!(typecode == INTEGER_TYPE || typecode == REAL_TYPE | |||
4673 | || typecode == COMPLEX_TYPE)) | |||
4674 | { | |||
4675 | error_at (location, "wrong type argument to conjugation"); | |||
4676 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
4677 | } | |||
4678 | else if (!noconvert) | |||
4679 | arg = default_conversion (arg); | |||
4680 | break; | |||
4681 | ||||
4682 | case TRUTH_NOT_EXPR: | |||
4683 | if (typecode != INTEGER_TYPE && typecode != FIXED_POINT_TYPE | |||
4684 | && typecode != REAL_TYPE && typecode != POINTER_TYPE | |||
4685 | && typecode != COMPLEX_TYPE && typecode != NULLPTR_TYPE) | |||
4686 | { | |||
4687 | error_at (location, | |||
4688 | "wrong type argument to unary exclamation mark"); | |||
4689 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
4690 | } | |||
4691 | if (int_operands) | |||
4692 | { | |||
4693 | arg = c_objc_common_truthvalue_conversion (location, xarg); | |||
4694 | arg = remove_c_maybe_const_expr (arg); | |||
4695 | } | |||
4696 | else | |||
4697 | arg = c_objc_common_truthvalue_conversion (location, arg); | |||
4698 | ret = invert_truthvalue_loc (location, arg); | |||
4699 | /* If the TRUTH_NOT_EXPR has been folded, reset the location. */ | |||
4700 | if (EXPR_P (ret)((tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) (ret)->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) (ret)->base.code))]) <= tcc_expression) && EXPR_HAS_LOCATION (ret)(((IS_ADHOC_LOC (((((ret)) && ((tree_code_type_tmpl < 0>::tree_code_type[(int) (((enum tree_code) ((ret))->base .code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) ((ret))-> base.code))]) <= tcc_expression)) ? (ret)->exp.locus : ( (location_t) 0)))) ? get_location_from_adhoc_loc (line_table, ((((ret)) && ((tree_code_type_tmpl <0>::tree_code_type [(int) (((enum tree_code) ((ret))->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) ((ret))->base.code))]) <= tcc_expression )) ? (ret)->exp.locus : ((location_t) 0))) : (((((ret)) && ((tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) ((ret))->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) ((ret))->base.code))]) <= tcc_expression)) ? (ret)->exp.locus : ((location_t) 0)))) != ((location_t) 0 ))) | |||
4701 | location = EXPR_LOCATION (ret)((((ret)) && ((tree_code_type_tmpl <0>::tree_code_type [(int) (((enum tree_code) ((ret))->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) ((ret))->base.code))]) <= tcc_expression )) ? (ret)->exp.locus : ((location_t) 0)); | |||
4702 | goto return_build_unary_op; | |||
4703 | ||||
4704 | case REALPART_EXPR: | |||
4705 | case IMAGPART_EXPR: | |||
4706 | ret = build_real_imag_expr (location, code, arg); | |||
4707 | if (ret == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
4708 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
4709 | if (eptype && TREE_CODE (eptype)((enum tree_code) (eptype)->base.code) == COMPLEX_TYPE) | |||
4710 | eptype = TREE_TYPE (eptype)((contains_struct_check ((eptype), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4710, __FUNCTION__))->typed.type); | |||
4711 | goto return_build_unary_op; | |||
4712 | ||||
4713 | case PREINCREMENT_EXPR: | |||
4714 | case POSTINCREMENT_EXPR: | |||
4715 | case PREDECREMENT_EXPR: | |||
4716 | case POSTDECREMENT_EXPR: | |||
4717 | ||||
4718 | if (TREE_CODE (arg)((enum tree_code) (arg)->base.code) == C_MAYBE_CONST_EXPR) | |||
4719 | { | |||
4720 | tree inner = build_unary_op (location, code, | |||
4721 | C_MAYBE_CONST_EXPR_EXPR (arg)(*((const_cast<tree*> (tree_operand_check (((tree_check ((arg), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4721, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4721, __FUNCTION__))))), | |||
4722 | noconvert); | |||
4723 | if (inner == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
4724 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
4725 | ret = build2 (C_MAYBE_CONST_EXPR, TREE_TYPE (inner)((contains_struct_check ((inner), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4725, __FUNCTION__))->typed.type), | |||
4726 | C_MAYBE_CONST_EXPR_PRE (arg)(*((const_cast<tree*> (tree_operand_check (((tree_check ((arg), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4726, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4726, __FUNCTION__))))), inner); | |||
4727 | gcc_assert (!C_MAYBE_CONST_EXPR_INT_OPERANDS (arg))((void)(!(!((tree_not_check2 (((tree_check ((arg), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4727, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4727, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_0)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4727, __FUNCTION__), 0 : 0)); | |||
4728 | C_MAYBE_CONST_EXPR_NON_CONST (ret)((tree_not_check2 (((tree_check ((ret), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4728, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4728, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_1) = 1; | |||
4729 | goto return_build_unary_op; | |||
4730 | } | |||
4731 | ||||
4732 | /* Complain about anything that is not a true lvalue. In | |||
4733 | Objective-C, skip this check for property_refs. */ | |||
4734 | if (!objc_is_property_ref (arg) | |||
4735 | && !lvalue_or_else (location, | |||
4736 | arg, ((code == PREINCREMENT_EXPR | |||
4737 | || code == POSTINCREMENT_EXPR) | |||
4738 | ? lv_increment | |||
4739 | : lv_decrement))) | |||
4740 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
4741 | ||||
4742 | if (warn_cxx_compatglobal_options.x_warn_cxx_compat && TREE_CODE (TREE_TYPE (arg))((enum tree_code) (((contains_struct_check ((arg), (TS_TYPED) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.cc" , 4742, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE) | |||
4743 | { | |||
4744 | if (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR) | |||
4745 | warning_at (location, OPT_Wc___compat, | |||
4746 | "increment of enumeration value is invalid in C++"); | |||
4747 | else | |||
4748 | warning_at (location, OPT_Wc___compat, | |||
4749 | "decrement of enumeration value is invalid in C++"); | |||
4750 | } | |||
4751 | ||||
4752 | if (C_BOOLEAN_TYPE_P (TREE_TYPE (arg))(((enum tree_code) (((contains_struct_check ((arg), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-stat |