File: | build/gcc/c/c-typeck.c |
Warning: | line 7122, column 8 Value stored to 'coder' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* Build expressions with type checking for C compiler. |
2 | Copyright (C) 1987-2021 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 | |
56 | /* Possible cases of implicit bad conversions. Used to select |
57 | diagnostic messages in convert_for_assignment. */ |
58 | enum impl_conv { |
59 | ic_argpass, |
60 | ic_assign, |
61 | ic_init, |
62 | ic_return |
63 | }; |
64 | |
65 | /* The level of nesting inside "__alignof__". */ |
66 | int in_alignof; |
67 | |
68 | /* The level of nesting inside "sizeof". */ |
69 | int in_sizeof; |
70 | |
71 | /* The level of nesting inside "typeof". */ |
72 | int in_typeof; |
73 | |
74 | /* True when parsing OpenMP loop expressions. */ |
75 | bool c_in_omp_for; |
76 | |
77 | /* The argument of last parsed sizeof expression, only to be tested |
78 | if expr.original_code == SIZEOF_EXPR. */ |
79 | tree c_last_sizeof_arg; |
80 | location_t c_last_sizeof_loc; |
81 | |
82 | /* Nonzero if we might need to print a "missing braces around |
83 | initializer" message within this initializer. */ |
84 | static int found_missing_braces; |
85 | |
86 | static int require_constant_value; |
87 | static int require_constant_elements; |
88 | |
89 | static bool null_pointer_constant_p (const_tree); |
90 | static tree qualify_type (tree, tree); |
91 | static int tagged_types_tu_compatible_p (const_tree, const_tree, bool *, |
92 | bool *); |
93 | static int comp_target_types (location_t, tree, tree); |
94 | static int function_types_compatible_p (const_tree, const_tree, bool *, |
95 | bool *); |
96 | static int type_lists_compatible_p (const_tree, const_tree, bool *, bool *); |
97 | static tree lookup_field (tree, tree); |
98 | static int convert_arguments (location_t, vec<location_t>, tree, |
99 | vec<tree, va_gc> *, vec<tree, va_gc> *, tree, |
100 | tree); |
101 | static tree pointer_diff (location_t, tree, tree, tree *); |
102 | static tree convert_for_assignment (location_t, location_t, tree, tree, tree, |
103 | enum impl_conv, bool, tree, tree, int, |
104 | int = 0); |
105 | static tree valid_compound_expr_initializer (tree, tree); |
106 | static void push_string (const char *); |
107 | static void push_member_name (tree); |
108 | static int spelling_length (void); |
109 | static char *print_spelling (char *); |
110 | static void warning_init (location_t, int, const char *); |
111 | static tree digest_init (location_t, tree, tree, tree, bool, bool, int); |
112 | static void output_init_element (location_t, tree, tree, bool, tree, tree, bool, |
113 | bool, struct obstack *); |
114 | static void output_pending_init_elements (int, struct obstack *); |
115 | static bool set_designator (location_t, bool, struct obstack *); |
116 | static void push_range_stack (tree, struct obstack *); |
117 | static void add_pending_init (location_t, tree, tree, tree, bool, |
118 | struct obstack *); |
119 | static void set_nonincremental_init (struct obstack *); |
120 | static void set_nonincremental_init_from_string (tree, struct obstack *); |
121 | static tree find_init_member (tree, struct obstack *); |
122 | static void readonly_warning (tree, enum lvalue_use); |
123 | static int lvalue_or_else (location_t, const_tree, enum lvalue_use); |
124 | static void record_maybe_used_decl (tree); |
125 | static int comptypes_internal (const_tree, const_tree, bool *, bool *); |
126 | |
127 | /* Return true if EXP is a null pointer constant, false otherwise. */ |
128 | |
129 | static bool |
130 | null_pointer_constant_p (const_tree expr) |
131 | { |
132 | /* This should really operate on c_expr structures, but they aren't |
133 | yet available everywhere required. */ |
134 | tree type = TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 134, __FUNCTION__))->typed.type); |
135 | return (TREE_CODE (expr)((enum tree_code) (expr)->base.code) == INTEGER_CST |
136 | && !TREE_OVERFLOW (expr)((tree_class_check ((expr), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 136, __FUNCTION__))->base.public_flag) |
137 | && integer_zerop (expr) |
138 | && (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) |
139 | || (TREE_CODE (type)((enum tree_code) (type)->base.code) == POINTER_TYPE |
140 | && VOID_TYPE_P (TREE_TYPE (type))(((enum tree_code) (((contains_struct_check ((type), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 140, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE ) |
141 | && TYPE_QUALS (TREE_TYPE (type))((int) ((((tree_class_check ((((contains_struct_check ((type) , (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 141, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 141, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((((contains_struct_check ((type), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 141, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 141, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((((contains_struct_check ((type), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 141, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 141, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((((contains_struct_check ((type), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 141, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 141, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ) | (((((tree_class_check ((((contains_struct_check ((type), ( TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 141, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 141, __FUNCTION__))->base.u.bits.address_space) & 0xFF ) << 8)))) == TYPE_UNQUALIFIED))); |
142 | } |
143 | |
144 | /* EXPR may appear in an unevaluated part of an integer constant |
145 | expression, but not in an evaluated part. Wrap it in a |
146 | C_MAYBE_CONST_EXPR, or mark it with TREE_OVERFLOW if it is just an |
147 | INTEGER_CST and we cannot create a C_MAYBE_CONST_EXPR. */ |
148 | |
149 | static tree |
150 | note_integer_operands (tree expr) |
151 | { |
152 | tree ret; |
153 | if (TREE_CODE (expr)((enum tree_code) (expr)->base.code) == INTEGER_CST && in_late_binary_op) |
154 | { |
155 | ret = copy_node (expr); |
156 | TREE_OVERFLOW (ret)((tree_class_check ((ret), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 156, __FUNCTION__))->base.public_flag) = 1; |
157 | } |
158 | else |
159 | { |
160 | ret = build2 (C_MAYBE_CONST_EXPR, TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 160, __FUNCTION__))->typed.type), NULL_TREE(tree) __null, expr); |
161 | C_MAYBE_CONST_EXPR_INT_OPERANDS (ret)((tree_not_check2 (((tree_check ((ret), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 161, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 161, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_0) = 1; |
162 | } |
163 | return ret; |
164 | } |
165 | |
166 | /* Having checked whether EXPR may appear in an unevaluated part of an |
167 | integer constant expression and found that it may, remove any |
168 | C_MAYBE_CONST_EXPR noting this fact and return the resulting |
169 | expression. */ |
170 | |
171 | static inline tree |
172 | remove_c_maybe_const_expr (tree expr) |
173 | { |
174 | if (TREE_CODE (expr)((enum tree_code) (expr)->base.code) == C_MAYBE_CONST_EXPR) |
175 | return C_MAYBE_CONST_EXPR_EXPR (expr)(*((const_cast<tree*> (tree_operand_check (((tree_check ((expr), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 175, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 175, __FUNCTION__))))); |
176 | else |
177 | return expr; |
178 | } |
179 | |
180 | /* This is a cache to hold if two types are compatible or not. */ |
181 | |
182 | struct tagged_tu_seen_cache { |
183 | const struct tagged_tu_seen_cache * next; |
184 | const_tree t1; |
185 | const_tree t2; |
186 | /* The return value of tagged_types_tu_compatible_p if we had seen |
187 | these two types already. */ |
188 | int val; |
189 | }; |
190 | |
191 | static const struct tagged_tu_seen_cache * tagged_tu_seen_base; |
192 | static void free_all_tagged_tu_seen_up_to (const struct tagged_tu_seen_cache *); |
193 | |
194 | /* Do `exp = require_complete_type (loc, exp);' to make sure exp |
195 | does not have an incomplete type. (That includes void types.) |
196 | LOC is the location of the use. */ |
197 | |
198 | tree |
199 | require_complete_type (location_t loc, tree value) |
200 | { |
201 | tree type = TREE_TYPE (value)((contains_struct_check ((value), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 201, __FUNCTION__))->typed.type); |
202 | |
203 | if (error_operand_p (value)((value) == global_trees[TI_ERROR_MARK] || ((value) && ((contains_struct_check (((value)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 203, __FUNCTION__))->typed.type) == global_trees[TI_ERROR_MARK ]))) |
204 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
205 | |
206 | /* First, detect a valid value with a complete type. */ |
207 | if (COMPLETE_TYPE_P (type)(((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 207, __FUNCTION__))->type_common.size) != (tree) __null)) |
208 | return value; |
209 | |
210 | c_incomplete_type_error (loc, value, type); |
211 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
212 | } |
213 | |
214 | /* Print an error message for invalid use of an incomplete type. |
215 | VALUE is the expression that was used (or 0 if that isn't known) |
216 | and TYPE is the type that was invalid. LOC is the location for |
217 | the error. */ |
218 | |
219 | void |
220 | c_incomplete_type_error (location_t loc, const_tree value, const_tree type) |
221 | { |
222 | /* Avoid duplicate error message. */ |
223 | if (TREE_CODE (type)((enum tree_code) (type)->base.code) == ERROR_MARK) |
224 | return; |
225 | |
226 | 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)) |
227 | error_at (loc, "%qD has an incomplete type %qT", value, type); |
228 | else |
229 | { |
230 | retry: |
231 | /* We must print an error message. Be clever about what it says. */ |
232 | |
233 | switch (TREE_CODE (type)((enum tree_code) (type)->base.code)) |
234 | { |
235 | case RECORD_TYPE: |
236 | case UNION_TYPE: |
237 | case ENUMERAL_TYPE: |
238 | break; |
239 | |
240 | case VOID_TYPE: |
241 | error_at (loc, "invalid use of void expression"); |
242 | return; |
243 | |
244 | case ARRAY_TYPE: |
245 | if (TYPE_DOMAIN (type)((tree_check ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 245, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values )) |
246 | { |
247 | if (TYPE_MAX_VALUE (TYPE_DOMAIN (type))((tree_check5 ((((tree_check ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 247, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values )), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 247, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval ) == NULL__null) |
248 | { |
249 | error_at (loc, "invalid use of flexible array member"); |
250 | return; |
251 | } |
252 | type = TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 252, __FUNCTION__))->typed.type); |
253 | goto retry; |
254 | } |
255 | error_at (loc, "invalid use of array with unspecified bounds"); |
256 | return; |
257 | |
258 | default: |
259 | gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 259, __FUNCTION__)); |
260 | } |
261 | |
262 | if (TREE_CODE (TYPE_NAME (type))((enum tree_code) (((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 262, __FUNCTION__))->type_common.name))->base.code) == IDENTIFIER_NODE) |
263 | error_at (loc, "invalid use of undefined type %qT", type); |
264 | else |
265 | /* If this type has a typedef-name, the TYPE_NAME is a TYPE_DECL. */ |
266 | error_at (loc, "invalid use of incomplete typedef %qT", type); |
267 | } |
268 | } |
269 | |
270 | /* Given a type, apply default promotions wrt unnamed function |
271 | arguments and return the new type. */ |
272 | |
273 | tree |
274 | c_type_promotes_to (tree type) |
275 | { |
276 | tree ret = NULL_TREE(tree) __null; |
277 | |
278 | if (TYPE_MAIN_VARIANT (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 278, __FUNCTION__))->type_common.main_variant) == float_type_nodeglobal_trees[TI_FLOAT_TYPE]) |
279 | ret = double_type_nodeglobal_trees[TI_DOUBLE_TYPE]; |
280 | else if (c_promoting_integer_type_p (type)) |
281 | { |
282 | /* Preserve unsignedness if not really getting any wider. */ |
283 | if (TYPE_UNSIGNED (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 283, __FUNCTION__))->base.u.bits.unsigned_flag) |
284 | && (TYPE_PRECISION (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 284, __FUNCTION__))->type_common.precision) == TYPE_PRECISION (integer_type_node)((tree_class_check ((integer_types[itk_int]), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 284, __FUNCTION__))->type_common.precision))) |
285 | ret = unsigned_type_nodeinteger_types[itk_unsigned_int]; |
286 | else |
287 | ret = integer_type_nodeinteger_types[itk_int]; |
288 | } |
289 | |
290 | if (ret != NULL_TREE(tree) __null) |
291 | return (TYPE_ATOMIC (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 291, __FUNCTION__))->base.u.bits.atomic_flag) |
292 | ? c_build_qualified_type (ret, TYPE_QUAL_ATOMIC) |
293 | : ret); |
294 | |
295 | return type; |
296 | } |
297 | |
298 | /* Return true if between two named address spaces, whether there is a superset |
299 | named address space that encompasses both address spaces. If there is a |
300 | superset, return which address space is the superset. */ |
301 | |
302 | static bool |
303 | addr_space_superset (addr_space_t as1, addr_space_t as2, addr_space_t *common) |
304 | { |
305 | if (as1 == as2) |
306 | { |
307 | *common = as1; |
308 | return true; |
309 | } |
310 | else if (targetm.addr_space.subset_p (as1, as2)) |
311 | { |
312 | *common = as2; |
313 | return true; |
314 | } |
315 | else if (targetm.addr_space.subset_p (as2, as1)) |
316 | { |
317 | *common = as1; |
318 | return true; |
319 | } |
320 | else |
321 | return false; |
322 | } |
323 | |
324 | /* Return a variant of TYPE which has all the type qualifiers of LIKE |
325 | as well as those of TYPE. */ |
326 | |
327 | static tree |
328 | qualify_type (tree type, tree like) |
329 | { |
330 | addr_space_t as_type = TYPE_ADDR_SPACE (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 330, __FUNCTION__))->base.u.bits.address_space); |
331 | addr_space_t as_like = TYPE_ADDR_SPACE (like)((tree_class_check ((like), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 331, __FUNCTION__))->base.u.bits.address_space); |
332 | addr_space_t as_common; |
333 | |
334 | /* If the two named address spaces are different, determine the common |
335 | superset address space. If there isn't one, raise an error. */ |
336 | if (!addr_space_superset (as_type, as_like, &as_common)) |
337 | { |
338 | as_common = as_type; |
339 | error ("%qT and %qT are in disjoint named address spaces", |
340 | type, like); |
341 | } |
342 | |
343 | return c_build_qualified_type (type, |
344 | TYPE_QUALS_NO_ADDR_SPACE (type)((int) ((((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 344, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 344, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 344, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 344, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ))) |
345 | | TYPE_QUALS_NO_ADDR_SPACE_NO_ATOMIC (like)((int) ((((tree_class_check ((like), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 345, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((like), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 345, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((like), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 345, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ))) |
346 | | ENCODE_QUAL_ADDR_SPACE (as_common)((as_common & 0xFF) << 8)); |
347 | } |
348 | |
349 | /* Return true iff the given tree T is a variable length array. */ |
350 | |
351 | bool |
352 | c_vla_type_p (const_tree t) |
353 | { |
354 | if (TREE_CODE (t)((enum tree_code) (t)->base.code) == ARRAY_TYPE |
355 | && C_TYPE_VARIABLE_SIZE (t)((tree_class_check ((t), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 355, __FUNCTION__))->type_common.lang_flag_1)) |
356 | return true; |
357 | return false; |
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 && code2 == INTEGER_TYPE) |
416 | return t1; |
417 | if (code2 == ENUMERAL_TYPE && code1 == INTEGER_TYPE) |
418 | return t2; |
419 | |
420 | gcc_assert (code1 == code2)((void)(!(code1 == code2) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 420, __FUNCTION__), 0 : 0)); |
421 | |
422 | switch (code1) |
423 | { |
424 | case POINTER_TYPE: |
425 | /* For two pointers, do this recursively on the target type. */ |
426 | { |
427 | tree pointed_to_1 = TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 427, __FUNCTION__))->typed.type); |
428 | tree pointed_to_2 = TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 428, __FUNCTION__))->typed.type); |
429 | tree target = composite_type (pointed_to_1, pointed_to_2); |
430 | t1 = build_pointer_type_for_mode (target, TYPE_MODE (t1)((((enum tree_code) ((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 430, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode (t1) : (t1)->type_common.mode), false); |
431 | t1 = build_type_attribute_variant (t1, attributes); |
432 | return qualify_type (t1, t2); |
433 | } |
434 | |
435 | case ARRAY_TYPE: |
436 | { |
437 | tree elt = composite_type (TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 437, __FUNCTION__))->typed.type), TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 437, __FUNCTION__))->typed.type)); |
438 | int quals; |
439 | tree unqual_elt; |
440 | tree d1 = TYPE_DOMAIN (t1)((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 440, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ); |
441 | tree d2 = TYPE_DOMAIN (t2)((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 441, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ); |
442 | bool d1_variable, d2_variable; |
443 | bool d1_zero, d2_zero; |
444 | bool t1_complete, t2_complete; |
445 | |
446 | /* We should not have any type quals on arrays at all. */ |
447 | gcc_assert (!TYPE_QUALS_NO_ADDR_SPACE (t1)((void)(!(!((int) ((((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 447, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 447, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 447, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 447, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ))) && !((int) ((((tree_class_check ((t2), (tcc_type) , "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 448, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 448, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 448, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 448, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT )))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 448, __FUNCTION__), 0 : 0)) |
448 | && !TYPE_QUALS_NO_ADDR_SPACE (t2))((void)(!(!((int) ((((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 447, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 447, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 447, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 447, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ))) && !((int) ((((tree_class_check ((t2), (tcc_type) , "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 448, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 448, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 448, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 448, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT )))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 448, __FUNCTION__), 0 : 0)); |
449 | |
450 | t1_complete = COMPLETE_TYPE_P (t1)(((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 450, __FUNCTION__))->type_common.size) != (tree) __null); |
451 | t2_complete = COMPLETE_TYPE_P (t2)(((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 451, __FUNCTION__))->type_common.size) != (tree) __null); |
452 | |
453 | d1_zero = d1 == NULL_TREE(tree) __null || !TYPE_MAX_VALUE (d1)((tree_check5 ((d1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 453, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval ); |
454 | d2_zero = d2 == NULL_TREE(tree) __null || !TYPE_MAX_VALUE (d2)((tree_check5 ((d2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 454, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval ); |
455 | |
456 | d1_variable = (!d1_zero |
457 | && (TREE_CODE (TYPE_MIN_VALUE (d1))((enum tree_code) (((tree_check5 ((d1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 457, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.minval ))->base.code) != INTEGER_CST |
458 | || TREE_CODE (TYPE_MAX_VALUE (d1))((enum tree_code) (((tree_check5 ((d1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 458, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval ))->base.code) != INTEGER_CST)); |
459 | d2_variable = (!d2_zero |
460 | && (TREE_CODE (TYPE_MIN_VALUE (d2))((enum tree_code) (((tree_check5 ((d2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 460, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.minval ))->base.code) != INTEGER_CST |
461 | || TREE_CODE (TYPE_MAX_VALUE (d2))((enum tree_code) (((tree_check5 ((d2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 461, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval ))->base.code) != INTEGER_CST)); |
462 | d1_variable = d1_variable || (d1_zero && c_vla_type_p (t1)); |
463 | d2_variable = d2_variable || (d2_zero && c_vla_type_p (t2)); |
464 | |
465 | /* Save space: see if the result is identical to one of the args. */ |
466 | if (elt == TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 466, __FUNCTION__))->typed.type) && TYPE_DOMAIN (t1)((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 466, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) |
467 | && (d2_variable || d2_zero || !d1_variable)) |
468 | return build_type_attribute_variant (t1, attributes); |
469 | if (elt == TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 469, __FUNCTION__))->typed.type) && TYPE_DOMAIN (t2)((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 469, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) |
470 | && (d1_variable || d1_zero || !d2_variable)) |
471 | return build_type_attribute_variant (t2, attributes); |
472 | |
473 | if (elt == TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 473, __FUNCTION__))->typed.type) && !TYPE_DOMAIN (t2)((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 473, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) && !TYPE_DOMAIN (t1)((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 473, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values )) |
474 | return build_type_attribute_variant (t1, attributes); |
475 | if (elt == TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 475, __FUNCTION__))->typed.type) && !TYPE_DOMAIN (t2)((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 475, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) && !TYPE_DOMAIN (t1)((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 475, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values )) |
476 | return build_type_attribute_variant (t2, attributes); |
477 | |
478 | /* Merge the element types, and have a size if either arg has |
479 | one. We may have qualifiers on the element types. To set |
480 | up TYPE_MAIN_VARIANT correctly, we need to form the |
481 | composite of the unqualified types and add the qualifiers |
482 | back at the end. */ |
483 | quals = TYPE_QUALS (strip_array_types (elt))((int) ((((tree_class_check ((strip_array_types (elt)), (tcc_type ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 483, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((strip_array_types (elt)), (tcc_type ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 483, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((strip_array_types (elt)), (tcc_type ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 483, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((strip_array_types (elt)), (tcc_type ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 483, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ) | (((((tree_class_check ((strip_array_types (elt)), (tcc_type ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 483, __FUNCTION__))->base.u.bits.address_space) & 0xFF ) << 8)))); |
484 | unqual_elt = c_build_qualified_type (elt, TYPE_UNQUALIFIED); |
485 | t1 = build_array_type (unqual_elt, |
486 | TYPE_DOMAIN ((TYPE_DOMAIN (t1)((tree_check (((((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 486, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) && (d2_variable || d2_zero || !d1_variable)) ? t1 : t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 491, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) |
487 | && (d2_variable((tree_check (((((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 486, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) && (d2_variable || d2_zero || !d1_variable)) ? t1 : t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 491, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) |
488 | || d2_zero((tree_check (((((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 486, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) && (d2_variable || d2_zero || !d1_variable)) ? t1 : t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 491, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) |
489 | || !d1_variable))((tree_check (((((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 486, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) && (d2_variable || d2_zero || !d1_variable)) ? t1 : t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 491, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) |
490 | ? t1((tree_check (((((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 486, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) && (d2_variable || d2_zero || !d1_variable)) ? t1 : t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 491, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) |
491 | : t2)((tree_check (((((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 486, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) && (d2_variable || d2_zero || !d1_variable)) ? t1 : t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 491, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values )); |
492 | /* Ensure a composite type involving a zero-length array type |
493 | is a zero-length type not an incomplete type. */ |
494 | if (d1_zero && d2_zero |
495 | && (t1_complete || t2_complete) |
496 | && !COMPLETE_TYPE_P (t1)(((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 496, __FUNCTION__))->type_common.size) != (tree) __null)) |
497 | { |
498 | TYPE_SIZE (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 498, __FUNCTION__))->type_common.size) = bitsize_zero_nodeglobal_trees[TI_BITSIZE_ZERO]; |
499 | TYPE_SIZE_UNIT (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 499, __FUNCTION__))->type_common.size_unit) = size_zero_nodeglobal_trees[TI_SIZE_ZERO]; |
500 | } |
501 | t1 = c_build_qualified_type (t1, quals); |
502 | return build_type_attribute_variant (t1, attributes); |
503 | } |
504 | |
505 | case ENUMERAL_TYPE: |
506 | case RECORD_TYPE: |
507 | case UNION_TYPE: |
508 | if (attributes != NULL__null) |
509 | { |
510 | /* Try harder not to create a new aggregate type. */ |
511 | if (attribute_list_equal (TYPE_ATTRIBUTES (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 511, __FUNCTION__))->type_common.attributes), attributes)) |
512 | return t1; |
513 | if (attribute_list_equal (TYPE_ATTRIBUTES (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 513, __FUNCTION__))->type_common.attributes), attributes)) |
514 | return t2; |
515 | } |
516 | return build_type_attribute_variant (t1, attributes); |
517 | |
518 | case FUNCTION_TYPE: |
519 | /* Function types: prefer the one that specified arg types. |
520 | If both do, merge the arg types. Also merge the return types. */ |
521 | { |
522 | tree valtype = composite_type (TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 522, __FUNCTION__))->typed.type), TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 522, __FUNCTION__))->typed.type)); |
523 | tree p1 = TYPE_ARG_TYPES (t1)((tree_check2 ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 523, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values); |
524 | tree p2 = TYPE_ARG_TYPES (t2)((tree_check2 ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 524, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values); |
525 | int len; |
526 | tree newargs, n; |
527 | int i; |
528 | |
529 | /* Save space: see if the result is identical to one of the args. */ |
530 | if (valtype == TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 530, __FUNCTION__))->typed.type) && !TYPE_ARG_TYPES (t2)((tree_check2 ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 530, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values)) |
531 | return build_functype_attribute_variant (t1, t2, attributes); |
532 | if (valtype == TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 532, __FUNCTION__))->typed.type) && !TYPE_ARG_TYPES (t1)((tree_check2 ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 532, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values)) |
533 | return build_functype_attribute_variant (t2, t1, attributes); |
534 | |
535 | /* Simple way if one arg fails to specify argument types. */ |
536 | if (TYPE_ARG_TYPES (t1)((tree_check2 ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 536, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values) == NULL_TREE(tree) __null) |
537 | { |
538 | t1 = build_function_type (valtype, TYPE_ARG_TYPES (t2)((tree_check2 ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 538, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values)); |
539 | t1 = build_type_attribute_variant (t1, attributes); |
540 | return qualify_type (t1, t2); |
541 | } |
542 | if (TYPE_ARG_TYPES (t2)((tree_check2 ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 542, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values) == NULL_TREE(tree) __null) |
543 | { |
544 | t1 = build_function_type (valtype, TYPE_ARG_TYPES (t1)((tree_check2 ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 544, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values)); |
545 | t1 = build_type_attribute_variant (t1, attributes); |
546 | return qualify_type (t1, t2); |
547 | } |
548 | |
549 | /* If both args specify argument types, we must merge the two |
550 | lists, argument by argument. */ |
551 | |
552 | for (len = 0, newargs = p1; |
553 | newargs && newargs != void_list_nodeglobal_trees[TI_VOID_LIST_NODE]; |
554 | len++, newargs = TREE_CHAIN (newargs)((contains_struct_check ((newargs), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 554, __FUNCTION__))->common.chain)) |
555 | ; |
556 | |
557 | for (i = 0; i < len; i++) |
558 | newargs = tree_cons (NULL_TREE(tree) __null, NULL_TREE(tree) __null, newargs); |
559 | |
560 | n = newargs; |
561 | |
562 | for (; p1 && p1 != void_list_nodeglobal_trees[TI_VOID_LIST_NODE]; |
563 | p1 = TREE_CHAIN (p1)((contains_struct_check ((p1), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 563, __FUNCTION__))->common.chain), p2 = TREE_CHAIN (p2)((contains_struct_check ((p2), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 563, __FUNCTION__))->common.chain), n = TREE_CHAIN (n)((contains_struct_check ((n), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 563, __FUNCTION__))->common.chain)) |
564 | { |
565 | /* A null type means arg type is not specified. |
566 | Take whatever the other function type has. */ |
567 | if (TREE_VALUE (p1)((tree_check ((p1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 567, __FUNCTION__, (TREE_LIST)))->list.value) == NULL_TREE(tree) __null) |
568 | { |
569 | TREE_VALUE (n)((tree_check ((n), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 569, __FUNCTION__, (TREE_LIST)))->list.value) = TREE_VALUE (p2)((tree_check ((p2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 569, __FUNCTION__, (TREE_LIST)))->list.value); |
570 | goto parm_done; |
571 | } |
572 | if (TREE_VALUE (p2)((tree_check ((p2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 572, __FUNCTION__, (TREE_LIST)))->list.value) == NULL_TREE(tree) __null) |
573 | { |
574 | TREE_VALUE (n)((tree_check ((n), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 574, __FUNCTION__, (TREE_LIST)))->list.value) = TREE_VALUE (p1)((tree_check ((p1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 574, __FUNCTION__, (TREE_LIST)))->list.value); |
575 | goto parm_done; |
576 | } |
577 | |
578 | /* Given wait (union {union wait *u; int *i} *) |
579 | and wait (union wait *), |
580 | prefer union wait * as type of parm. */ |
581 | if (TREE_CODE (TREE_VALUE (p1))((enum tree_code) (((tree_check ((p1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 581, __FUNCTION__, (TREE_LIST)))->list.value))->base. code) == UNION_TYPE |
582 | && TREE_VALUE (p1)((tree_check ((p1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 582, __FUNCTION__, (TREE_LIST)))->list.value) != TREE_VALUE (p2)((tree_check ((p2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 582, __FUNCTION__, (TREE_LIST)))->list.value)) |
583 | { |
584 | tree memb; |
585 | tree mv2 = TREE_VALUE (p2)((tree_check ((p2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 585, __FUNCTION__, (TREE_LIST)))->list.value); |
586 | if (mv2 && mv2 != error_mark_nodeglobal_trees[TI_ERROR_MARK] |
587 | && TREE_CODE (mv2)((enum tree_code) (mv2)->base.code) != ARRAY_TYPE) |
588 | mv2 = TYPE_MAIN_VARIANT (mv2)((tree_class_check ((mv2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 588, __FUNCTION__))->type_common.main_variant); |
589 | for (memb = TYPE_FIELDS (TREE_VALUE (p1))((tree_check3 ((((tree_check ((p1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 589, __FUNCTION__, (TREE_LIST)))->list.value)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 589, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); |
590 | memb; memb = DECL_CHAIN (memb)(((contains_struct_check (((contains_struct_check ((memb), (TS_DECL_MINIMAL ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 590, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 590, __FUNCTION__))->common.chain))) |
591 | { |
592 | tree mv3 = TREE_TYPE (memb)((contains_struct_check ((memb), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 592, __FUNCTION__))->typed.type); |
593 | if (mv3 && mv3 != error_mark_nodeglobal_trees[TI_ERROR_MARK] |
594 | && TREE_CODE (mv3)((enum tree_code) (mv3)->base.code) != ARRAY_TYPE) |
595 | mv3 = TYPE_MAIN_VARIANT (mv3)((tree_class_check ((mv3), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 595, __FUNCTION__))->type_common.main_variant); |
596 | if (comptypes (mv3, mv2)) |
597 | { |
598 | TREE_VALUE (n)((tree_check ((n), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 598, __FUNCTION__, (TREE_LIST)))->list.value) = composite_type (TREE_TYPE (memb)((contains_struct_check ((memb), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 598, __FUNCTION__))->typed.type), |
599 | TREE_VALUE (p2)((tree_check ((p2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 599, __FUNCTION__, (TREE_LIST)))->list.value)); |
600 | pedwarn (input_location, OPT_Wpedantic, |
601 | "function types not truly compatible in ISO C"); |
602 | goto parm_done; |
603 | } |
604 | } |
605 | } |
606 | if (TREE_CODE (TREE_VALUE (p2))((enum tree_code) (((tree_check ((p2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 606, __FUNCTION__, (TREE_LIST)))->list.value))->base. code) == UNION_TYPE |
607 | && TREE_VALUE (p2)((tree_check ((p2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 607, __FUNCTION__, (TREE_LIST)))->list.value) != TREE_VALUE (p1)((tree_check ((p1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 607, __FUNCTION__, (TREE_LIST)))->list.value)) |
608 | { |
609 | tree memb; |
610 | tree mv1 = TREE_VALUE (p1)((tree_check ((p1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 610, __FUNCTION__, (TREE_LIST)))->list.value); |
611 | if (mv1 && mv1 != error_mark_nodeglobal_trees[TI_ERROR_MARK] |
612 | && TREE_CODE (mv1)((enum tree_code) (mv1)->base.code) != ARRAY_TYPE) |
613 | mv1 = TYPE_MAIN_VARIANT (mv1)((tree_class_check ((mv1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 613, __FUNCTION__))->type_common.main_variant); |
614 | for (memb = TYPE_FIELDS (TREE_VALUE (p2))((tree_check3 ((((tree_check ((p2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 614, __FUNCTION__, (TREE_LIST)))->list.value)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 614, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); |
615 | memb; memb = DECL_CHAIN (memb)(((contains_struct_check (((contains_struct_check ((memb), (TS_DECL_MINIMAL ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 615, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 615, __FUNCTION__))->common.chain))) |
616 | { |
617 | tree mv3 = TREE_TYPE (memb)((contains_struct_check ((memb), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 617, __FUNCTION__))->typed.type); |
618 | if (mv3 && mv3 != error_mark_nodeglobal_trees[TI_ERROR_MARK] |
619 | && TREE_CODE (mv3)((enum tree_code) (mv3)->base.code) != ARRAY_TYPE) |
620 | mv3 = TYPE_MAIN_VARIANT (mv3)((tree_class_check ((mv3), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 620, __FUNCTION__))->type_common.main_variant); |
621 | if (comptypes (mv3, mv1)) |
622 | { |
623 | TREE_VALUE (n)((tree_check ((n), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 623, __FUNCTION__, (TREE_LIST)))->list.value) = composite_type (TREE_TYPE (memb)((contains_struct_check ((memb), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 623, __FUNCTION__))->typed.type), |
624 | TREE_VALUE (p1)((tree_check ((p1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 624, __FUNCTION__, (TREE_LIST)))->list.value)); |
625 | pedwarn (input_location, OPT_Wpedantic, |
626 | "function types not truly compatible in ISO C"); |
627 | goto parm_done; |
628 | } |
629 | } |
630 | } |
631 | TREE_VALUE (n)((tree_check ((n), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 631, __FUNCTION__, (TREE_LIST)))->list.value) = composite_type (TREE_VALUE (p1)((tree_check ((p1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 631, __FUNCTION__, (TREE_LIST)))->list.value), TREE_VALUE (p2)((tree_check ((p2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 631, __FUNCTION__, (TREE_LIST)))->list.value)); |
632 | parm_done: ; |
633 | } |
634 | |
635 | t1 = build_function_type (valtype, newargs); |
636 | t1 = qualify_type (t1, t2); |
637 | } |
638 | /* FALLTHRU */ |
639 | |
640 | default: |
641 | return build_type_attribute_variant (t1, attributes); |
642 | } |
643 | |
644 | } |
645 | |
646 | /* Return the type of a conditional expression between pointers to |
647 | possibly differently qualified versions of compatible types. |
648 | |
649 | We assume that comp_target_types has already been done and returned |
650 | nonzero; if that isn't so, this may crash. */ |
651 | |
652 | static tree |
653 | common_pointer_type (tree t1, tree t2) |
654 | { |
655 | tree attributes; |
656 | tree pointed_to_1, mv1; |
657 | tree pointed_to_2, mv2; |
658 | tree target; |
659 | unsigned target_quals; |
660 | addr_space_t as1, as2, as_common; |
661 | int quals1, quals2; |
662 | |
663 | /* Save time if the two types are the same. */ |
664 | |
665 | if (t1 == t2) return t1; |
666 | |
667 | /* If one type is nonsense, use the other. */ |
668 | if (t1 == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
669 | return t2; |
670 | if (t2 == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
671 | return t1; |
672 | |
673 | 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 ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 674, __FUNCTION__), 0 : 0)) |
674 | && TREE_CODE (t2) == POINTER_TYPE)((void)(!(((enum tree_code) (t1)->base.code) == POINTER_TYPE && ((enum tree_code) (t2)->base.code) == POINTER_TYPE ) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 674, __FUNCTION__), 0 : 0)); |
675 | |
676 | /* Merge the attributes. */ |
677 | attributes = targetm.merge_type_attributes (t1, t2); |
678 | |
679 | /* Find the composite type of the target types, and combine the |
680 | qualifiers of the two types' targets. Do not lose qualifiers on |
681 | array element types by taking the TYPE_MAIN_VARIANT. */ |
682 | mv1 = pointed_to_1 = TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 682, __FUNCTION__))->typed.type); |
683 | mv2 = pointed_to_2 = TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 683, __FUNCTION__))->typed.type); |
684 | if (TREE_CODE (mv1)((enum tree_code) (mv1)->base.code) != ARRAY_TYPE) |
685 | mv1 = TYPE_MAIN_VARIANT (pointed_to_1)((tree_class_check ((pointed_to_1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 685, __FUNCTION__))->type_common.main_variant); |
686 | if (TREE_CODE (mv2)((enum tree_code) (mv2)->base.code) != ARRAY_TYPE) |
687 | mv2 = TYPE_MAIN_VARIANT (pointed_to_2)((tree_class_check ((pointed_to_2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 687, __FUNCTION__))->type_common.main_variant); |
688 | target = composite_type (mv1, mv2); |
689 | |
690 | /* Strip array types to get correct qualifier for pointers to arrays */ |
691 | quals1 = TYPE_QUALS_NO_ADDR_SPACE (strip_array_types (pointed_to_1))((int) ((((tree_class_check ((strip_array_types (pointed_to_1 )), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 691, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((strip_array_types (pointed_to_1)), ( tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 691, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((strip_array_types (pointed_to_1)), ( tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 691, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((strip_array_types (pointed_to_1)), ( tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 691, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ))); |
692 | quals2 = TYPE_QUALS_NO_ADDR_SPACE (strip_array_types (pointed_to_2))((int) ((((tree_class_check ((strip_array_types (pointed_to_2 )), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 692, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((strip_array_types (pointed_to_2)), ( tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 692, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((strip_array_types (pointed_to_2)), ( tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 692, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((strip_array_types (pointed_to_2)), ( tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 692, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ))); |
693 | |
694 | /* For function types do not merge const qualifiers, but drop them |
695 | if used inconsistently. The middle-end uses these to mark const |
696 | and noreturn functions. */ |
697 | if (TREE_CODE (pointed_to_1)((enum tree_code) (pointed_to_1)->base.code) == FUNCTION_TYPE) |
698 | target_quals = (quals1 & quals2); |
699 | else |
700 | target_quals = (quals1 | quals2); |
701 | |
702 | /* If the two named address spaces are different, determine the common |
703 | superset address space. This is guaranteed to exist due to the |
704 | assumption that comp_target_type returned non-zero. */ |
705 | as1 = TYPE_ADDR_SPACE (pointed_to_1)((tree_class_check ((pointed_to_1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 705, __FUNCTION__))->base.u.bits.address_space); |
706 | as2 = TYPE_ADDR_SPACE (pointed_to_2)((tree_class_check ((pointed_to_2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 706, __FUNCTION__))->base.u.bits.address_space); |
707 | if (!addr_space_superset (as1, as2, &as_common)) |
708 | gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 708, __FUNCTION__)); |
709 | |
710 | target_quals |= ENCODE_QUAL_ADDR_SPACE (as_common)((as_common & 0xFF) << 8); |
711 | |
712 | t1 = build_pointer_type (c_build_qualified_type (target, target_quals)); |
713 | return build_type_attribute_variant (t1, attributes); |
714 | } |
715 | |
716 | /* Return the common type for two arithmetic types under the usual |
717 | arithmetic conversions. The default conversions have already been |
718 | applied, and enumerated types converted to their compatible integer |
719 | types. The resulting type is unqualified and has no attributes. |
720 | |
721 | This is the type for the result of most arithmetic operations |
722 | if the operands have the given two types. */ |
723 | |
724 | static tree |
725 | c_common_type (tree t1, tree t2) |
726 | { |
727 | enum tree_code code1; |
728 | enum tree_code code2; |
729 | |
730 | /* If one type is nonsense, use the other. */ |
731 | if (t1 == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
732 | return t2; |
733 | if (t2 == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
734 | return t1; |
735 | |
736 | if (TYPE_QUALS (t1)((int) ((((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 736, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 736, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 736, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 736, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ) | (((((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 736, __FUNCTION__))->base.u.bits.address_space) & 0xFF ) << 8)))) != TYPE_UNQUALIFIED) |
737 | t1 = TYPE_MAIN_VARIANT (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 737, __FUNCTION__))->type_common.main_variant); |
738 | |
739 | if (TYPE_QUALS (t2)((int) ((((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 739, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 739, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 739, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 739, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ) | (((((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 739, __FUNCTION__))->base.u.bits.address_space) & 0xFF ) << 8)))) != TYPE_UNQUALIFIED) |
740 | t2 = TYPE_MAIN_VARIANT (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 740, __FUNCTION__))->type_common.main_variant); |
741 | |
742 | if (TYPE_ATTRIBUTES (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 742, __FUNCTION__))->type_common.attributes) != NULL_TREE(tree) __null) |
743 | t1 = build_type_attribute_variant (t1, NULL_TREE(tree) __null); |
744 | |
745 | if (TYPE_ATTRIBUTES (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 745, __FUNCTION__))->type_common.attributes) != NULL_TREE(tree) __null) |
746 | t2 = build_type_attribute_variant (t2, NULL_TREE(tree) __null); |
747 | |
748 | /* Save time if the two types are the same. */ |
749 | |
750 | if (t1 == t2) return t1; |
751 | |
752 | code1 = TREE_CODE (t1)((enum tree_code) (t1)->base.code); |
753 | code2 = TREE_CODE (t2)((enum tree_code) (t2)->base.code); |
754 | |
755 | 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 ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 757, __FUNCTION__), 0 : 0)) |
756 | || 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 ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 757, __FUNCTION__), 0 : 0)) |
757 | || code1 == INTEGER_TYPE)((void)(!(code1 == VECTOR_TYPE || code1 == COMPLEX_TYPE || code1 == FIXED_POINT_TYPE || code1 == REAL_TYPE || code1 == INTEGER_TYPE ) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 757, __FUNCTION__), 0 : 0)); |
758 | 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 ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 760, __FUNCTION__), 0 : 0)) |
759 | || 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 ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 760, __FUNCTION__), 0 : 0)) |
760 | || code2 == INTEGER_TYPE)((void)(!(code2 == VECTOR_TYPE || code2 == COMPLEX_TYPE || code2 == FIXED_POINT_TYPE || code2 == REAL_TYPE || code2 == INTEGER_TYPE ) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 760, __FUNCTION__), 0 : 0)); |
761 | |
762 | /* When one operand is a decimal float type, the other operand cannot be |
763 | a generic float type or a complex type. We also disallow vector types |
764 | here. */ |
765 | 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), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 765, __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), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 765, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode (t2) : (t2)->type_common.mode)]) == MODE_DECIMAL_FLOAT))) |
766 | && !(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), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 766, __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), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 766, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode (t2) : (t2)->type_common.mode)]) == MODE_DECIMAL_FLOAT)))) |
767 | { |
768 | if (code1 == VECTOR_TYPE || code2 == VECTOR_TYPE) |
769 | { |
770 | error ("cannot mix operands of decimal floating and vector types"); |
771 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
772 | } |
773 | if (code1 == COMPLEX_TYPE || code2 == COMPLEX_TYPE) |
774 | { |
775 | error ("cannot mix operands of decimal floating and complex types"); |
776 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
777 | } |
778 | if (code1 == REAL_TYPE && code2 == REAL_TYPE) |
779 | { |
780 | error ("cannot mix operands of decimal floating " |
781 | "and other floating types"); |
782 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
783 | } |
784 | } |
785 | |
786 | /* If one type is a vector type, return that type. (How the usual |
787 | arithmetic conversions apply to the vector types extension is not |
788 | precisely specified.) */ |
789 | if (code1 == VECTOR_TYPE) |
790 | return t1; |
791 | |
792 | if (code2 == VECTOR_TYPE) |
793 | return t2; |
794 | |
795 | /* If one type is complex, form the common type of the non-complex |
796 | components, then make that complex. Use T1 or T2 if it is the |
797 | required type. */ |
798 | if (code1 == COMPLEX_TYPE || code2 == COMPLEX_TYPE) |
799 | { |
800 | tree subtype1 = code1 == COMPLEX_TYPE ? TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 800, __FUNCTION__))->typed.type) : t1; |
801 | tree subtype2 = code2 == COMPLEX_TYPE ? TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 801, __FUNCTION__))->typed.type) : t2; |
802 | tree subtype = c_common_type (subtype1, subtype2); |
803 | |
804 | if (code1 == COMPLEX_TYPE && TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 804, __FUNCTION__))->typed.type) == subtype) |
805 | return t1; |
806 | else if (code2 == COMPLEX_TYPE && TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 806, __FUNCTION__))->typed.type) == subtype) |
807 | return t2; |
808 | else |
809 | return build_complex_type (subtype); |
810 | } |
811 | |
812 | /* If only one is real, use it as the result. */ |
813 | |
814 | if (code1 == REAL_TYPE && code2 != REAL_TYPE) |
815 | return t1; |
816 | |
817 | if (code2 == REAL_TYPE && code1 != REAL_TYPE) |
818 | return t2; |
819 | |
820 | /* If both are real and either are decimal floating point types, use |
821 | the decimal floating point type with the greater precision. */ |
822 | |
823 | if (code1 == REAL_TYPE && code2 == REAL_TYPE) |
824 | { |
825 | if (TYPE_MAIN_VARIANT (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 825, __FUNCTION__))->type_common.main_variant) == dfloat128_type_nodeglobal_trees[TI_DFLOAT128_TYPE] |
826 | || TYPE_MAIN_VARIANT (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 826, __FUNCTION__))->type_common.main_variant) == dfloat128_type_nodeglobal_trees[TI_DFLOAT128_TYPE]) |
827 | return dfloat128_type_nodeglobal_trees[TI_DFLOAT128_TYPE]; |
828 | else if (TYPE_MAIN_VARIANT (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 828, __FUNCTION__))->type_common.main_variant) == dfloat64_type_nodeglobal_trees[TI_DFLOAT64_TYPE] |
829 | || TYPE_MAIN_VARIANT (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 829, __FUNCTION__))->type_common.main_variant) == dfloat64_type_nodeglobal_trees[TI_DFLOAT64_TYPE]) |
830 | return dfloat64_type_nodeglobal_trees[TI_DFLOAT64_TYPE]; |
831 | else if (TYPE_MAIN_VARIANT (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 831, __FUNCTION__))->type_common.main_variant) == dfloat32_type_nodeglobal_trees[TI_DFLOAT32_TYPE] |
832 | || TYPE_MAIN_VARIANT (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 832, __FUNCTION__))->type_common.main_variant) == dfloat32_type_nodeglobal_trees[TI_DFLOAT32_TYPE]) |
833 | return dfloat32_type_nodeglobal_trees[TI_DFLOAT32_TYPE]; |
834 | } |
835 | |
836 | /* Deal with fixed-point types. */ |
837 | if (code1 == FIXED_POINT_TYPE || code2 == FIXED_POINT_TYPE) |
838 | { |
839 | unsigned int unsignedp = 0, satp = 0; |
840 | scalar_mode m1, m2; |
841 | unsigned int fbit1, ibit1, fbit2, ibit2, max_fbit, max_ibit; |
842 | |
843 | m1 = SCALAR_TYPE_MODE (t1)(as_a <scalar_mode> ((tree_class_check ((t1), (tcc_type ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 843, __FUNCTION__))->type_common.mode)); |
844 | m2 = SCALAR_TYPE_MODE (t2)(as_a <scalar_mode> ((tree_class_check ((t2), (tcc_type ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 844, __FUNCTION__))->type_common.mode)); |
845 | |
846 | /* If one input type is saturating, the result type is saturating. */ |
847 | if (TYPE_SATURATING (t1)((tree_not_check4 ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 847, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE ), (ARRAY_TYPE)))->base.u.bits.saturating_flag) || TYPE_SATURATING (t2)((tree_not_check4 ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 847, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE ), (ARRAY_TYPE)))->base.u.bits.saturating_flag)) |
848 | satp = 1; |
849 | |
850 | /* If both fixed-point types are unsigned, the result type is unsigned. |
851 | When mixing fixed-point and integer types, follow the sign of the |
852 | fixed-point type. |
853 | Otherwise, the result type is signed. */ |
854 | if ((TYPE_UNSIGNED (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 854, __FUNCTION__))->base.u.bits.unsigned_flag) && TYPE_UNSIGNED (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 854, __FUNCTION__))->base.u.bits.unsigned_flag) |
855 | && code1 == FIXED_POINT_TYPE && code2 == FIXED_POINT_TYPE) |
856 | || (code1 == FIXED_POINT_TYPE && code2 != FIXED_POINT_TYPE |
857 | && TYPE_UNSIGNED (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 857, __FUNCTION__))->base.u.bits.unsigned_flag)) |
858 | || (code1 != FIXED_POINT_TYPE && code2 == FIXED_POINT_TYPE |
859 | && TYPE_UNSIGNED (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 859, __FUNCTION__))->base.u.bits.unsigned_flag))) |
860 | unsignedp = 1; |
861 | |
862 | /* The result type is signed. */ |
863 | if (unsignedp == 0) |
864 | { |
865 | /* If the input type is unsigned, we need to convert to the |
866 | signed type. */ |
867 | if (code1 == FIXED_POINT_TYPE && TYPE_UNSIGNED (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 867, __FUNCTION__))->base.u.bits.unsigned_flag)) |
868 | { |
869 | enum mode_class mclass = (enum mode_class) 0; |
870 | if (GET_MODE_CLASS (m1)((enum mode_class) mode_class[m1]) == MODE_UFRACT) |
871 | mclass = MODE_FRACT; |
872 | else if (GET_MODE_CLASS (m1)((enum mode_class) mode_class[m1]) == MODE_UACCUM) |
873 | mclass = MODE_ACCUM; |
874 | else |
875 | gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 875, __FUNCTION__)); |
876 | m1 = as_a <scalar_mode> |
877 | (mode_for_size (GET_MODE_PRECISION (m1), mclass, 0)); |
878 | } |
879 | if (code2 == FIXED_POINT_TYPE && TYPE_UNSIGNED (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 879, __FUNCTION__))->base.u.bits.unsigned_flag)) |
880 | { |
881 | enum mode_class mclass = (enum mode_class) 0; |
882 | if (GET_MODE_CLASS (m2)((enum mode_class) mode_class[m2]) == MODE_UFRACT) |
883 | mclass = MODE_FRACT; |
884 | else if (GET_MODE_CLASS (m2)((enum mode_class) mode_class[m2]) == MODE_UACCUM) |
885 | mclass = MODE_ACCUM; |
886 | else |
887 | gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 887, __FUNCTION__)); |
888 | m2 = as_a <scalar_mode> |
889 | (mode_for_size (GET_MODE_PRECISION (m2), mclass, 0)); |
890 | } |
891 | } |
892 | |
893 | if (code1 == FIXED_POINT_TYPE) |
894 | { |
895 | fbit1 = GET_MODE_FBIT (m1)mode_fbit[m1]; |
896 | ibit1 = GET_MODE_IBIT (m1)mode_ibit[m1]; |
897 | } |
898 | else |
899 | { |
900 | fbit1 = 0; |
901 | /* Signed integers need to subtract one sign bit. */ |
902 | ibit1 = TYPE_PRECISION (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 902, __FUNCTION__))->type_common.precision) - (!TYPE_UNSIGNED (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 902, __FUNCTION__))->base.u.bits.unsigned_flag)); |
903 | } |
904 | |
905 | if (code2 == FIXED_POINT_TYPE) |
906 | { |
907 | fbit2 = GET_MODE_FBIT (m2)mode_fbit[m2]; |
908 | ibit2 = GET_MODE_IBIT (m2)mode_ibit[m2]; |
909 | } |
910 | else |
911 | { |
912 | fbit2 = 0; |
913 | /* Signed integers need to subtract one sign bit. */ |
914 | ibit2 = TYPE_PRECISION (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 914, __FUNCTION__))->type_common.precision) - (!TYPE_UNSIGNED (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 914, __FUNCTION__))->base.u.bits.unsigned_flag)); |
915 | } |
916 | |
917 | max_ibit = ibit1 >= ibit2 ? ibit1 : ibit2; |
918 | max_fbit = fbit1 >= fbit2 ? fbit1 : fbit2; |
919 | return c_common_fixed_point_type_for_size (max_ibit, max_fbit, unsignedp, |
920 | satp); |
921 | } |
922 | |
923 | /* Both real or both integers; use the one with greater precision. */ |
924 | |
925 | if (TYPE_PRECISION (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 925, __FUNCTION__))->type_common.precision) > TYPE_PRECISION (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 925, __FUNCTION__))->type_common.precision)) |
926 | return t1; |
927 | else if (TYPE_PRECISION (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 927, __FUNCTION__))->type_common.precision) > TYPE_PRECISION (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 927, __FUNCTION__))->type_common.precision)) |
928 | return t2; |
929 | |
930 | /* Same precision. Prefer long longs to longs to ints when the |
931 | same precision, following the C99 rules on integer type rank |
932 | (which are equivalent to the C90 rules for C90 types). */ |
933 | |
934 | if (TYPE_MAIN_VARIANT (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 934, __FUNCTION__))->type_common.main_variant) == long_long_unsigned_type_nodeinteger_types[itk_unsigned_long_long] |
935 | || TYPE_MAIN_VARIANT (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 935, __FUNCTION__))->type_common.main_variant) == long_long_unsigned_type_nodeinteger_types[itk_unsigned_long_long]) |
936 | return long_long_unsigned_type_nodeinteger_types[itk_unsigned_long_long]; |
937 | |
938 | if (TYPE_MAIN_VARIANT (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 938, __FUNCTION__))->type_common.main_variant) == long_long_integer_type_nodeinteger_types[itk_long_long] |
939 | || TYPE_MAIN_VARIANT (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 939, __FUNCTION__))->type_common.main_variant) == long_long_integer_type_nodeinteger_types[itk_long_long]) |
940 | { |
941 | if (TYPE_UNSIGNED (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 941, __FUNCTION__))->base.u.bits.unsigned_flag) || TYPE_UNSIGNED (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 941, __FUNCTION__))->base.u.bits.unsigned_flag)) |
942 | return long_long_unsigned_type_nodeinteger_types[itk_unsigned_long_long]; |
943 | else |
944 | return long_long_integer_type_nodeinteger_types[itk_long_long]; |
945 | } |
946 | |
947 | if (TYPE_MAIN_VARIANT (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 947, __FUNCTION__))->type_common.main_variant) == long_unsigned_type_nodeinteger_types[itk_unsigned_long] |
948 | || TYPE_MAIN_VARIANT (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 948, __FUNCTION__))->type_common.main_variant) == long_unsigned_type_nodeinteger_types[itk_unsigned_long]) |
949 | return long_unsigned_type_nodeinteger_types[itk_unsigned_long]; |
950 | |
951 | if (TYPE_MAIN_VARIANT (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 951, __FUNCTION__))->type_common.main_variant) == long_integer_type_nodeinteger_types[itk_long] |
952 | || TYPE_MAIN_VARIANT (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 952, __FUNCTION__))->type_common.main_variant) == long_integer_type_nodeinteger_types[itk_long]) |
953 | { |
954 | /* But preserve unsignedness from the other type, |
955 | since long cannot hold all the values of an unsigned int. */ |
956 | if (TYPE_UNSIGNED (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 956, __FUNCTION__))->base.u.bits.unsigned_flag) || TYPE_UNSIGNED (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 956, __FUNCTION__))->base.u.bits.unsigned_flag)) |
957 | return long_unsigned_type_nodeinteger_types[itk_unsigned_long]; |
958 | else |
959 | return long_integer_type_nodeinteger_types[itk_long]; |
960 | } |
961 | |
962 | /* For floating types of the same TYPE_PRECISION (which we here |
963 | assume means either the same set of values, or sets of values |
964 | neither a subset of the other, with behavior being undefined in |
965 | the latter case), follow the rules from TS 18661-3: prefer |
966 | interchange types _FloatN, then standard types long double, |
967 | double, float, then extended types _FloatNx. For extended types, |
968 | check them starting with _Float128x as that seems most consistent |
969 | in spirit with preferring long double to double; for interchange |
970 | types, also check in that order for consistency although it's not |
971 | possible for more than one of them to have the same |
972 | precision. */ |
973 | tree mv1 = TYPE_MAIN_VARIANT (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 973, __FUNCTION__))->type_common.main_variant); |
974 | tree mv2 = TYPE_MAIN_VARIANT (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 974, __FUNCTION__))->type_common.main_variant); |
975 | |
976 | for (int i = NUM_FLOATN_TYPES(TI_FLOATN_TYPE_LAST - TI_FLOATN_TYPE_FIRST + 1) - 1; i >= 0; i--) |
977 | 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)]) |
978 | return FLOATN_TYPE_NODE (i)global_trees[TI_FLOATN_TYPE_FIRST + (i)]; |
979 | |
980 | /* Likewise, prefer long double to double even if same size. */ |
981 | if (mv1 == long_double_type_nodeglobal_trees[TI_LONG_DOUBLE_TYPE] || mv2 == long_double_type_nodeglobal_trees[TI_LONG_DOUBLE_TYPE]) |
982 | return long_double_type_nodeglobal_trees[TI_LONG_DOUBLE_TYPE]; |
983 | |
984 | /* Likewise, prefer double to float even if same size. |
985 | We got a couple of embedded targets with 32 bit doubles, and the |
986 | pdp11 might have 64 bit floats. */ |
987 | if (mv1 == double_type_nodeglobal_trees[TI_DOUBLE_TYPE] || mv2 == double_type_nodeglobal_trees[TI_DOUBLE_TYPE]) |
988 | return double_type_nodeglobal_trees[TI_DOUBLE_TYPE]; |
989 | |
990 | if (mv1 == float_type_nodeglobal_trees[TI_FLOAT_TYPE] || mv2 == float_type_nodeglobal_trees[TI_FLOAT_TYPE]) |
991 | return float_type_nodeglobal_trees[TI_FLOAT_TYPE]; |
992 | |
993 | for (int i = NUM_FLOATNX_TYPES(TI_FLOATNX_TYPE_LAST - TI_FLOATNX_TYPE_FIRST + 1) - 1; i >= 0; i--) |
994 | 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)]) |
995 | return FLOATNX_TYPE_NODE (i)global_trees[TI_FLOATNX_TYPE_FIRST + (i)]; |
996 | |
997 | /* Otherwise prefer the unsigned one. */ |
998 | |
999 | if (TYPE_UNSIGNED (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 999, __FUNCTION__))->base.u.bits.unsigned_flag)) |
1000 | return t1; |
1001 | else |
1002 | return t2; |
1003 | } |
1004 | |
1005 | /* Wrapper around c_common_type that is used by c-common.c and other |
1006 | front end optimizations that remove promotions. ENUMERAL_TYPEs |
1007 | are allowed here and are converted to their compatible integer types. |
1008 | BOOLEAN_TYPEs are allowed here and return either boolean_type_node or |
1009 | preferably a non-Boolean type as the common type. */ |
1010 | tree |
1011 | common_type (tree t1, tree t2) |
1012 | { |
1013 | if (TREE_CODE (t1)((enum tree_code) (t1)->base.code) == ENUMERAL_TYPE) |
1014 | t1 = c_common_type_for_size (TYPE_PRECISION (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1014, __FUNCTION__))->type_common.precision), 1); |
1015 | if (TREE_CODE (t2)((enum tree_code) (t2)->base.code) == ENUMERAL_TYPE) |
1016 | t2 = c_common_type_for_size (TYPE_PRECISION (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1016, __FUNCTION__))->type_common.precision), 1); |
1017 | |
1018 | /* If both types are BOOLEAN_TYPE, then return boolean_type_node. */ |
1019 | if (TREE_CODE (t1)((enum tree_code) (t1)->base.code) == BOOLEAN_TYPE |
1020 | && TREE_CODE (t2)((enum tree_code) (t2)->base.code) == BOOLEAN_TYPE) |
1021 | return boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE]; |
1022 | |
1023 | /* If either type is BOOLEAN_TYPE, then return the other. */ |
1024 | if (TREE_CODE (t1)((enum tree_code) (t1)->base.code) == BOOLEAN_TYPE) |
1025 | return t2; |
1026 | if (TREE_CODE (t2)((enum tree_code) (t2)->base.code) == BOOLEAN_TYPE) |
1027 | return t1; |
1028 | |
1029 | return c_common_type (t1, t2); |
1030 | } |
1031 | |
1032 | /* Return 1 if TYPE1 and TYPE2 are compatible types for assignment |
1033 | or various other operations. Return 2 if they are compatible |
1034 | but a warning may be needed if you use them together. */ |
1035 | |
1036 | int |
1037 | comptypes (tree type1, tree type2) |
1038 | { |
1039 | const struct tagged_tu_seen_cache * tagged_tu_seen_base1 = tagged_tu_seen_base; |
1040 | int val; |
1041 | |
1042 | val = comptypes_internal (type1, type2, NULL__null, NULL__null); |
1043 | free_all_tagged_tu_seen_up_to (tagged_tu_seen_base1); |
1044 | |
1045 | return val; |
1046 | } |
1047 | |
1048 | /* Like comptypes, but if it returns non-zero because enum and int are |
1049 | compatible, it sets *ENUM_AND_INT_P to true. */ |
1050 | |
1051 | static int |
1052 | comptypes_check_enum_int (tree type1, tree type2, bool *enum_and_int_p) |
1053 | { |
1054 | const struct tagged_tu_seen_cache * tagged_tu_seen_base1 = tagged_tu_seen_base; |
1055 | int val; |
1056 | |
1057 | val = comptypes_internal (type1, type2, enum_and_int_p, NULL__null); |
1058 | free_all_tagged_tu_seen_up_to (tagged_tu_seen_base1); |
1059 | |
1060 | return val; |
1061 | } |
1062 | |
1063 | /* Like comptypes, but if it returns nonzero for different types, it |
1064 | sets *DIFFERENT_TYPES_P to true. */ |
1065 | |
1066 | int |
1067 | comptypes_check_different_types (tree type1, tree type2, |
1068 | bool *different_types_p) |
1069 | { |
1070 | const struct tagged_tu_seen_cache * tagged_tu_seen_base1 = tagged_tu_seen_base; |
1071 | int val; |
1072 | |
1073 | val = comptypes_internal (type1, type2, NULL__null, different_types_p); |
1074 | free_all_tagged_tu_seen_up_to (tagged_tu_seen_base1); |
1075 | |
1076 | return val; |
1077 | } |
1078 | |
1079 | /* Return 1 if TYPE1 and TYPE2 are compatible types for assignment |
1080 | or various other operations. Return 2 if they are compatible |
1081 | but a warning may be needed if you use them together. If |
1082 | ENUM_AND_INT_P is not NULL, and one type is an enum and the other a |
1083 | compatible integer type, then this sets *ENUM_AND_INT_P to true; |
1084 | *ENUM_AND_INT_P is never set to false. If DIFFERENT_TYPES_P is not |
1085 | NULL, and the types are compatible but different enough not to be |
1086 | permitted in C11 typedef redeclarations, then this sets |
1087 | *DIFFERENT_TYPES_P to true; *DIFFERENT_TYPES_P is never set to |
1088 | false, but may or may not be set if the types are incompatible. |
1089 | This differs from comptypes, in that we don't free the seen |
1090 | types. */ |
1091 | |
1092 | static int |
1093 | comptypes_internal (const_tree type1, const_tree type2, bool *enum_and_int_p, |
1094 | bool *different_types_p) |
1095 | { |
1096 | const_tree t1 = type1; |
1097 | const_tree t2 = type2; |
1098 | int attrval, val; |
1099 | |
1100 | /* Suppress errors caused by previously reported errors. */ |
1101 | |
1102 | if (t1 == t2 || !t1 || !t2 |
1103 | || TREE_CODE (t1)((enum tree_code) (t1)->base.code) == ERROR_MARK || TREE_CODE (t2)((enum tree_code) (t2)->base.code) == ERROR_MARK) |
1104 | return 1; |
1105 | |
1106 | /* Enumerated types are compatible with integer types, but this is |
1107 | not transitive: two enumerated types in the same translation unit |
1108 | are compatible with each other only if they are the same type. */ |
1109 | |
1110 | if (TREE_CODE (t1)((enum tree_code) (t1)->base.code) == ENUMERAL_TYPE && TREE_CODE (t2)((enum tree_code) (t2)->base.code) != ENUMERAL_TYPE) |
1111 | { |
1112 | t1 = c_common_type_for_size (TYPE_PRECISION (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1112, __FUNCTION__))->type_common.precision), TYPE_UNSIGNED (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1112, __FUNCTION__))->base.u.bits.unsigned_flag)); |
1113 | if (TREE_CODE (t2)((enum tree_code) (t2)->base.code) != VOID_TYPE) |
1114 | { |
1115 | if (enum_and_int_p != NULL__null) |
1116 | *enum_and_int_p = true; |
1117 | if (different_types_p != NULL__null) |
1118 | *different_types_p = true; |
1119 | } |
1120 | } |
1121 | else if (TREE_CODE (t2)((enum tree_code) (t2)->base.code) == ENUMERAL_TYPE && TREE_CODE (t1)((enum tree_code) (t1)->base.code) != ENUMERAL_TYPE) |
1122 | { |
1123 | t2 = c_common_type_for_size (TYPE_PRECISION (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1123, __FUNCTION__))->type_common.precision), TYPE_UNSIGNED (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1123, __FUNCTION__))->base.u.bits.unsigned_flag)); |
1124 | if (TREE_CODE (t1)((enum tree_code) (t1)->base.code) != VOID_TYPE) |
1125 | { |
1126 | if (enum_and_int_p != NULL__null) |
1127 | *enum_and_int_p = true; |
1128 | if (different_types_p != NULL__null) |
1129 | *different_types_p = true; |
1130 | } |
1131 | } |
1132 | |
1133 | if (t1 == t2) |
1134 | return 1; |
1135 | |
1136 | /* Different classes of types can't be compatible. */ |
1137 | |
1138 | if (TREE_CODE (t1)((enum tree_code) (t1)->base.code) != TREE_CODE (t2)((enum tree_code) (t2)->base.code)) |
1139 | return 0; |
1140 | |
1141 | /* Qualifiers must match. C99 6.7.3p9 */ |
1142 | |
1143 | if (TYPE_QUALS (t1)((int) ((((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1143, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1143, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1143, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1143, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ) | (((((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1143, __FUNCTION__))->base.u.bits.address_space) & 0xFF ) << 8)))) != TYPE_QUALS (t2)((int) ((((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1143, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1143, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1143, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1143, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ) | (((((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1143, __FUNCTION__))->base.u.bits.address_space) & 0xFF ) << 8))))) |
1144 | return 0; |
1145 | |
1146 | /* Allow for two different type nodes which have essentially the same |
1147 | definition. Note that we already checked for equality of the type |
1148 | qualifiers (just above). */ |
1149 | |
1150 | if (TREE_CODE (t1)((enum tree_code) (t1)->base.code) != ARRAY_TYPE |
1151 | && TYPE_MAIN_VARIANT (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1151, __FUNCTION__))->type_common.main_variant) == TYPE_MAIN_VARIANT (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1151, __FUNCTION__))->type_common.main_variant)) |
1152 | return 1; |
1153 | |
1154 | /* 1 if no need for warning yet, 2 if warning cause has been seen. */ |
1155 | if (!(attrval = comp_type_attributes (t1, t2))) |
1156 | return 0; |
1157 | |
1158 | /* 1 if no need for warning yet, 2 if warning cause has been seen. */ |
1159 | val = 0; |
1160 | |
1161 | switch (TREE_CODE (t1)((enum tree_code) (t1)->base.code)) |
1162 | { |
1163 | case INTEGER_TYPE: |
1164 | case FIXED_POINT_TYPE: |
1165 | case REAL_TYPE: |
1166 | /* With these nodes, we can't determine type equivalence by |
1167 | looking at what is stored in the nodes themselves, because |
1168 | two nodes might have different TYPE_MAIN_VARIANTs but still |
1169 | represent the same type. For example, wchar_t and int could |
1170 | have the same properties (TYPE_PRECISION, TYPE_MIN_VALUE, |
1171 | TYPE_MAX_VALUE, etc.), but have different TYPE_MAIN_VARIANTs |
1172 | and are distinct types. On the other hand, int and the |
1173 | following typedef |
1174 | |
1175 | typedef int INT __attribute((may_alias)); |
1176 | |
1177 | have identical properties, different TYPE_MAIN_VARIANTs, but |
1178 | represent the same type. The canonical type system keeps |
1179 | track of equivalence in this case, so we fall back on it. */ |
1180 | return TYPE_CANONICAL (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1180, __FUNCTION__))->type_common.canonical) == TYPE_CANONICAL (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1180, __FUNCTION__))->type_common.canonical); |
1181 | |
1182 | case POINTER_TYPE: |
1183 | /* Do not remove mode information. */ |
1184 | if (TYPE_MODE (t1)((((enum tree_code) ((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1184, __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), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1184, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode (t2) : (t2)->type_common.mode)) |
1185 | break; |
1186 | val = (TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1186, __FUNCTION__))->typed.type) == TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1186, __FUNCTION__))->typed.type) |
1187 | ? 1 : comptypes_internal (TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1187, __FUNCTION__))->typed.type), TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1187, __FUNCTION__))->typed.type), |
1188 | enum_and_int_p, different_types_p)); |
1189 | break; |
1190 | |
1191 | case FUNCTION_TYPE: |
1192 | val = function_types_compatible_p (t1, t2, enum_and_int_p, |
1193 | different_types_p); |
1194 | break; |
1195 | |
1196 | case ARRAY_TYPE: |
1197 | { |
1198 | tree d1 = TYPE_DOMAIN (t1)((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1198, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ); |
1199 | tree d2 = TYPE_DOMAIN (t2)((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1199, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ); |
1200 | bool d1_variable, d2_variable; |
1201 | bool d1_zero, d2_zero; |
1202 | val = 1; |
1203 | |
1204 | /* Target types must match incl. qualifiers. */ |
1205 | if (TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1205, __FUNCTION__))->typed.type) != TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1205, __FUNCTION__))->typed.type) |
1206 | && (val = comptypes_internal (TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1206, __FUNCTION__))->typed.type), TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1206, __FUNCTION__))->typed.type), |
1207 | enum_and_int_p, |
1208 | different_types_p)) == 0) |
1209 | return 0; |
1210 | |
1211 | if (different_types_p != NULL__null |
1212 | && (d1 == NULL_TREE(tree) __null) != (d2 == NULL_TREE(tree) __null)) |
1213 | *different_types_p = true; |
1214 | /* Sizes must match unless one is missing or variable. */ |
1215 | if (d1 == NULL_TREE(tree) __null || d2 == NULL_TREE(tree) __null || d1 == d2) |
1216 | break; |
1217 | |
1218 | d1_zero = !TYPE_MAX_VALUE (d1)((tree_check5 ((d1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1218, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval ); |
1219 | d2_zero = !TYPE_MAX_VALUE (d2)((tree_check5 ((d2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1219, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval ); |
1220 | |
1221 | d1_variable = (!d1_zero |
1222 | && (TREE_CODE (TYPE_MIN_VALUE (d1))((enum tree_code) (((tree_check5 ((d1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1222, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.minval ))->base.code) != INTEGER_CST |
1223 | || TREE_CODE (TYPE_MAX_VALUE (d1))((enum tree_code) (((tree_check5 ((d1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1223, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval ))->base.code) != INTEGER_CST)); |
1224 | d2_variable = (!d2_zero |
1225 | && (TREE_CODE (TYPE_MIN_VALUE (d2))((enum tree_code) (((tree_check5 ((d2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1225, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.minval ))->base.code) != INTEGER_CST |
1226 | || TREE_CODE (TYPE_MAX_VALUE (d2))((enum tree_code) (((tree_check5 ((d2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1226, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval ))->base.code) != INTEGER_CST)); |
1227 | d1_variable = d1_variable || (d1_zero && c_vla_type_p (t1)); |
1228 | d2_variable = d2_variable || (d2_zero && c_vla_type_p (t2)); |
1229 | |
1230 | if (different_types_p != NULL__null |
1231 | && d1_variable != d2_variable) |
1232 | *different_types_p = true; |
1233 | if (d1_variable || d2_variable) |
1234 | break; |
1235 | if (d1_zero && d2_zero) |
1236 | break; |
1237 | if (d1_zero || d2_zero |
1238 | || !tree_int_cst_equal (TYPE_MIN_VALUE (d1)((tree_check5 ((d1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1238, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.minval ), TYPE_MIN_VALUE (d2)((tree_check5 ((d2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1238, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.minval )) |
1239 | || !tree_int_cst_equal (TYPE_MAX_VALUE (d1)((tree_check5 ((d1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1239, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval ), TYPE_MAX_VALUE (d2)((tree_check5 ((d2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1239, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval ))) |
1240 | val = 0; |
1241 | |
1242 | break; |
1243 | } |
1244 | |
1245 | case ENUMERAL_TYPE: |
1246 | case RECORD_TYPE: |
1247 | case UNION_TYPE: |
1248 | if (val != 1 && !same_translation_unit_p (t1, t2)) |
1249 | { |
1250 | tree a1 = TYPE_ATTRIBUTES (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1250, __FUNCTION__))->type_common.attributes); |
1251 | tree a2 = TYPE_ATTRIBUTES (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1251, __FUNCTION__))->type_common.attributes); |
1252 | |
1253 | if (! attribute_list_contained (a1, a2) |
1254 | && ! attribute_list_contained (a2, a1)) |
1255 | break; |
1256 | |
1257 | if (attrval != 2) |
1258 | return tagged_types_tu_compatible_p (t1, t2, enum_and_int_p, |
1259 | different_types_p); |
1260 | val = tagged_types_tu_compatible_p (t1, t2, enum_and_int_p, |
1261 | different_types_p); |
1262 | } |
1263 | break; |
1264 | |
1265 | case VECTOR_TYPE: |
1266 | val = (known_eq (TYPE_VECTOR_SUBPARTS (t1), TYPE_VECTOR_SUBPARTS (t2))(!maybe_ne (TYPE_VECTOR_SUBPARTS (t1), TYPE_VECTOR_SUBPARTS ( t2))) |
1267 | && comptypes_internal (TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1267, __FUNCTION__))->typed.type), TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1267, __FUNCTION__))->typed.type), |
1268 | enum_and_int_p, different_types_p)); |
1269 | break; |
1270 | |
1271 | default: |
1272 | break; |
1273 | } |
1274 | return attrval == 2 && val == 1 ? 2 : val; |
1275 | } |
1276 | |
1277 | /* Return 1 if TTL and TTR are pointers to types that are equivalent, ignoring |
1278 | their qualifiers, except for named address spaces. If the pointers point to |
1279 | different named addresses, then we must determine if one address space is a |
1280 | subset of the other. */ |
1281 | |
1282 | static int |
1283 | comp_target_types (location_t location, tree ttl, tree ttr) |
1284 | { |
1285 | int val; |
1286 | int val_ped; |
1287 | tree mvl = TREE_TYPE (ttl)((contains_struct_check ((ttl), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1287, __FUNCTION__))->typed.type); |
1288 | tree mvr = TREE_TYPE (ttr)((contains_struct_check ((ttr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1288, __FUNCTION__))->typed.type); |
1289 | addr_space_t asl = TYPE_ADDR_SPACE (mvl)((tree_class_check ((mvl), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1289, __FUNCTION__))->base.u.bits.address_space); |
1290 | addr_space_t asr = TYPE_ADDR_SPACE (mvr)((tree_class_check ((mvr), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1290, __FUNCTION__))->base.u.bits.address_space); |
1291 | addr_space_t as_common; |
1292 | bool enum_and_int_p; |
1293 | |
1294 | /* Fail if pointers point to incompatible address spaces. */ |
1295 | if (!addr_space_superset (asl, asr, &as_common)) |
1296 | return 0; |
1297 | |
1298 | /* For pedantic record result of comptypes on arrays before losing |
1299 | qualifiers on the element type below. */ |
1300 | val_ped = 1; |
1301 | |
1302 | if (TREE_CODE (mvl)((enum tree_code) (mvl)->base.code) == ARRAY_TYPE |
1303 | && TREE_CODE (mvr)((enum tree_code) (mvr)->base.code) == ARRAY_TYPE) |
1304 | val_ped = comptypes (mvl, mvr); |
1305 | |
1306 | /* Qualifiers on element types of array types that are |
1307 | pointer targets are lost by taking their TYPE_MAIN_VARIANT. */ |
1308 | |
1309 | mvl = (TYPE_ATOMIC (strip_array_types (mvl))((tree_class_check ((strip_array_types (mvl)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1309, __FUNCTION__))->base.u.bits.atomic_flag) |
1310 | ? c_build_qualified_type (TYPE_MAIN_VARIANT (mvl)((tree_class_check ((mvl), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1310, __FUNCTION__))->type_common.main_variant), TYPE_QUAL_ATOMIC) |
1311 | : TYPE_MAIN_VARIANT (mvl)((tree_class_check ((mvl), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1311, __FUNCTION__))->type_common.main_variant)); |
1312 | |
1313 | mvr = (TYPE_ATOMIC (strip_array_types (mvr))((tree_class_check ((strip_array_types (mvr)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1313, __FUNCTION__))->base.u.bits.atomic_flag) |
1314 | ? c_build_qualified_type (TYPE_MAIN_VARIANT (mvr)((tree_class_check ((mvr), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1314, __FUNCTION__))->type_common.main_variant), TYPE_QUAL_ATOMIC) |
1315 | : TYPE_MAIN_VARIANT (mvr)((tree_class_check ((mvr), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1315, __FUNCTION__))->type_common.main_variant)); |
1316 | |
1317 | enum_and_int_p = false; |
1318 | val = comptypes_check_enum_int (mvl, mvr, &enum_and_int_p); |
1319 | |
1320 | if (val == 1 && val_ped != 1) |
1321 | pedwarn (location, OPT_Wpedantic, "pointers to arrays with different qualifiers " |
1322 | "are incompatible in ISO C"); |
1323 | |
1324 | if (val == 2) |
1325 | pedwarn (location, OPT_Wpedantic, "types are not quite compatible"); |
1326 | |
1327 | if (val == 1 && enum_and_int_p && warn_cxx_compatglobal_options.x_warn_cxx_compat) |
1328 | warning_at (location, OPT_Wc___compat, |
1329 | "pointer target types incompatible in C++"); |
1330 | |
1331 | return val; |
1332 | } |
1333 | |
1334 | /* Subroutines of `comptypes'. */ |
1335 | |
1336 | /* Determine whether two trees derive from the same translation unit. |
1337 | If the CONTEXT chain ends in a null, that tree's context is still |
1338 | being parsed, so if two trees have context chains ending in null, |
1339 | they're in the same translation unit. */ |
1340 | |
1341 | bool |
1342 | same_translation_unit_p (const_tree t1, const_tree t2) |
1343 | { |
1344 | while (t1 && TREE_CODE (t1)((enum tree_code) (t1)->base.code) != TRANSLATION_UNIT_DECL) |
1345 | switch (TREE_CODE_CLASS (TREE_CODE (t1))tree_code_type[(int) (((enum tree_code) (t1)->base.code))]) |
1346 | { |
1347 | case tcc_declaration: |
1348 | t1 = DECL_CONTEXT (t1)((contains_struct_check ((t1), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1348, __FUNCTION__))->decl_minimal.context); break; |
1349 | case tcc_type: |
1350 | t1 = TYPE_CONTEXT (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1350, __FUNCTION__))->type_common.context); break; |
1351 | case tcc_exceptional: |
1352 | t1 = BLOCK_SUPERCONTEXT (t1)((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1352, __FUNCTION__, (BLOCK)))->block.supercontext); break; /* assume block */ |
1353 | default: gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1353, __FUNCTION__)); |
1354 | } |
1355 | |
1356 | while (t2 && TREE_CODE (t2)((enum tree_code) (t2)->base.code) != TRANSLATION_UNIT_DECL) |
1357 | switch (TREE_CODE_CLASS (TREE_CODE (t2))tree_code_type[(int) (((enum tree_code) (t2)->base.code))]) |
1358 | { |
1359 | case tcc_declaration: |
1360 | t2 = DECL_CONTEXT (t2)((contains_struct_check ((t2), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1360, __FUNCTION__))->decl_minimal.context); break; |
1361 | case tcc_type: |
1362 | t2 = TYPE_CONTEXT (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1362, __FUNCTION__))->type_common.context); break; |
1363 | case tcc_exceptional: |
1364 | t2 = BLOCK_SUPERCONTEXT (t2)((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1364, __FUNCTION__, (BLOCK)))->block.supercontext); break; /* assume block */ |
1365 | default: gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1365, __FUNCTION__)); |
1366 | } |
1367 | |
1368 | return t1 == t2; |
1369 | } |
1370 | |
1371 | /* Allocate the seen two types, assuming that they are compatible. */ |
1372 | |
1373 | static struct tagged_tu_seen_cache * |
1374 | alloc_tagged_tu_seen_cache (const_tree t1, const_tree t2) |
1375 | { |
1376 | struct tagged_tu_seen_cache *tu = XNEW (struct tagged_tu_seen_cache)((struct tagged_tu_seen_cache *) xmalloc (sizeof (struct tagged_tu_seen_cache ))); |
1377 | tu->next = tagged_tu_seen_base; |
1378 | tu->t1 = t1; |
1379 | tu->t2 = t2; |
1380 | |
1381 | tagged_tu_seen_base = tu; |
1382 | |
1383 | /* The C standard says that two structures in different translation |
1384 | units are compatible with each other only if the types of their |
1385 | fields are compatible (among other things). We assume that they |
1386 | are compatible until proven otherwise when building the cache. |
1387 | An example where this can occur is: |
1388 | struct a |
1389 | { |
1390 | struct a *next; |
1391 | }; |
1392 | If we are comparing this against a similar struct in another TU, |
1393 | and did not assume they were compatible, we end up with an infinite |
1394 | loop. */ |
1395 | tu->val = 1; |
1396 | return tu; |
1397 | } |
1398 | |
1399 | /* Free the seen types until we get to TU_TIL. */ |
1400 | |
1401 | static void |
1402 | free_all_tagged_tu_seen_up_to (const struct tagged_tu_seen_cache *tu_til) |
1403 | { |
1404 | const struct tagged_tu_seen_cache *tu = tagged_tu_seen_base; |
1405 | while (tu != tu_til) |
1406 | { |
1407 | const struct tagged_tu_seen_cache *const tu1 |
1408 | = (const struct tagged_tu_seen_cache *) tu; |
1409 | tu = tu1->next; |
1410 | XDELETE (CONST_CAST (struct tagged_tu_seen_cache *, tu1))free ((void*) ((const_cast<struct tagged_tu_seen_cache *> ((tu1))))); |
1411 | } |
1412 | tagged_tu_seen_base = tu_til; |
1413 | } |
1414 | |
1415 | /* Return 1 if two 'struct', 'union', or 'enum' types T1 and T2 are |
1416 | compatible. If the two types are not the same (which has been |
1417 | checked earlier), this can only happen when multiple translation |
1418 | units are being compiled. See C99 6.2.7 paragraph 1 for the exact |
1419 | rules. ENUM_AND_INT_P and DIFFERENT_TYPES_P are as in |
1420 | comptypes_internal. */ |
1421 | |
1422 | static int |
1423 | tagged_types_tu_compatible_p (const_tree t1, const_tree t2, |
1424 | bool *enum_and_int_p, bool *different_types_p) |
1425 | { |
1426 | tree s1, s2; |
1427 | bool needs_warning = false; |
1428 | |
1429 | /* We have to verify that the tags of the types are the same. This |
1430 | is harder than it looks because this may be a typedef, so we have |
1431 | to go look at the original type. It may even be a typedef of a |
1432 | typedef... |
1433 | In the case of compiler-created builtin structs the TYPE_DECL |
1434 | may be a dummy, with no DECL_ORIGINAL_TYPE. Don't fault. */ |
1435 | while (TYPE_NAME (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1435, __FUNCTION__))->type_common.name) |
1436 | && TREE_CODE (TYPE_NAME (t1))((enum tree_code) (((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1436, __FUNCTION__))->type_common.name))->base.code) == TYPE_DECL |
1437 | && DECL_ORIGINAL_TYPE (TYPE_NAME (t1))((tree_check ((((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1437, __FUNCTION__))->type_common.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1437, __FUNCTION__, (TYPE_DECL)))->decl_non_common.result )) |
1438 | t1 = DECL_ORIGINAL_TYPE (TYPE_NAME (t1))((tree_check ((((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1438, __FUNCTION__))->type_common.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1438, __FUNCTION__, (TYPE_DECL)))->decl_non_common.result ); |
1439 | |
1440 | while (TYPE_NAME (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1440, __FUNCTION__))->type_common.name) |
1441 | && TREE_CODE (TYPE_NAME (t2))((enum tree_code) (((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1441, __FUNCTION__))->type_common.name))->base.code) == TYPE_DECL |
1442 | && DECL_ORIGINAL_TYPE (TYPE_NAME (t2))((tree_check ((((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1442, __FUNCTION__))->type_common.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1442, __FUNCTION__, (TYPE_DECL)))->decl_non_common.result )) |
1443 | t2 = DECL_ORIGINAL_TYPE (TYPE_NAME (t2))((tree_check ((((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1443, __FUNCTION__))->type_common.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1443, __FUNCTION__, (TYPE_DECL)))->decl_non_common.result ); |
1444 | |
1445 | /* C90 didn't have the requirement that the two tags be the same. */ |
1446 | if (flag_isoc99 && TYPE_NAME (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1446, __FUNCTION__))->type_common.name) != TYPE_NAME (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1446, __FUNCTION__))->type_common.name)) |
1447 | return 0; |
1448 | |
1449 | /* C90 didn't say what happened if one or both of the types were |
1450 | incomplete; we choose to follow C99 rules here, which is that they |
1451 | are compatible. */ |
1452 | if (TYPE_SIZE (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1452, __FUNCTION__))->type_common.size) == NULL__null |
1453 | || TYPE_SIZE (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1453, __FUNCTION__))->type_common.size) == NULL__null) |
1454 | return 1; |
1455 | |
1456 | { |
1457 | const struct tagged_tu_seen_cache * tts_i; |
1458 | for (tts_i = tagged_tu_seen_base; tts_i != NULL__null; tts_i = tts_i->next) |
1459 | if (tts_i->t1 == t1 && tts_i->t2 == t2) |
1460 | return tts_i->val; |
1461 | } |
1462 | |
1463 | switch (TREE_CODE (t1)((enum tree_code) (t1)->base.code)) |
1464 | { |
1465 | case ENUMERAL_TYPE: |
1466 | { |
1467 | struct tagged_tu_seen_cache *tu = alloc_tagged_tu_seen_cache (t1, t2); |
1468 | /* Speed up the case where the type values are in the same order. */ |
1469 | tree tv1 = TYPE_VALUES (t1)((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1469, __FUNCTION__, (ENUMERAL_TYPE)))->type_non_common.values ); |
1470 | tree tv2 = TYPE_VALUES (t2)((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1470, __FUNCTION__, (ENUMERAL_TYPE)))->type_non_common.values ); |
1471 | |
1472 | if (tv1 == tv2) |
1473 | { |
1474 | return 1; |
1475 | } |
1476 | |
1477 | for (;tv1 && tv2; tv1 = TREE_CHAIN (tv1)((contains_struct_check ((tv1), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1477, __FUNCTION__))->common.chain), tv2 = TREE_CHAIN (tv2)((contains_struct_check ((tv2), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1477, __FUNCTION__))->common.chain)) |
1478 | { |
1479 | if (TREE_PURPOSE (tv1)((tree_check ((tv1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1479, __FUNCTION__, (TREE_LIST)))->list.purpose) != TREE_PURPOSE (tv2)((tree_check ((tv2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1479, __FUNCTION__, (TREE_LIST)))->list.purpose)) |
1480 | break; |
1481 | if (simple_cst_equal (TREE_VALUE (tv1)((tree_check ((tv1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1481, __FUNCTION__, (TREE_LIST)))->list.value), TREE_VALUE (tv2)((tree_check ((tv2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1481, __FUNCTION__, (TREE_LIST)))->list.value)) != 1) |
1482 | { |
1483 | tu->val = 0; |
1484 | return 0; |
1485 | } |
1486 | } |
1487 | |
1488 | if (tv1 == NULL_TREE(tree) __null && tv2 == NULL_TREE(tree) __null) |
1489 | { |
1490 | return 1; |
1491 | } |
1492 | if (tv1 == NULL_TREE(tree) __null || tv2 == NULL_TREE(tree) __null) |
1493 | { |
1494 | tu->val = 0; |
1495 | return 0; |
1496 | } |
1497 | |
1498 | if (list_length (TYPE_VALUES (t1)((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1498, __FUNCTION__, (ENUMERAL_TYPE)))->type_non_common.values )) != list_length (TYPE_VALUES (t2)((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1498, __FUNCTION__, (ENUMERAL_TYPE)))->type_non_common.values ))) |
1499 | { |
1500 | tu->val = 0; |
1501 | return 0; |
1502 | } |
1503 | |
1504 | for (s1 = TYPE_VALUES (t1)((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1504, __FUNCTION__, (ENUMERAL_TYPE)))->type_non_common.values ); s1; s1 = TREE_CHAIN (s1)((contains_struct_check ((s1), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1504, __FUNCTION__))->common.chain)) |
1505 | { |
1506 | s2 = purpose_member (TREE_PURPOSE (s1)((tree_check ((s1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1506, __FUNCTION__, (TREE_LIST)))->list.purpose), TYPE_VALUES (t2)((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1506, __FUNCTION__, (ENUMERAL_TYPE)))->type_non_common.values )); |
1507 | if (s2 == NULL__null |
1508 | || simple_cst_equal (TREE_VALUE (s1)((tree_check ((s1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1508, __FUNCTION__, (TREE_LIST)))->list.value), TREE_VALUE (s2)((tree_check ((s2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1508, __FUNCTION__, (TREE_LIST)))->list.value)) != 1) |
1509 | { |
1510 | tu->val = 0; |
1511 | return 0; |
1512 | } |
1513 | } |
1514 | return 1; |
1515 | } |
1516 | |
1517 | case UNION_TYPE: |
1518 | { |
1519 | struct tagged_tu_seen_cache *tu = alloc_tagged_tu_seen_cache (t1, t2); |
1520 | if (list_length (TYPE_FIELDS (t1)((tree_check3 ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1520, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values)) != list_length (TYPE_FIELDS (t2)((tree_check3 ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1520, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values))) |
1521 | { |
1522 | tu->val = 0; |
1523 | return 0; |
1524 | } |
1525 | |
1526 | /* Speed up the common case where the fields are in the same order. */ |
1527 | for (s1 = TYPE_FIELDS (t1)((tree_check3 ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1527, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values), s2 = TYPE_FIELDS (t2)((tree_check3 ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1527, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); s1 && s2; |
1528 | s1 = DECL_CHAIN (s1)(((contains_struct_check (((contains_struct_check ((s1), (TS_DECL_MINIMAL ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1528, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1528, __FUNCTION__))->common.chain)), s2 = DECL_CHAIN (s2)(((contains_struct_check (((contains_struct_check ((s2), (TS_DECL_MINIMAL ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1528, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1528, __FUNCTION__))->common.chain))) |
1529 | { |
1530 | int result; |
1531 | |
1532 | if (DECL_NAME (s1)((contains_struct_check ((s1), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1532, __FUNCTION__))->decl_minimal.name) != DECL_NAME (s2)((contains_struct_check ((s2), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1532, __FUNCTION__))->decl_minimal.name)) |
1533 | break; |
1534 | result = comptypes_internal (TREE_TYPE (s1)((contains_struct_check ((s1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1534, __FUNCTION__))->typed.type), TREE_TYPE (s2)((contains_struct_check ((s2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1534, __FUNCTION__))->typed.type), |
1535 | enum_and_int_p, different_types_p); |
1536 | |
1537 | if (result != 1 && !DECL_NAME (s1)((contains_struct_check ((s1), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1537, __FUNCTION__))->decl_minimal.name)) |
1538 | break; |
1539 | if (result == 0) |
1540 | { |
1541 | tu->val = 0; |
1542 | return 0; |
1543 | } |
1544 | if (result == 2) |
1545 | needs_warning = true; |
1546 | |
1547 | if (TREE_CODE (s1)((enum tree_code) (s1)->base.code) == FIELD_DECL |
1548 | && simple_cst_equal (DECL_FIELD_BIT_OFFSET (s1)((tree_check ((s1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1548, __FUNCTION__, (FIELD_DECL)))->field_decl.bit_offset ), |
1549 | DECL_FIELD_BIT_OFFSET (s2)((tree_check ((s2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1549, __FUNCTION__, (FIELD_DECL)))->field_decl.bit_offset )) != 1) |
1550 | { |
1551 | tu->val = 0; |
1552 | return 0; |
1553 | } |
1554 | } |
1555 | if (!s1 && !s2) |
1556 | { |
1557 | tu->val = needs_warning ? 2 : 1; |
1558 | return tu->val; |
1559 | } |
1560 | |
1561 | for (s1 = TYPE_FIELDS (t1)((tree_check3 ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1561, __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 ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1561, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1561, __FUNCTION__))->common.chain))) |
1562 | { |
1563 | bool ok = false; |
1564 | |
1565 | for (s2 = TYPE_FIELDS (t2)((tree_check3 ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1565, __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 ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1565, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1565, __FUNCTION__))->common.chain))) |
1566 | if (DECL_NAME (s1)((contains_struct_check ((s1), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1566, __FUNCTION__))->decl_minimal.name) == DECL_NAME (s2)((contains_struct_check ((s2), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1566, __FUNCTION__))->decl_minimal.name)) |
1567 | { |
1568 | int result; |
1569 | |
1570 | result = comptypes_internal (TREE_TYPE (s1)((contains_struct_check ((s1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1570, __FUNCTION__))->typed.type), TREE_TYPE (s2)((contains_struct_check ((s2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1570, __FUNCTION__))->typed.type), |
1571 | enum_and_int_p, |
1572 | different_types_p); |
1573 | |
1574 | if (result != 1 && !DECL_NAME (s1)((contains_struct_check ((s1), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1574, __FUNCTION__))->decl_minimal.name)) |
1575 | continue; |
1576 | if (result == 0) |
1577 | { |
1578 | tu->val = 0; |
1579 | return 0; |
1580 | } |
1581 | if (result == 2) |
1582 | needs_warning = true; |
1583 | |
1584 | if (TREE_CODE (s1)((enum tree_code) (s1)->base.code) == FIELD_DECL |
1585 | && simple_cst_equal (DECL_FIELD_BIT_OFFSET (s1)((tree_check ((s1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1585, __FUNCTION__, (FIELD_DECL)))->field_decl.bit_offset ), |
1586 | DECL_FIELD_BIT_OFFSET (s2)((tree_check ((s2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1586, __FUNCTION__, (FIELD_DECL)))->field_decl.bit_offset )) != 1) |
1587 | break; |
1588 | |
1589 | ok = true; |
1590 | break; |
1591 | } |
1592 | if (!ok) |
1593 | { |
1594 | tu->val = 0; |
1595 | return 0; |
1596 | } |
1597 | } |
1598 | tu->val = needs_warning ? 2 : 10; |
1599 | return tu->val; |
1600 | } |
1601 | |
1602 | case RECORD_TYPE: |
1603 | { |
1604 | struct tagged_tu_seen_cache *tu = alloc_tagged_tu_seen_cache (t1, t2); |
1605 | |
1606 | for (s1 = TYPE_FIELDS (t1)((tree_check3 ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1606, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values), s2 = TYPE_FIELDS (t2)((tree_check3 ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1606, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); |
1607 | s1 && s2; |
1608 | s1 = DECL_CHAIN (s1)(((contains_struct_check (((contains_struct_check ((s1), (TS_DECL_MINIMAL ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1608, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1608, __FUNCTION__))->common.chain)), s2 = DECL_CHAIN (s2)(((contains_struct_check (((contains_struct_check ((s2), (TS_DECL_MINIMAL ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1608, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1608, __FUNCTION__))->common.chain))) |
1609 | { |
1610 | int result; |
1611 | if (TREE_CODE (s1)((enum tree_code) (s1)->base.code) != TREE_CODE (s2)((enum tree_code) (s2)->base.code) |
1612 | || DECL_NAME (s1)((contains_struct_check ((s1), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1612, __FUNCTION__))->decl_minimal.name) != DECL_NAME (s2)((contains_struct_check ((s2), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1612, __FUNCTION__))->decl_minimal.name)) |
1613 | break; |
1614 | result = comptypes_internal (TREE_TYPE (s1)((contains_struct_check ((s1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1614, __FUNCTION__))->typed.type), TREE_TYPE (s2)((contains_struct_check ((s2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1614, __FUNCTION__))->typed.type), |
1615 | enum_and_int_p, different_types_p); |
1616 | if (result == 0) |
1617 | break; |
1618 | if (result == 2) |
1619 | needs_warning = true; |
1620 | |
1621 | if (TREE_CODE (s1)((enum tree_code) (s1)->base.code) == FIELD_DECL |
1622 | && simple_cst_equal (DECL_FIELD_BIT_OFFSET (s1)((tree_check ((s1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1622, __FUNCTION__, (FIELD_DECL)))->field_decl.bit_offset ), |
1623 | DECL_FIELD_BIT_OFFSET (s2)((tree_check ((s2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1623, __FUNCTION__, (FIELD_DECL)))->field_decl.bit_offset )) != 1) |
1624 | break; |
1625 | } |
1626 | if (s1 && s2) |
1627 | tu->val = 0; |
1628 | else |
1629 | tu->val = needs_warning ? 2 : 1; |
1630 | return tu->val; |
1631 | } |
1632 | |
1633 | default: |
1634 | gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1634, __FUNCTION__)); |
1635 | } |
1636 | } |
1637 | |
1638 | /* Return 1 if two function types F1 and F2 are compatible. |
1639 | If either type specifies no argument types, |
1640 | the other must specify a fixed number of self-promoting arg types. |
1641 | Otherwise, if one type specifies only the number of arguments, |
1642 | the other must specify that number of self-promoting arg types. |
1643 | Otherwise, the argument types must match. |
1644 | ENUM_AND_INT_P and DIFFERENT_TYPES_P are as in comptypes_internal. */ |
1645 | |
1646 | static int |
1647 | function_types_compatible_p (const_tree f1, const_tree f2, |
1648 | bool *enum_and_int_p, bool *different_types_p) |
1649 | { |
1650 | tree args1, args2; |
1651 | /* 1 if no need for warning yet, 2 if warning cause has been seen. */ |
1652 | int val = 1; |
1653 | int val1; |
1654 | tree ret1, ret2; |
1655 | |
1656 | ret1 = TREE_TYPE (f1)((contains_struct_check ((f1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1656, __FUNCTION__))->typed.type); |
1657 | ret2 = TREE_TYPE (f2)((contains_struct_check ((f2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1657, __FUNCTION__))->typed.type); |
1658 | |
1659 | /* 'volatile' qualifiers on a function's return type used to mean |
1660 | the function is noreturn. */ |
1661 | if (TYPE_VOLATILE (ret1)((tree_class_check ((ret1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1661, __FUNCTION__))->base.volatile_flag) != TYPE_VOLATILE (ret2)((tree_class_check ((ret2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1661, __FUNCTION__))->base.volatile_flag)) |
1662 | pedwarn (input_location, 0, "function return types not compatible due to %<volatile%>"); |
1663 | if (TYPE_VOLATILE (ret1)((tree_class_check ((ret1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1663, __FUNCTION__))->base.volatile_flag)) |
1664 | ret1 = build_qualified_type (TYPE_MAIN_VARIANT (ret1)((tree_class_check ((ret1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1664, __FUNCTION__))->type_common.main_variant), |
1665 | TYPE_QUALS (ret1)((int) ((((tree_class_check ((ret1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1665, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((ret1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1665, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((ret1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1665, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((ret1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1665, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ) | (((((tree_class_check ((ret1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1665, __FUNCTION__))->base.u.bits.address_space) & 0xFF ) << 8)))) & ~TYPE_QUAL_VOLATILE); |
1666 | if (TYPE_VOLATILE (ret2)((tree_class_check ((ret2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1666, __FUNCTION__))->base.volatile_flag)) |
1667 | ret2 = build_qualified_type (TYPE_MAIN_VARIANT (ret2)((tree_class_check ((ret2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1667, __FUNCTION__))->type_common.main_variant), |
1668 | TYPE_QUALS (ret2)((int) ((((tree_class_check ((ret2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1668, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((ret2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1668, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((ret2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1668, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((ret2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1668, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ) | (((((tree_class_check ((ret2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1668, __FUNCTION__))->base.u.bits.address_space) & 0xFF ) << 8)))) & ~TYPE_QUAL_VOLATILE); |
1669 | val = comptypes_internal (ret1, ret2, enum_and_int_p, different_types_p); |
1670 | if (val == 0) |
1671 | return 0; |
1672 | |
1673 | args1 = TYPE_ARG_TYPES (f1)((tree_check2 ((f1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1673, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values); |
1674 | args2 = TYPE_ARG_TYPES (f2)((tree_check2 ((f2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1674, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values); |
1675 | |
1676 | if (different_types_p != NULL__null |
1677 | && (args1 == NULL_TREE(tree) __null) != (args2 == NULL_TREE(tree) __null)) |
1678 | *different_types_p = true; |
1679 | |
1680 | /* An unspecified parmlist matches any specified parmlist |
1681 | whose argument types don't need default promotions. */ |
1682 | |
1683 | if (args1 == NULL_TREE(tree) __null) |
1684 | { |
1685 | if (!self_promoting_args_p (args2)) |
1686 | return 0; |
1687 | /* If one of these types comes from a non-prototype fn definition, |
1688 | compare that with the other type's arglist. |
1689 | If they don't match, ask for a warning (but no error). */ |
1690 | if (TYPE_ACTUAL_ARG_TYPES (f1)((tree_class_check (((tree_check ((f1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1690, __FUNCTION__, (FUNCTION_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1690, __FUNCTION__))->type_non_common.lang_1) |
1691 | && type_lists_compatible_p (args2, TYPE_ACTUAL_ARG_TYPES (f1)((tree_class_check (((tree_check ((f1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1691, __FUNCTION__, (FUNCTION_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1691, __FUNCTION__))->type_non_common.lang_1), |
1692 | enum_and_int_p, different_types_p) != 1) |
1693 | val = 2; |
1694 | return val; |
1695 | } |
1696 | if (args2 == NULL_TREE(tree) __null) |
1697 | { |
1698 | if (!self_promoting_args_p (args1)) |
1699 | return 0; |
1700 | if (TYPE_ACTUAL_ARG_TYPES (f2)((tree_class_check (((tree_check ((f2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1700, __FUNCTION__, (FUNCTION_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1700, __FUNCTION__))->type_non_common.lang_1) |
1701 | && type_lists_compatible_p (args1, TYPE_ACTUAL_ARG_TYPES (f2)((tree_class_check (((tree_check ((f2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1701, __FUNCTION__, (FUNCTION_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1701, __FUNCTION__))->type_non_common.lang_1), |
1702 | enum_and_int_p, different_types_p) != 1) |
1703 | val = 2; |
1704 | return val; |
1705 | } |
1706 | |
1707 | /* Both types have argument lists: compare them and propagate results. */ |
1708 | val1 = type_lists_compatible_p (args1, args2, enum_and_int_p, |
1709 | different_types_p); |
1710 | return val1 != 1 ? val1 : val; |
1711 | } |
1712 | |
1713 | /* Check two lists of types for compatibility, returning 0 for |
1714 | incompatible, 1 for compatible, or 2 for compatible with |
1715 | warning. ENUM_AND_INT_P and DIFFERENT_TYPES_P are as in |
1716 | comptypes_internal. */ |
1717 | |
1718 | static int |
1719 | type_lists_compatible_p (const_tree args1, const_tree args2, |
1720 | bool *enum_and_int_p, bool *different_types_p) |
1721 | { |
1722 | /* 1 if no need for warning yet, 2 if warning cause has been seen. */ |
1723 | int val = 1; |
1724 | int newval = 0; |
1725 | |
1726 | while (1) |
1727 | { |
1728 | tree a1, mv1, a2, mv2; |
1729 | if (args1 == NULL_TREE(tree) __null && args2 == NULL_TREE(tree) __null) |
1730 | return val; |
1731 | /* If one list is shorter than the other, |
1732 | they fail to match. */ |
1733 | if (args1 == NULL_TREE(tree) __null || args2 == NULL_TREE(tree) __null) |
1734 | return 0; |
1735 | mv1 = a1 = TREE_VALUE (args1)((tree_check ((args1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1735, __FUNCTION__, (TREE_LIST)))->list.value); |
1736 | mv2 = a2 = TREE_VALUE (args2)((tree_check ((args2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1736, __FUNCTION__, (TREE_LIST)))->list.value); |
1737 | if (mv1 && mv1 != error_mark_nodeglobal_trees[TI_ERROR_MARK] && TREE_CODE (mv1)((enum tree_code) (mv1)->base.code) != ARRAY_TYPE) |
1738 | mv1 = (TYPE_ATOMIC (mv1)((tree_class_check ((mv1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1738, __FUNCTION__))->base.u.bits.atomic_flag) |
1739 | ? c_build_qualified_type (TYPE_MAIN_VARIANT (mv1)((tree_class_check ((mv1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1739, __FUNCTION__))->type_common.main_variant), |
1740 | TYPE_QUAL_ATOMIC) |
1741 | : TYPE_MAIN_VARIANT (mv1)((tree_class_check ((mv1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1741, __FUNCTION__))->type_common.main_variant)); |
1742 | if (mv2 && mv2 != error_mark_nodeglobal_trees[TI_ERROR_MARK] && TREE_CODE (mv2)((enum tree_code) (mv2)->base.code) != ARRAY_TYPE) |
1743 | mv2 = (TYPE_ATOMIC (mv2)((tree_class_check ((mv2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1743, __FUNCTION__))->base.u.bits.atomic_flag) |
1744 | ? c_build_qualified_type (TYPE_MAIN_VARIANT (mv2)((tree_class_check ((mv2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1744, __FUNCTION__))->type_common.main_variant), |
1745 | TYPE_QUAL_ATOMIC) |
1746 | : TYPE_MAIN_VARIANT (mv2)((tree_class_check ((mv2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1746, __FUNCTION__))->type_common.main_variant)); |
1747 | /* A null pointer instead of a type |
1748 | means there is supposed to be an argument |
1749 | but nothing is specified about what type it has. |
1750 | So match anything that self-promotes. */ |
1751 | if (different_types_p != NULL__null |
1752 | && (a1 == NULL_TREE(tree) __null) != (a2 == NULL_TREE(tree) __null)) |
1753 | *different_types_p = true; |
1754 | if (a1 == NULL_TREE(tree) __null) |
1755 | { |
1756 | if (c_type_promotes_to (a2) != a2) |
1757 | return 0; |
1758 | } |
1759 | else if (a2 == NULL_TREE(tree) __null) |
1760 | { |
1761 | if (c_type_promotes_to (a1) != a1) |
1762 | return 0; |
1763 | } |
1764 | /* If one of the lists has an error marker, ignore this arg. */ |
1765 | else if (TREE_CODE (a1)((enum tree_code) (a1)->base.code) == ERROR_MARK |
1766 | || TREE_CODE (a2)((enum tree_code) (a2)->base.code) == ERROR_MARK) |
1767 | ; |
1768 | else if (!(newval = comptypes_internal (mv1, mv2, enum_and_int_p, |
1769 | different_types_p))) |
1770 | { |
1771 | if (different_types_p != NULL__null) |
1772 | *different_types_p = true; |
1773 | /* Allow wait (union {union wait *u; int *i} *) |
1774 | and wait (union wait *) to be compatible. */ |
1775 | if (TREE_CODE (a1)((enum tree_code) (a1)->base.code) == UNION_TYPE |
1776 | && (TYPE_NAME (a1)((tree_class_check ((a1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1776, __FUNCTION__))->type_common.name) == NULL_TREE(tree) __null |
1777 | || TYPE_TRANSPARENT_AGGR (a1)((tree_check3 ((a1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1777, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_common.transparent_aggr_flag)) |
1778 | && TREE_CODE (TYPE_SIZE (a1))((enum tree_code) (((tree_class_check ((a1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1778, __FUNCTION__))->type_common.size))->base.code) == INTEGER_CST |
1779 | && tree_int_cst_equal (TYPE_SIZE (a1)((tree_class_check ((a1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1779, __FUNCTION__))->type_common.size), |
1780 | TYPE_SIZE (a2)((tree_class_check ((a2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1780, __FUNCTION__))->type_common.size))) |
1781 | { |
1782 | tree memb; |
1783 | for (memb = TYPE_FIELDS (a1)((tree_check3 ((a1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1783, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); |
1784 | memb; memb = DECL_CHAIN (memb)(((contains_struct_check (((contains_struct_check ((memb), (TS_DECL_MINIMAL ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1784, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1784, __FUNCTION__))->common.chain))) |
1785 | { |
1786 | tree mv3 = TREE_TYPE (memb)((contains_struct_check ((memb), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1786, __FUNCTION__))->typed.type); |
1787 | if (mv3 && mv3 != error_mark_nodeglobal_trees[TI_ERROR_MARK] |
1788 | && TREE_CODE (mv3)((enum tree_code) (mv3)->base.code) != ARRAY_TYPE) |
1789 | mv3 = (TYPE_ATOMIC (mv3)((tree_class_check ((mv3), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1789, __FUNCTION__))->base.u.bits.atomic_flag) |
1790 | ? c_build_qualified_type (TYPE_MAIN_VARIANT (mv3)((tree_class_check ((mv3), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1790, __FUNCTION__))->type_common.main_variant), |
1791 | TYPE_QUAL_ATOMIC) |
1792 | : TYPE_MAIN_VARIANT (mv3)((tree_class_check ((mv3), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1792, __FUNCTION__))->type_common.main_variant)); |
1793 | if (comptypes_internal (mv3, mv2, enum_and_int_p, |
1794 | different_types_p)) |
1795 | break; |
1796 | } |
1797 | if (memb == NULL_TREE(tree) __null) |
1798 | return 0; |
1799 | } |
1800 | else if (TREE_CODE (a2)((enum tree_code) (a2)->base.code) == UNION_TYPE |
1801 | && (TYPE_NAME (a2)((tree_class_check ((a2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1801, __FUNCTION__))->type_common.name) == NULL_TREE(tree) __null |
1802 | || TYPE_TRANSPARENT_AGGR (a2)((tree_check3 ((a2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1802, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_common.transparent_aggr_flag)) |
1803 | && TREE_CODE (TYPE_SIZE (a2))((enum tree_code) (((tree_class_check ((a2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1803, __FUNCTION__))->type_common.size))->base.code) == INTEGER_CST |
1804 | && tree_int_cst_equal (TYPE_SIZE (a2)((tree_class_check ((a2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1804, __FUNCTION__))->type_common.size), |
1805 | TYPE_SIZE (a1)((tree_class_check ((a1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1805, __FUNCTION__))->type_common.size))) |
1806 | { |
1807 | tree memb; |
1808 | for (memb = TYPE_FIELDS (a2)((tree_check3 ((a2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1808, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); |
1809 | memb; memb = DECL_CHAIN (memb)(((contains_struct_check (((contains_struct_check ((memb), (TS_DECL_MINIMAL ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1809, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1809, __FUNCTION__))->common.chain))) |
1810 | { |
1811 | tree mv3 = TREE_TYPE (memb)((contains_struct_check ((memb), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1811, __FUNCTION__))->typed.type); |
1812 | if (mv3 && mv3 != error_mark_nodeglobal_trees[TI_ERROR_MARK] |
1813 | && TREE_CODE (mv3)((enum tree_code) (mv3)->base.code) != ARRAY_TYPE) |
1814 | mv3 = (TYPE_ATOMIC (mv3)((tree_class_check ((mv3), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1814, __FUNCTION__))->base.u.bits.atomic_flag) |
1815 | ? c_build_qualified_type (TYPE_MAIN_VARIANT (mv3)((tree_class_check ((mv3), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1815, __FUNCTION__))->type_common.main_variant), |
1816 | TYPE_QUAL_ATOMIC) |
1817 | : TYPE_MAIN_VARIANT (mv3)((tree_class_check ((mv3), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1817, __FUNCTION__))->type_common.main_variant)); |
1818 | if (comptypes_internal (mv3, mv1, enum_and_int_p, |
1819 | different_types_p)) |
1820 | break; |
1821 | } |
1822 | if (memb == NULL_TREE(tree) __null) |
1823 | return 0; |
1824 | } |
1825 | else |
1826 | return 0; |
1827 | } |
1828 | |
1829 | /* comptypes said ok, but record if it said to warn. */ |
1830 | if (newval > val) |
1831 | val = newval; |
1832 | |
1833 | args1 = TREE_CHAIN (args1)((contains_struct_check ((args1), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1833, __FUNCTION__))->common.chain); |
1834 | args2 = TREE_CHAIN (args2)((contains_struct_check ((args2), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1834, __FUNCTION__))->common.chain); |
1835 | } |
1836 | } |
1837 | |
1838 | /* Compute the size to increment a pointer by. When a function type or void |
1839 | type or incomplete type is passed, size_one_node is returned. |
1840 | This function does not emit any diagnostics; the caller is responsible |
1841 | for that. */ |
1842 | |
1843 | static tree |
1844 | c_size_in_bytes (const_tree type) |
1845 | { |
1846 | enum tree_code code = TREE_CODE (type)((enum tree_code) (type)->base.code); |
1847 | |
1848 | if (code == FUNCTION_TYPE || code == VOID_TYPE || code == ERROR_MARK |
1849 | || !COMPLETE_TYPE_P (type)(((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1849, __FUNCTION__))->type_common.size) != (tree) __null )) |
1850 | return size_one_nodeglobal_trees[TI_SIZE_ONE]; |
1851 | |
1852 | /* Convert in case a char is more than one unit. */ |
1853 | return size_binop_loc (input_location, CEIL_DIV_EXPR, TYPE_SIZE_UNIT (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1853, __FUNCTION__))->type_common.size_unit), |
1854 | size_int (TYPE_PRECISION (char_type_node)size_int_kind (((tree_class_check ((integer_types[itk_char]), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1854, __FUNCTION__))->type_common.precision) / (8), stk_sizetype ) |
1855 | / BITS_PER_UNIT)size_int_kind (((tree_class_check ((integer_types[itk_char]), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1854, __FUNCTION__))->type_common.precision) / (8), stk_sizetype )); |
1856 | } |
1857 | |
1858 | /* Return either DECL or its known constant value (if it has one). */ |
1859 | |
1860 | tree |
1861 | decl_constant_value_1 (tree decl, bool in_init) |
1862 | { |
1863 | if (/* Note that DECL_INITIAL isn't valid for a PARM_DECL. */ |
1864 | TREE_CODE (decl)((enum tree_code) (decl)->base.code) != PARM_DECL |
1865 | && !TREE_THIS_VOLATILE (decl)((decl)->base.volatile_flag) |
1866 | && TREE_READONLY (decl)((non_type_check ((decl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1866, __FUNCTION__))->base.readonly_flag) |
1867 | && DECL_INITIAL (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1867, __FUNCTION__))->decl_common.initial) != NULL_TREE(tree) __null |
1868 | && !error_operand_p (DECL_INITIAL (decl))((((contains_struct_check ((decl), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1868, __FUNCTION__))->decl_common.initial)) == global_trees [TI_ERROR_MARK] || ((((contains_struct_check ((decl), (TS_DECL_COMMON ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1868, __FUNCTION__))->decl_common.initial)) && ( (contains_struct_check (((((contains_struct_check ((decl), (TS_DECL_COMMON ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1868, __FUNCTION__))->decl_common.initial))), (TS_TYPED) , "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1868, __FUNCTION__))->typed.type) == global_trees[TI_ERROR_MARK ])) |
1869 | /* This is invalid if initial value is not constant. |
1870 | If it has either a function call, a memory reference, |
1871 | or a variable, then re-evaluating it could give different results. */ |
1872 | && TREE_CONSTANT (DECL_INITIAL (decl))((non_type_check ((((contains_struct_check ((decl), (TS_DECL_COMMON ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1872, __FUNCTION__))->decl_common.initial)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1872, __FUNCTION__))->base.constant_flag) |
1873 | /* Check for cases where this is sub-optimal, even though valid. */ |
1874 | && (in_init || TREE_CODE (DECL_INITIAL (decl))((enum tree_code) (((contains_struct_check ((decl), (TS_DECL_COMMON ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1874, __FUNCTION__))->decl_common.initial))->base.code ) != CONSTRUCTOR)) |
1875 | return DECL_INITIAL (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1875, __FUNCTION__))->decl_common.initial); |
1876 | return decl; |
1877 | } |
1878 | |
1879 | /* Return either DECL or its known constant value (if it has one). |
1880 | Like the above, but always return decl outside of functions. */ |
1881 | |
1882 | tree |
1883 | decl_constant_value (tree decl) |
1884 | { |
1885 | /* Don't change a variable array bound or initial value to a constant |
1886 | in a place where a variable is invalid. */ |
1887 | return current_function_decl ? decl_constant_value_1 (decl, false) : decl; |
1888 | } |
1889 | |
1890 | /* Convert the array expression EXP to a pointer. */ |
1891 | static tree |
1892 | array_to_pointer_conversion (location_t loc, tree exp) |
1893 | { |
1894 | tree orig_exp = exp; |
1895 | tree type = TREE_TYPE (exp)((contains_struct_check ((exp), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1895, __FUNCTION__))->typed.type); |
1896 | tree adr; |
1897 | tree restype = TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1897, __FUNCTION__))->typed.type); |
1898 | tree ptrtype; |
1899 | |
1900 | gcc_assert (TREE_CODE (type) == ARRAY_TYPE)((void)(!(((enum tree_code) (type)->base.code) == ARRAY_TYPE ) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1900, __FUNCTION__), 0 : 0)); |
1901 | |
1902 | 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), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1902, __FUNCTION__))))) != global_trees[TI_ERROR_MARK] && (((contains_struct_check ((exp), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1902, __FUNCTION__))->typed.type) == ((contains_struct_check (((*((const_cast<tree*> (tree_operand_check ((exp), (0 ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1902, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1902, __FUNCTION__))->typed.type))) (exp) = (*((const_cast <tree*> (tree_operand_check ((exp), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1902, __FUNCTION__))))); |
1903 | |
1904 | if (TREE_NO_WARNING (orig_exp)((orig_exp)->base.nowarning_flag)) |
1905 | TREE_NO_WARNING (exp)((exp)->base.nowarning_flag) = 1; |
1906 | |
1907 | ptrtype = build_pointer_type (restype); |
1908 | |
1909 | if (INDIRECT_REF_P (exp)(((enum tree_code) (exp)->base.code) == INDIRECT_REF)) |
1910 | return convert (ptrtype, TREE_OPERAND (exp, 0)(*((const_cast<tree*> (tree_operand_check ((exp), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1910, __FUNCTION__)))))); |
1911 | |
1912 | /* In C++ array compound literals are temporary objects unless they are |
1913 | const or appear in namespace scope, so they are destroyed too soon |
1914 | to use them for much of anything (c++/53220). */ |
1915 | if (warn_cxx_compatglobal_options.x_warn_cxx_compat && TREE_CODE (exp)((enum tree_code) (exp)->base.code) == COMPOUND_LITERAL_EXPR) |
1916 | { |
1917 | tree decl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0)(*((const_cast<tree*> (tree_operand_check (((*((const_cast <tree*> (tree_operand_check ((exp), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1917, __FUNCTION__)))))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1917, __FUNCTION__))))); |
1918 | if (!TREE_READONLY (decl)((non_type_check ((decl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1918, __FUNCTION__))->base.readonly_flag) && !TREE_STATIC (decl)((decl)->base.static_flag)) |
1919 | warning_at (DECL_SOURCE_LOCATION (decl)((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1919, __FUNCTION__))->decl_minimal.locus), OPT_Wc___compat, |
1920 | "converting an array compound literal to a pointer " |
1921 | "is ill-formed in C++"); |
1922 | } |
1923 | |
1924 | adr = build_unary_op (loc, ADDR_EXPR, exp, true); |
1925 | return convert (ptrtype, adr); |
1926 | } |
1927 | |
1928 | /* Convert the function expression EXP to a pointer. */ |
1929 | static tree |
1930 | function_to_pointer_conversion (location_t loc, tree exp) |
1931 | { |
1932 | tree orig_exp = exp; |
1933 | |
1934 | gcc_assert (TREE_CODE (TREE_TYPE (exp)) == FUNCTION_TYPE)((void)(!(((enum tree_code) (((contains_struct_check ((exp), ( TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1934, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE ) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1934, __FUNCTION__), 0 : 0)); |
1935 | |
1936 | 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), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1936, __FUNCTION__))))) != global_trees[TI_ERROR_MARK] && (((contains_struct_check ((exp), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1936, __FUNCTION__))->typed.type) == ((contains_struct_check (((*((const_cast<tree*> (tree_operand_check ((exp), (0 ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1936, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1936, __FUNCTION__))->typed.type))) (exp) = (*((const_cast <tree*> (tree_operand_check ((exp), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1936, __FUNCTION__))))); |
1937 | |
1938 | if (TREE_NO_WARNING (orig_exp)((orig_exp)->base.nowarning_flag)) |
1939 | TREE_NO_WARNING (exp)((exp)->base.nowarning_flag) = 1; |
1940 | |
1941 | return build_unary_op (loc, ADDR_EXPR, exp, false); |
1942 | } |
1943 | |
1944 | /* Mark EXP as read, not just set, for set but not used -Wunused |
1945 | warning purposes. */ |
1946 | |
1947 | void |
1948 | mark_exp_read (tree exp) |
1949 | { |
1950 | switch (TREE_CODE (exp)((enum tree_code) (exp)->base.code)) |
1951 | { |
1952 | case VAR_DECL: |
1953 | case PARM_DECL: |
1954 | DECL_READ_P (exp)((tree_check2 ((exp), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1954, __FUNCTION__, (VAR_DECL), (PARM_DECL)))->decl_common .decl_read_flag) = 1; |
1955 | break; |
1956 | case ARRAY_REF: |
1957 | case COMPONENT_REF: |
1958 | case MODIFY_EXPR: |
1959 | case REALPART_EXPR: |
1960 | case IMAGPART_EXPR: |
1961 | CASE_CONVERTcase NOP_EXPR: case CONVERT_EXPR: |
1962 | case ADDR_EXPR: |
1963 | case VIEW_CONVERT_EXPR: |
1964 | mark_exp_read (TREE_OPERAND (exp, 0)(*((const_cast<tree*> (tree_operand_check ((exp), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1964, __FUNCTION__)))))); |
1965 | break; |
1966 | case COMPOUND_EXPR: |
1967 | case C_MAYBE_CONST_EXPR: |
1968 | mark_exp_read (TREE_OPERAND (exp, 1)(*((const_cast<tree*> (tree_operand_check ((exp), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1968, __FUNCTION__)))))); |
1969 | break; |
1970 | default: |
1971 | break; |
1972 | } |
1973 | } |
1974 | |
1975 | /* Perform the default conversion of arrays and functions to pointers. |
1976 | Return the result of converting EXP. For any other expression, just |
1977 | return EXP. |
1978 | |
1979 | LOC is the location of the expression. */ |
1980 | |
1981 | struct c_expr |
1982 | default_function_array_conversion (location_t loc, struct c_expr exp) |
1983 | { |
1984 | tree orig_exp = exp.value; |
1985 | tree type = TREE_TYPE (exp.value)((contains_struct_check ((exp.value), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1985, __FUNCTION__))->typed.type); |
1986 | enum tree_code code = TREE_CODE (type)((enum tree_code) (type)->base.code); |
1987 | |
1988 | switch (code) |
1989 | { |
1990 | case ARRAY_TYPE: |
1991 | { |
1992 | bool not_lvalue = false; |
1993 | bool lvalue_array_p; |
1994 | |
1995 | while ((TREE_CODE (exp.value)((enum tree_code) (exp.value)->base.code) == NON_LVALUE_EXPR |
1996 | || CONVERT_EXPR_P (exp.value)((((enum tree_code) (exp.value)->base.code)) == NOP_EXPR || (((enum tree_code) (exp.value)->base.code)) == CONVERT_EXPR )) |
1997 | && TREE_TYPE (TREE_OPERAND (exp.value, 0))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check ((exp.value), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1997, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 1997, __FUNCTION__))->typed.type) == type) |
1998 | { |
1999 | if (TREE_CODE (exp.value)((enum tree_code) (exp.value)->base.code) == NON_LVALUE_EXPR) |
2000 | not_lvalue = true; |
2001 | exp.value = TREE_OPERAND (exp.value, 0)(*((const_cast<tree*> (tree_operand_check ((exp.value), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2001, __FUNCTION__))))); |
2002 | } |
2003 | |
2004 | if (TREE_NO_WARNING (orig_exp)((orig_exp)->base.nowarning_flag)) |
2005 | TREE_NO_WARNING (exp.value)((exp.value)->base.nowarning_flag) = 1; |
2006 | |
2007 | lvalue_array_p = !not_lvalue && lvalue_p (exp.value); |
2008 | if (!flag_isoc99 && !lvalue_array_p) |
2009 | { |
2010 | /* Before C99, non-lvalue arrays do not decay to pointers. |
2011 | Normally, using such an array would be invalid; but it can |
2012 | be used correctly inside sizeof or as a statement expression. |
2013 | Thus, do not give an error here; an error will result later. */ |
2014 | return exp; |
2015 | } |
2016 | |
2017 | exp.value = array_to_pointer_conversion (loc, exp.value); |
2018 | } |
2019 | break; |
2020 | case FUNCTION_TYPE: |
2021 | exp.value = function_to_pointer_conversion (loc, exp.value); |
2022 | break; |
2023 | default: |
2024 | break; |
2025 | } |
2026 | |
2027 | return exp; |
2028 | } |
2029 | |
2030 | struct c_expr |
2031 | default_function_array_read_conversion (location_t loc, struct c_expr exp) |
2032 | { |
2033 | mark_exp_read (exp.value); |
2034 | return default_function_array_conversion (loc, exp); |
2035 | } |
2036 | |
2037 | /* Return whether EXPR should be treated as an atomic lvalue for the |
2038 | purposes of load and store handling. */ |
2039 | |
2040 | static bool |
2041 | really_atomic_lvalue (tree expr) |
2042 | { |
2043 | if (error_operand_p (expr)((expr) == global_trees[TI_ERROR_MARK] || ((expr) && ( (contains_struct_check (((expr)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2043, __FUNCTION__))->typed.type) == global_trees[TI_ERROR_MARK ]))) |
2044 | return false; |
2045 | if (!TYPE_ATOMIC (TREE_TYPE (expr))((tree_class_check ((((contains_struct_check ((expr), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2045, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2045, __FUNCTION__))->base.u.bits.atomic_flag)) |
2046 | return false; |
2047 | if (!lvalue_p (expr)) |
2048 | return false; |
2049 | |
2050 | /* Ignore _Atomic on register variables, since their addresses can't |
2051 | be taken so (a) atomicity is irrelevant and (b) the normal atomic |
2052 | sequences wouldn't work. Ignore _Atomic on structures containing |
2053 | bit-fields, since accessing elements of atomic structures or |
2054 | unions is undefined behavior (C11 6.5.2.3#5), but it's unclear if |
2055 | it's undefined at translation time or execution time, and the |
2056 | normal atomic sequences again wouldn't work. */ |
2057 | while (handled_component_p (expr)) |
2058 | { |
2059 | if (TREE_CODE (expr)((enum tree_code) (expr)->base.code) == COMPONENT_REF |
2060 | && DECL_C_BIT_FIELD (TREE_OPERAND (expr, 1))(((contains_struct_check (((tree_check (((*((const_cast<tree *> (tree_operand_check ((expr), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2060, __FUNCTION__)))))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2060, __FUNCTION__, (FIELD_DECL)))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2060, __FUNCTION__))->decl_common.lang_flag_4) == 1)) |
2061 | return false; |
2062 | expr = TREE_OPERAND (expr, 0)(*((const_cast<tree*> (tree_operand_check ((expr), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2062, __FUNCTION__))))); |
2063 | } |
2064 | if (DECL_P (expr)(tree_code_type[(int) (((enum tree_code) (expr)->base.code ))] == tcc_declaration) && C_DECL_REGISTER (expr)((contains_struct_check ((expr), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2064, __FUNCTION__))->decl_common.lang_flag_4)) |
2065 | return false; |
2066 | return true; |
2067 | } |
2068 | |
2069 | /* Convert expression EXP (location LOC) from lvalue to rvalue, |
2070 | including converting functions and arrays to pointers if CONVERT_P. |
2071 | If READ_P, also mark the expression as having been read. */ |
2072 | |
2073 | struct c_expr |
2074 | convert_lvalue_to_rvalue (location_t loc, struct c_expr exp, |
2075 | bool convert_p, bool read_p) |
2076 | { |
2077 | if (read_p) |
2078 | mark_exp_read (exp.value); |
2079 | if (convert_p) |
2080 | exp = default_function_array_conversion (loc, exp); |
2081 | if (!VOID_TYPE_P (TREE_TYPE (exp.value))(((enum tree_code) (((contains_struct_check ((exp.value), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2081, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE )) |
2082 | exp.value = require_complete_type (loc, exp.value); |
2083 | if (really_atomic_lvalue (exp.value)) |
2084 | { |
2085 | vec<tree, va_gc> *params; |
2086 | tree nonatomic_type, tmp, tmp_addr, fndecl, func_call; |
2087 | tree expr_type = TREE_TYPE (exp.value)((contains_struct_check ((exp.value), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2087, __FUNCTION__))->typed.type); |
2088 | tree expr_addr = build_unary_op (loc, ADDR_EXPR, exp.value, false); |
2089 | tree seq_cst = build_int_cst (integer_type_nodeinteger_types[itk_int], MEMMODEL_SEQ_CST); |
2090 | |
2091 | gcc_assert (TYPE_ATOMIC (expr_type))((void)(!(((tree_class_check ((expr_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2091, __FUNCTION__))->base.u.bits.atomic_flag)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2091, __FUNCTION__), 0 : 0)); |
2092 | |
2093 | /* Expansion of a generic atomic load may require an addition |
2094 | element, so allocate enough to prevent a resize. */ |
2095 | vec_alloc (params, 4); |
2096 | |
2097 | /* Remove the qualifiers for the rest of the expressions and |
2098 | create the VAL temp variable to hold the RHS. */ |
2099 | nonatomic_type = build_qualified_type (expr_type, TYPE_UNQUALIFIED); |
2100 | tmp = create_tmp_var_raw (nonatomic_type); |
2101 | tmp_addr = build_unary_op (loc, ADDR_EXPR, tmp, false); |
2102 | TREE_ADDRESSABLE (tmp)((tmp)->base.addressable_flag) = 1; |
2103 | TREE_NO_WARNING (tmp)((tmp)->base.nowarning_flag) = 1; |
2104 | |
2105 | /* Issue __atomic_load (&expr, &tmp, SEQ_CST); */ |
2106 | fndecl = builtin_decl_explicit (BUILT_IN_ATOMIC_LOAD); |
2107 | params->quick_push (expr_addr); |
2108 | params->quick_push (tmp_addr); |
2109 | params->quick_push (seq_cst); |
2110 | func_call = c_build_function_call_vec (loc, vNULL, fndecl, params, NULL__null); |
2111 | |
2112 | /* EXPR is always read. */ |
2113 | mark_exp_read (exp.value); |
2114 | |
2115 | /* Return tmp which contains the value loaded. */ |
2116 | exp.value = build4 (TARGET_EXPR, nonatomic_type, tmp, func_call, |
2117 | NULL_TREE(tree) __null, NULL_TREE(tree) __null); |
2118 | } |
2119 | if (convert_p && !error_operand_p (exp.value)((exp.value) == global_trees[TI_ERROR_MARK] || ((exp.value) && ((contains_struct_check (((exp.value)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2119, __FUNCTION__))->typed.type) == global_trees[TI_ERROR_MARK ])) |
2120 | && (TREE_CODE (TREE_TYPE (exp.value))((enum tree_code) (((contains_struct_check ((exp.value), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2120, __FUNCTION__))->typed.type))->base.code) != ARRAY_TYPE)) |
2121 | exp.value = convert (build_qualified_type (TREE_TYPE (exp.value)((contains_struct_check ((exp.value), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2121, __FUNCTION__))->typed.type), TYPE_UNQUALIFIED), exp.value); |
2122 | return exp; |
2123 | } |
2124 | |
2125 | /* EXP is an expression of integer type. Apply the integer promotions |
2126 | to it and return the promoted value. */ |
2127 | |
2128 | tree |
2129 | perform_integral_promotions (tree exp) |
2130 | { |
2131 | tree type = TREE_TYPE (exp)((contains_struct_check ((exp), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2131, __FUNCTION__))->typed.type); |
2132 | enum tree_code code = TREE_CODE (type)((enum tree_code) (type)->base.code); |
2133 | |
2134 | 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 ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2134, __FUNCTION__), 0 : 0)); |
2135 | |
2136 | /* Normally convert enums to int, |
2137 | but convert wide enums to something wider. */ |
2138 | if (code == ENUMERAL_TYPE) |
2139 | { |
2140 | type = c_common_type_for_size (MAX (TYPE_PRECISION (type),((((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2140, __FUNCTION__))->type_common.precision)) > (((tree_class_check ((integer_types[itk_int]), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2141, __FUNCTION__))->type_common.precision)) ? (((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2140, __FUNCTION__))->type_common.precision)) : (((tree_class_check ((integer_types[itk_int]), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2141, __FUNCTION__))->type_common.precision))) |
2141 | TYPE_PRECISION (integer_type_node))((((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2140, __FUNCTION__))->type_common.precision)) > (((tree_class_check ((integer_types[itk_int]), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2141, __FUNCTION__))->type_common.precision)) ? (((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2140, __FUNCTION__))->type_common.precision)) : (((tree_class_check ((integer_types[itk_int]), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2141, __FUNCTION__))->type_common.precision))), |
2142 | ((TYPE_PRECISION (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2142, __FUNCTION__))->type_common.precision) |
2143 | >= TYPE_PRECISION (integer_type_node)((tree_class_check ((integer_types[itk_int]), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2143, __FUNCTION__))->type_common.precision)) |
2144 | && TYPE_UNSIGNED (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2144, __FUNCTION__))->base.u.bits.unsigned_flag))); |
2145 | |
2146 | return convert (type, exp); |
2147 | } |
2148 | |
2149 | /* ??? This should no longer be needed now bit-fields have their |
2150 | proper types. */ |
2151 | if (TREE_CODE (exp)((enum tree_code) (exp)->base.code) == COMPONENT_REF |
2152 | && DECL_C_BIT_FIELD (TREE_OPERAND (exp, 1))(((contains_struct_check (((tree_check (((*((const_cast<tree *> (tree_operand_check ((exp), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2152, __FUNCTION__)))))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2152, __FUNCTION__, (FIELD_DECL)))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2152, __FUNCTION__))->decl_common.lang_flag_4) == 1) |
2153 | /* If it's thinner than an int, promote it like a |
2154 | c_promoting_integer_type_p, otherwise leave it alone. */ |
2155 | && compare_tree_int (DECL_SIZE (TREE_OPERAND (exp, 1))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check ((exp), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2155, __FUNCTION__)))))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2155, __FUNCTION__))->decl_common.size), |
2156 | TYPE_PRECISION (integer_type_node)((tree_class_check ((integer_types[itk_int]), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2156, __FUNCTION__))->type_common.precision)) < 0) |
2157 | return convert (integer_type_nodeinteger_types[itk_int], exp); |
2158 | |
2159 | if (c_promoting_integer_type_p (type)) |
2160 | { |
2161 | /* Preserve unsignedness if not really getting any wider. */ |
2162 | if (TYPE_UNSIGNED (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2162, __FUNCTION__))->base.u.bits.unsigned_flag) |
2163 | && TYPE_PRECISION (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2163, __FUNCTION__))->type_common.precision) == TYPE_PRECISION (integer_type_node)((tree_class_check ((integer_types[itk_int]), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2163, __FUNCTION__))->type_common.precision)) |
2164 | return convert (unsigned_type_nodeinteger_types[itk_unsigned_int], exp); |
2165 | |
2166 | return convert (integer_type_nodeinteger_types[itk_int], exp); |
2167 | } |
2168 | |
2169 | return exp; |
2170 | } |
2171 | |
2172 | |
2173 | /* Perform default promotions for C data used in expressions. |
2174 | Enumeral types or short or char are converted to int. |
2175 | In addition, manifest constants symbols are replaced by their values. */ |
2176 | |
2177 | tree |
2178 | default_conversion (tree exp) |
2179 | { |
2180 | tree orig_exp; |
2181 | tree type = TREE_TYPE (exp)((contains_struct_check ((exp), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2181, __FUNCTION__))->typed.type); |
2182 | enum tree_code code = TREE_CODE (type)((enum tree_code) (type)->base.code); |
2183 | tree promoted_type; |
2184 | |
2185 | mark_exp_read (exp); |
2186 | |
2187 | /* Functions and arrays have been converted during parsing. */ |
2188 | gcc_assert (code != FUNCTION_TYPE)((void)(!(code != FUNCTION_TYPE) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2188, __FUNCTION__), 0 : 0)); |
2189 | if (code == ARRAY_TYPE) |
2190 | return exp; |
2191 | |
2192 | /* Constants can be used directly unless they're not loadable. */ |
2193 | if (TREE_CODE (exp)((enum tree_code) (exp)->base.code) == CONST_DECL) |
2194 | exp = DECL_INITIAL (exp)((contains_struct_check ((exp), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2194, __FUNCTION__))->decl_common.initial); |
2195 | |
2196 | /* Strip no-op conversions. */ |
2197 | orig_exp = exp; |
2198 | 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), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2198, __FUNCTION__))))) != global_trees[TI_ERROR_MARK] && (((contains_struct_check ((exp), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2198, __FUNCTION__))->typed.type) == ((contains_struct_check (((*((const_cast<tree*> (tree_operand_check ((exp), (0 ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2198, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2198, __FUNCTION__))->typed.type))) (exp) = (*((const_cast <tree*> (tree_operand_check ((exp), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2198, __FUNCTION__))))); |
2199 | |
2200 | if (TREE_NO_WARNING (orig_exp)((orig_exp)->base.nowarning_flag)) |
2201 | TREE_NO_WARNING (exp)((exp)->base.nowarning_flag) = 1; |
2202 | |
2203 | if (code == VOID_TYPE) |
2204 | { |
2205 | error_at (EXPR_LOC_OR_LOC (exp, input_location)((((IS_ADHOC_LOC (((((exp)) && ((tree_code_type[(int) (((enum tree_code) ((exp))->base.code))]) >= tcc_reference && (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[(int) (((enum tree_code ) ((exp))->base.code))]) >= tcc_reference && (tree_code_type [(int) (((enum tree_code) ((exp))->base.code))]) <= tcc_expression )) ? (exp)->exp.locus : ((location_t) 0))) : (((((exp)) && ((tree_code_type[(int) (((enum tree_code) ((exp))->base.code ))]) >= tcc_reference && (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)), |
2206 | "void value not ignored as it ought to be"); |
2207 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
2208 | } |
2209 | |
2210 | exp = require_complete_type (EXPR_LOC_OR_LOC (exp, input_location)((((IS_ADHOC_LOC (((((exp)) && ((tree_code_type[(int) (((enum tree_code) ((exp))->base.code))]) >= tcc_reference && (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[(int) (((enum tree_code ) ((exp))->base.code))]) >= tcc_reference && (tree_code_type [(int) (((enum tree_code) ((exp))->base.code))]) <= tcc_expression )) ? (exp)->exp.locus : ((location_t) 0))) : (((((exp)) && ((tree_code_type[(int) (((enum tree_code) ((exp))->base.code ))]) >= tcc_reference && (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); |
2211 | if (exp == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
2212 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
2213 | |
2214 | promoted_type = targetm.promoted_type (type); |
2215 | if (promoted_type) |
2216 | return convert (promoted_type, exp); |
2217 | |
2218 | 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)) |
2219 | return perform_integral_promotions (exp); |
2220 | |
2221 | return exp; |
2222 | } |
2223 | |
2224 | /* Look up COMPONENT in a structure or union TYPE. |
2225 | |
2226 | If the component name is not found, returns NULL_TREE. Otherwise, |
2227 | the return value is a TREE_LIST, with each TREE_VALUE a FIELD_DECL |
2228 | stepping down the chain to the component, which is in the last |
2229 | TREE_VALUE of the list. Normally the list is of length one, but if |
2230 | the component is embedded within (nested) anonymous structures or |
2231 | unions, the list steps down the chain to the component. */ |
2232 | |
2233 | static tree |
2234 | lookup_field (tree type, tree component) |
2235 | { |
2236 | tree field; |
2237 | |
2238 | /* If TYPE_LANG_SPECIFIC is set, then it is a sorted array of pointers |
2239 | to the field elements. Use a binary search on this array to quickly |
2240 | find the element. Otherwise, do a linear search. TYPE_LANG_SPECIFIC |
2241 | will always be set for structures which have many elements. |
2242 | |
2243 | Duplicate field checking replaces duplicates with NULL_TREE so |
2244 | TYPE_LANG_SPECIFIC arrays are potentially no longer sorted. In that |
2245 | case just iterate using DECL_CHAIN. */ |
2246 | |
2247 | if (TYPE_LANG_SPECIFIC (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2247, __FUNCTION__))->type_with_lang_specific.lang_specific ) && TYPE_LANG_SPECIFIC (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2247, __FUNCTION__))->type_with_lang_specific.lang_specific )->s |
2248 | && !seen_error ()) |
2249 | { |
2250 | int bot, top, half; |
2251 | tree *field_array = &TYPE_LANG_SPECIFIC (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2251, __FUNCTION__))->type_with_lang_specific.lang_specific )->s->elts[0]; |
2252 | |
2253 | field = TYPE_FIELDS (type)((tree_check3 ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2253, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); |
2254 | bot = 0; |
2255 | top = TYPE_LANG_SPECIFIC (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2255, __FUNCTION__))->type_with_lang_specific.lang_specific )->s->len; |
2256 | while (top - bot > 1) |
2257 | { |
2258 | half = (top - bot + 1) >> 1; |
2259 | field = field_array[bot+half]; |
2260 | |
2261 | if (DECL_NAME (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2261, __FUNCTION__))->decl_minimal.name) == NULL_TREE(tree) __null) |
2262 | { |
2263 | /* Step through all anon unions in linear fashion. */ |
2264 | while (DECL_NAME (field_array[bot])((contains_struct_check ((field_array[bot]), (TS_DECL_MINIMAL ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2264, __FUNCTION__))->decl_minimal.name) == NULL_TREE(tree) __null) |
2265 | { |
2266 | field = field_array[bot++]; |
2267 | if (RECORD_OR_UNION_TYPE_P (TREE_TYPE (field))(((enum tree_code) (((contains_struct_check ((field), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2267, __FUNCTION__))->typed.type))->base.code) == RECORD_TYPE || ((enum tree_code) (((contains_struct_check ((field), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2267, __FUNCTION__))->typed.type))->base.code) == UNION_TYPE || ((enum tree_code) (((contains_struct_check ((field), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2267, __FUNCTION__))->typed.type))->base.code) == QUAL_UNION_TYPE )) |
2268 | { |
2269 | tree anon = lookup_field (TREE_TYPE (field)((contains_struct_check ((field), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2269, __FUNCTION__))->typed.type), component); |
2270 | |
2271 | if (anon) |
2272 | return tree_cons (NULL_TREE(tree) __null, field, anon); |
2273 | |
2274 | /* The Plan 9 compiler permits referring |
2275 | directly to an anonymous struct/union field |
2276 | using a typedef name. */ |
2277 | if (flag_plan9_extensionsglobal_options.x_flag_plan9_extensions |
2278 | && TYPE_NAME (TREE_TYPE (field))((tree_class_check ((((contains_struct_check ((field), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2278, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2278, __FUNCTION__))->type_common.name) != NULL_TREE(tree) __null |
2279 | && (TREE_CODE (TYPE_NAME (TREE_TYPE (field)))((enum tree_code) (((tree_class_check ((((contains_struct_check ((field), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2279, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2279, __FUNCTION__))->type_common.name))->base.code) |
2280 | == TYPE_DECL) |
2281 | && (DECL_NAME (TYPE_NAME (TREE_TYPE (field)))((contains_struct_check ((((tree_class_check ((((contains_struct_check ((field), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2281, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2281, __FUNCTION__))->type_common.name)), (TS_DECL_MINIMAL ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2281, __FUNCTION__))->decl_minimal.name) |
2282 | == component)) |
2283 | break; |
2284 | } |
2285 | } |
2286 | |
2287 | /* Entire record is only anon unions. */ |
2288 | if (bot > top) |
2289 | return NULL_TREE(tree) __null; |
2290 | |
2291 | /* Restart the binary search, with new lower bound. */ |
2292 | continue; |
2293 | } |
2294 | |
2295 | if (DECL_NAME (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2295, __FUNCTION__))->decl_minimal.name) == component) |
2296 | break; |
2297 | if (DECL_NAME (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2297, __FUNCTION__))->decl_minimal.name) < component) |
2298 | bot += half; |
2299 | else |
2300 | top = bot + half; |
2301 | } |
2302 | |
2303 | if (DECL_NAME (field_array[bot])((contains_struct_check ((field_array[bot]), (TS_DECL_MINIMAL ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2303, __FUNCTION__))->decl_minimal.name) == component) |
2304 | field = field_array[bot]; |
2305 | else if (DECL_NAME (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2305, __FUNCTION__))->decl_minimal.name) != component) |
2306 | return NULL_TREE(tree) __null; |
2307 | } |
2308 | else |
2309 | { |
2310 | for (field = TYPE_FIELDS (type)((tree_check3 ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2310, __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), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2310, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2310, __FUNCTION__))->common.chain))) |
2311 | { |
2312 | if (DECL_NAME (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2312, __FUNCTION__))->decl_minimal.name) == NULL_TREE(tree) __null |
2313 | && RECORD_OR_UNION_TYPE_P (TREE_TYPE (field))(((enum tree_code) (((contains_struct_check ((field), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2313, __FUNCTION__))->typed.type))->base.code) == RECORD_TYPE || ((enum tree_code) (((contains_struct_check ((field), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2313, __FUNCTION__))->typed.type))->base.code) == UNION_TYPE || ((enum tree_code) (((contains_struct_check ((field), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2313, __FUNCTION__))->typed.type))->base.code) == QUAL_UNION_TYPE )) |
2314 | { |
2315 | tree anon = lookup_field (TREE_TYPE (field)((contains_struct_check ((field), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2315, __FUNCTION__))->typed.type), component); |
2316 | |
2317 | if (anon) |
2318 | return tree_cons (NULL_TREE(tree) __null, field, anon); |
2319 | |
2320 | /* The Plan 9 compiler permits referring directly to an |
2321 | anonymous struct/union field using a typedef |
2322 | name. */ |
2323 | if (flag_plan9_extensionsglobal_options.x_flag_plan9_extensions |
2324 | && TYPE_NAME (TREE_TYPE (field))((tree_class_check ((((contains_struct_check ((field), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2324, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2324, __FUNCTION__))->type_common.name) != NULL_TREE(tree) __null |
2325 | && TREE_CODE (TYPE_NAME (TREE_TYPE (field)))((enum tree_code) (((tree_class_check ((((contains_struct_check ((field), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2325, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2325, __FUNCTION__))->type_common.name))->base.code) == TYPE_DECL |
2326 | && (DECL_NAME (TYPE_NAME (TREE_TYPE (field)))((contains_struct_check ((((tree_class_check ((((contains_struct_check ((field), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2326, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2326, __FUNCTION__))->type_common.name)), (TS_DECL_MINIMAL ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2326, __FUNCTION__))->decl_minimal.name) |
2327 | == component)) |
2328 | break; |
2329 | } |
2330 | |
2331 | if (DECL_NAME (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2331, __FUNCTION__))->decl_minimal.name) == component) |
2332 | break; |
2333 | } |
2334 | |
2335 | if (field == NULL_TREE(tree) __null) |
2336 | return NULL_TREE(tree) __null; |
2337 | } |
2338 | |
2339 | return tree_cons (NULL_TREE(tree) __null, field, NULL_TREE(tree) __null); |
2340 | } |
2341 | |
2342 | /* Recursively append candidate IDENTIFIER_NODEs to CANDIDATES. */ |
2343 | |
2344 | static void |
2345 | lookup_field_fuzzy_find_candidates (tree type, tree component, |
2346 | vec<tree> *candidates) |
2347 | { |
2348 | tree field; |
2349 | for (field = TYPE_FIELDS (type)((tree_check3 ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2349, __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), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2349, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2349, __FUNCTION__))->common.chain))) |
2350 | { |
2351 | if (DECL_NAME (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2351, __FUNCTION__))->decl_minimal.name) == NULL_TREE(tree) __null |
2352 | && RECORD_OR_UNION_TYPE_P (TREE_TYPE (field))(((enum tree_code) (((contains_struct_check ((field), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2352, __FUNCTION__))->typed.type))->base.code) == RECORD_TYPE || ((enum tree_code) (((contains_struct_check ((field), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2352, __FUNCTION__))->typed.type))->base.code) == UNION_TYPE || ((enum tree_code) (((contains_struct_check ((field), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2352, __FUNCTION__))->typed.type))->base.code) == QUAL_UNION_TYPE )) |
2353 | lookup_field_fuzzy_find_candidates (TREE_TYPE (field)((contains_struct_check ((field), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2353, __FUNCTION__))->typed.type), component, |
2354 | candidates); |
2355 | |
2356 | if (DECL_NAME (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2356, __FUNCTION__))->decl_minimal.name)) |
2357 | candidates->safe_push (DECL_NAME (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2357, __FUNCTION__))->decl_minimal.name)); |
2358 | } |
2359 | } |
2360 | |
2361 | /* Like "lookup_field", but find the closest matching IDENTIFIER_NODE, |
2362 | rather than returning a TREE_LIST for an exact match. */ |
2363 | |
2364 | static tree |
2365 | lookup_field_fuzzy (tree type, tree component) |
2366 | { |
2367 | gcc_assert (TREE_CODE (component) == IDENTIFIER_NODE)((void)(!(((enum tree_code) (component)->base.code) == IDENTIFIER_NODE ) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2367, __FUNCTION__), 0 : 0)); |
2368 | |
2369 | /* First, gather a list of candidates. */ |
2370 | auto_vec <tree> candidates; |
2371 | |
2372 | lookup_field_fuzzy_find_candidates (type, component, |
2373 | &candidates); |
2374 | |
2375 | return find_closest_identifier (component, &candidates); |
2376 | } |
2377 | |
2378 | /* Support function for build_component_ref's error-handling. |
2379 | |
2380 | Given DATUM_TYPE, and "DATUM.COMPONENT", where DATUM is *not* a |
2381 | struct or union, should we suggest "DATUM->COMPONENT" as a hint? */ |
2382 | |
2383 | static bool |
2384 | should_suggest_deref_p (tree datum_type) |
2385 | { |
2386 | /* We don't do it for Objective-C, since Objective-C 2.0 dot-syntax |
2387 | allows "." for ptrs; we could be handling a failed attempt |
2388 | to access a property. */ |
2389 | if (c_dialect_objc ()((c_language & clk_objc) != 0)) |
2390 | return false; |
2391 | |
2392 | /* Only suggest it for pointers... */ |
2393 | if (TREE_CODE (datum_type)((enum tree_code) (datum_type)->base.code) != POINTER_TYPE) |
2394 | return false; |
2395 | |
2396 | /* ...to structs/unions. */ |
2397 | tree underlying_type = TREE_TYPE (datum_type)((contains_struct_check ((datum_type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2397, __FUNCTION__))->typed.type); |
2398 | enum tree_code code = TREE_CODE (underlying_type)((enum tree_code) (underlying_type)->base.code); |
2399 | if (code == RECORD_TYPE || code == UNION_TYPE) |
2400 | return true; |
2401 | else |
2402 | return false; |
2403 | } |
2404 | |
2405 | /* Make an expression to refer to the COMPONENT field of structure or |
2406 | union value DATUM. COMPONENT is an IDENTIFIER_NODE. LOC is the |
2407 | location of the COMPONENT_REF. COMPONENT_LOC is the location |
2408 | of COMPONENT. */ |
2409 | |
2410 | tree |
2411 | build_component_ref (location_t loc, tree datum, tree component, |
2412 | location_t component_loc) |
2413 | { |
2414 | tree type = TREE_TYPE (datum)((contains_struct_check ((datum), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2414, __FUNCTION__))->typed.type); |
2415 | enum tree_code code = TREE_CODE (type)((enum tree_code) (type)->base.code); |
2416 | tree field = NULL__null; |
2417 | tree ref; |
2418 | bool datum_lvalue = lvalue_p (datum); |
2419 | |
2420 | if (!objc_is_public (datum, component)) |
2421 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
2422 | |
2423 | /* Detect Objective-C property syntax object.property. */ |
2424 | if (c_dialect_objc ()((c_language & clk_objc) != 0) |
2425 | && (ref = objc_maybe_build_component_ref (datum, component))) |
2426 | return ref; |
2427 | |
2428 | /* See if there is a field or component with name COMPONENT. */ |
2429 | |
2430 | if (code == RECORD_TYPE || code == UNION_TYPE) |
2431 | { |
2432 | if (!COMPLETE_TYPE_P (type)(((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2432, __FUNCTION__))->type_common.size) != (tree) __null )) |
2433 | { |
2434 | c_incomplete_type_error (loc, NULL_TREE(tree) __null, type); |
2435 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
2436 | } |
2437 | |
2438 | field = lookup_field (type, component); |
2439 | |
2440 | if (!field) |
2441 | { |
2442 | tree guessed_id = lookup_field_fuzzy (type, component); |
2443 | if (guessed_id) |
2444 | { |
2445 | /* Attempt to provide a fixit replacement hint, if |
2446 | we have a valid range for the component. */ |
2447 | location_t reported_loc |
2448 | = (component_loc != UNKNOWN_LOCATION((location_t) 0)) ? component_loc : loc; |
2449 | gcc_rich_location rich_loc (reported_loc); |
2450 | if (component_loc != UNKNOWN_LOCATION((location_t) 0)) |
2451 | rich_loc.add_fixit_misspelled_id (component_loc, guessed_id); |
2452 | error_at (&rich_loc, |
2453 | "%qT has no member named %qE; did you mean %qE?", |
2454 | type, component, guessed_id); |
2455 | } |
2456 | else |
2457 | error_at (loc, "%qT has no member named %qE", type, component); |
2458 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
2459 | } |
2460 | |
2461 | /* Accessing elements of atomic structures or unions is undefined |
2462 | behavior (C11 6.5.2.3#5). */ |
2463 | if (TYPE_ATOMIC (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2463, __FUNCTION__))->base.u.bits.atomic_flag) && c_inhibit_evaluation_warnings == 0) |
2464 | { |
2465 | if (code == RECORD_TYPE) |
2466 | warning_at (loc, 0, "accessing a member %qE of an atomic " |
2467 | "structure %qE", component, datum); |
2468 | else |
2469 | warning_at (loc, 0, "accessing a member %qE of an atomic " |
2470 | "union %qE", component, datum); |
2471 | } |
2472 | |
2473 | /* Chain the COMPONENT_REFs if necessary down to the FIELD. |
2474 | This might be better solved in future the way the C++ front |
2475 | end does it - by giving the anonymous entities each a |
2476 | separate name and type, and then have build_component_ref |
2477 | recursively call itself. We can't do that here. */ |
2478 | do |
2479 | { |
2480 | tree subdatum = TREE_VALUE (field)((tree_check ((field), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2480, __FUNCTION__, (TREE_LIST)))->list.value); |
2481 | int quals; |
2482 | tree subtype; |
2483 | bool use_datum_quals; |
2484 | |
2485 | if (TREE_TYPE (subdatum)((contains_struct_check ((subdatum), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2485, __FUNCTION__))->typed.type) == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
2486 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
2487 | |
2488 | /* If this is an rvalue, it does not have qualifiers in C |
2489 | standard terms and we must avoid propagating such |
2490 | qualifiers down to a non-lvalue array that is then |
2491 | converted to a pointer. */ |
2492 | use_datum_quals = (datum_lvalue |
2493 | || TREE_CODE (TREE_TYPE (subdatum))((enum tree_code) (((contains_struct_check ((subdatum), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2493, __FUNCTION__))->typed.type))->base.code) != ARRAY_TYPE); |
2494 | |
2495 | quals = TYPE_QUALS (strip_array_types (TREE_TYPE (subdatum)))((int) ((((tree_class_check ((strip_array_types (((contains_struct_check ((subdatum), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2495, __FUNCTION__))->typed.type))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2495, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((strip_array_types (((contains_struct_check ((subdatum), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2495, __FUNCTION__))->typed.type))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2495, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((strip_array_types (((contains_struct_check ((subdatum), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2495, __FUNCTION__))->typed.type))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2495, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((strip_array_types (((contains_struct_check ((subdatum), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2495, __FUNCTION__))->typed.type))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2495, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ) | (((((tree_class_check ((strip_array_types (((contains_struct_check ((subdatum), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2495, __FUNCTION__))->typed.type))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2495, __FUNCTION__))->base.u.bits.address_space) & 0xFF ) << 8)))); |
2496 | if (use_datum_quals) |
2497 | quals |= TYPE_QUALS (TREE_TYPE (datum))((int) ((((tree_class_check ((((contains_struct_check ((datum ), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2497, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2497, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((((contains_struct_check ((datum), ( TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2497, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2497, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((((contains_struct_check ((datum), ( TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2497, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2497, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((((contains_struct_check ((datum), ( TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2497, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2497, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ) | (((((tree_class_check ((((contains_struct_check ((datum), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2497, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2497, __FUNCTION__))->base.u.bits.address_space) & 0xFF ) << 8)))); |
2498 | subtype = c_build_qualified_type (TREE_TYPE (subdatum)((contains_struct_check ((subdatum), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2498, __FUNCTION__))->typed.type), quals); |
2499 | |
2500 | ref = build3 (COMPONENT_REF, subtype, datum, subdatum, |
2501 | NULL_TREE(tree) __null); |
2502 | SET_EXPR_LOCATION (ref, loc)(expr_check (((ref)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2502, __FUNCTION__))->exp.locus = (loc); |
2503 | if (TREE_READONLY (subdatum)((non_type_check ((subdatum), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2503, __FUNCTION__))->base.readonly_flag) |
2504 | || (use_datum_quals && TREE_READONLY (datum)((non_type_check ((datum), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2504, __FUNCTION__))->base.readonly_flag))) |
2505 | TREE_READONLY (ref)((non_type_check ((ref), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2505, __FUNCTION__))->base.readonly_flag) = 1; |
2506 | if (TREE_THIS_VOLATILE (subdatum)((subdatum)->base.volatile_flag) |
2507 | || (use_datum_quals && TREE_THIS_VOLATILE (datum)((datum)->base.volatile_flag))) |
2508 | TREE_THIS_VOLATILE (ref)((ref)->base.volatile_flag) = 1; |
2509 | |
2510 | if (TREE_DEPRECATED (subdatum)((subdatum)->base.deprecated_flag)) |
2511 | warn_deprecated_use (subdatum, NULL_TREE(tree) __null); |
2512 | |
2513 | datum = ref; |
2514 | |
2515 | field = TREE_CHAIN (field)((contains_struct_check ((field), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2515, __FUNCTION__))->common.chain); |
2516 | } |
2517 | while (field); |
2518 | |
2519 | return ref; |
2520 | } |
2521 | else if (should_suggest_deref_p (type)) |
2522 | { |
2523 | /* Special-case the error message for "ptr.field" for the case |
2524 | where the user has confused "." vs "->". */ |
2525 | rich_location richloc (line_table, loc); |
2526 | /* "loc" should be the "." token. */ |
2527 | richloc.add_fixit_replace ("->"); |
2528 | error_at (&richloc, |
2529 | "%qE is a pointer; did you mean to use %<->%>?", |
2530 | datum); |
2531 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
2532 | } |
2533 | else if (code != ERROR_MARK) |
2534 | error_at (loc, |
2535 | "request for member %qE in something not a structure or union", |
2536 | component); |
2537 | |
2538 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
2539 | } |
2540 | |
2541 | /* Given an expression PTR for a pointer, return an expression |
2542 | for the value pointed to. |
2543 | ERRORSTRING is the name of the operator to appear in error messages. |
2544 | |
2545 | LOC is the location to use for the generated tree. */ |
2546 | |
2547 | tree |
2548 | build_indirect_ref (location_t loc, tree ptr, ref_operator errstring) |
2549 | { |
2550 | tree pointer = default_conversion (ptr); |
2551 | tree type = TREE_TYPE (pointer)((contains_struct_check ((pointer), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2551, __FUNCTION__))->typed.type); |
2552 | tree ref; |
2553 | |
2554 | if (TREE_CODE (type)((enum tree_code) (type)->base.code) == POINTER_TYPE) |
2555 | { |
2556 | if (CONVERT_EXPR_P (pointer)((((enum tree_code) (pointer)->base.code)) == NOP_EXPR || ( ((enum tree_code) (pointer)->base.code)) == CONVERT_EXPR) |
2557 | || TREE_CODE (pointer)((enum tree_code) (pointer)->base.code) == VIEW_CONVERT_EXPR) |
2558 | { |
2559 | /* If a warning is issued, mark it to avoid duplicates from |
2560 | the backend. This only needs to be done at |
2561 | warn_strict_aliasing > 2. */ |
2562 | if (warn_strict_aliasingglobal_options.x_warn_strict_aliasing > 2) |
2563 | if (strict_aliasing_warning (EXPR_LOCATION (pointer)((((pointer)) && ((tree_code_type[(int) (((enum tree_code ) ((pointer))->base.code))]) >= tcc_reference && (tree_code_type[(int) (((enum tree_code) ((pointer))->base .code))]) <= tcc_expression)) ? (pointer)->exp.locus : ( (location_t) 0)), |
2564 | type, TREE_OPERAND (pointer, 0)(*((const_cast<tree*> (tree_operand_check ((pointer), ( 0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2564, __FUNCTION__))))))) |
2565 | TREE_NO_WARNING (pointer)((pointer)->base.nowarning_flag) = 1; |
2566 | } |
2567 | |
2568 | if (TREE_CODE (pointer)((enum tree_code) (pointer)->base.code) == ADDR_EXPR |
2569 | && (TREE_TYPE (TREE_OPERAND (pointer, 0))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check ((pointer), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2569, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2569, __FUNCTION__))->typed.type) |
2570 | == TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2570, __FUNCTION__))->typed.type))) |
2571 | { |
2572 | ref = TREE_OPERAND (pointer, 0)(*((const_cast<tree*> (tree_operand_check ((pointer), ( 0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2572, __FUNCTION__))))); |
2573 | protected_set_expr_location (ref, loc); |
2574 | return ref; |
2575 | } |
2576 | else |
2577 | { |
2578 | tree t = TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2578, __FUNCTION__))->typed.type); |
2579 | |
2580 | ref = build1 (INDIRECT_REF, t, pointer); |
2581 | |
2582 | if (VOID_TYPE_P (t)(((enum tree_code) (t)->base.code) == VOID_TYPE) && c_inhibit_evaluation_warnings == 0) |
2583 | warning_at (loc, 0, "dereferencing %<void *%> pointer"); |
2584 | |
2585 | /* We *must* set TREE_READONLY when dereferencing a pointer to const, |
2586 | so that we get the proper error message if the result is used |
2587 | to assign to. Also, &* is supposed to be a no-op. |
2588 | And ANSI C seems to specify that the type of the result |
2589 | should be the const type. */ |
2590 | /* A de-reference of a pointer to const is not a const. It is valid |
2591 | to change it via some other pointer. */ |
2592 | TREE_READONLY (ref)((non_type_check ((ref), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2592, __FUNCTION__))->base.readonly_flag) = TYPE_READONLY (t)((tree_class_check ((t), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2592, __FUNCTION__))->base.readonly_flag); |
2593 | TREE_SIDE_EFFECTS (ref)((non_type_check ((ref), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2593, __FUNCTION__))->base.side_effects_flag) |
2594 | = TYPE_VOLATILE (t)((tree_class_check ((t), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2594, __FUNCTION__))->base.volatile_flag) || TREE_SIDE_EFFECTS (pointer)((non_type_check ((pointer), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2594, __FUNCTION__))->base.side_effects_flag); |
2595 | TREE_THIS_VOLATILE (ref)((ref)->base.volatile_flag) = TYPE_VOLATILE (t)((tree_class_check ((t), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2595, __FUNCTION__))->base.volatile_flag); |
2596 | protected_set_expr_location (ref, loc); |
2597 | return ref; |
2598 | } |
2599 | } |
2600 | else if (TREE_CODE (pointer)((enum tree_code) (pointer)->base.code) != ERROR_MARK) |
2601 | invalid_indirection_error (loc, type, errstring); |
2602 | |
2603 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
2604 | } |
2605 | |
2606 | /* This handles expressions of the form "a[i]", which denotes |
2607 | an array reference. |
2608 | |
2609 | This is logically equivalent in C to *(a+i), but we may do it differently. |
2610 | If A is a variable or a member, we generate a primitive ARRAY_REF. |
2611 | This avoids forcing the array out of registers, and can work on |
2612 | arrays that are not lvalues (for example, members of structures returned |
2613 | by functions). |
2614 | |
2615 | For vector types, allow vector[i] but not i[vector], and create |
2616 | *(((type*)&vectortype) + i) for the expression. |
2617 | |
2618 | LOC is the location to use for the returned expression. */ |
2619 | |
2620 | tree |
2621 | build_array_ref (location_t loc, tree array, tree index) |
2622 | { |
2623 | tree ret; |
2624 | bool swapped = false; |
2625 | if (TREE_TYPE (array)((contains_struct_check ((array), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2625, __FUNCTION__))->typed.type) == error_mark_nodeglobal_trees[TI_ERROR_MARK] |
2626 | || TREE_TYPE (index)((contains_struct_check ((index), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2626, __FUNCTION__))->typed.type) == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
2627 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
2628 | |
2629 | if (TREE_CODE (TREE_TYPE (array))((enum tree_code) (((contains_struct_check ((array), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2629, __FUNCTION__))->typed.type))->base.code) != ARRAY_TYPE |
2630 | && TREE_CODE (TREE_TYPE (array))((enum tree_code) (((contains_struct_check ((array), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2630, __FUNCTION__))->typed.type))->base.code) != POINTER_TYPE |
2631 | /* Allow vector[index] but not index[vector]. */ |
2632 | && !gnu_vector_type_p (TREE_TYPE (array)((contains_struct_check ((array), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2632, __FUNCTION__))->typed.type))) |
2633 | { |
2634 | if (TREE_CODE (TREE_TYPE (index))((enum tree_code) (((contains_struct_check ((index), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2634, __FUNCTION__))->typed.type))->base.code) != ARRAY_TYPE |
2635 | && TREE_CODE (TREE_TYPE (index))((enum tree_code) (((contains_struct_check ((index), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2635, __FUNCTION__))->typed.type))->base.code) != POINTER_TYPE) |
2636 | { |
2637 | error_at (loc, |
2638 | "subscripted value is neither array nor pointer nor vector"); |
2639 | |
2640 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
2641 | } |
2642 | std::swap (array, index); |
2643 | swapped = true; |
2644 | } |
2645 | |
2646 | if (!INTEGRAL_TYPE_P (TREE_TYPE (index))(((enum tree_code) (((contains_struct_check ((index), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2646, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE || ((enum tree_code) (((contains_struct_check ((index), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2646, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE || ((enum tree_code) (((contains_struct_check ((index), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2646, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE )) |
2647 | { |
2648 | error_at (loc, "array subscript is not an integer"); |
2649 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
2650 | } |
2651 | |
2652 | if (TREE_CODE (TREE_TYPE (TREE_TYPE (array)))((enum tree_code) (((contains_struct_check ((((contains_struct_check ((array), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2652, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2652, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE) |
2653 | { |
2654 | error_at (loc, "subscripted value is pointer to function"); |
2655 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
2656 | } |
2657 | |
2658 | /* ??? Existing practice has been to warn only when the char |
2659 | index is syntactically the index, not for char[array]. */ |
2660 | if (!swapped) |
2661 | warn_array_subscript_with_type_char (loc, index); |
2662 | |
2663 | /* Apply default promotions *after* noticing character types. */ |
2664 | index = default_conversion (index); |
2665 | if (index == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
2666 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
2667 | |
2668 | gcc_assert (TREE_CODE (TREE_TYPE (index)) == INTEGER_TYPE)((void)(!(((enum tree_code) (((contains_struct_check ((index) , (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2668, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE ) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2668, __FUNCTION__), 0 : 0)); |
2669 | |
2670 | bool was_vector = VECTOR_TYPE_P (TREE_TYPE (array))(((enum tree_code) (((contains_struct_check ((array), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2670, __FUNCTION__))->typed.type))->base.code) == VECTOR_TYPE ); |
2671 | bool non_lvalue = convert_vector_to_array_for_subscript (loc, &array, index); |
2672 | |
2673 | if (TREE_CODE (TREE_TYPE (array))((enum tree_code) (((contains_struct_check ((array), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2673, __FUNCTION__))->typed.type))->base.code) == ARRAY_TYPE) |
2674 | { |
2675 | tree rval, type; |
2676 | |
2677 | /* An array that is indexed by a non-constant |
2678 | cannot be stored in a register; we must be able to do |
2679 | address arithmetic on its address. |
2680 | Likewise an array of elements of variable size. */ |
2681 | if (TREE_CODE (index)((enum tree_code) (index)->base.code) != INTEGER_CST |
2682 | || (COMPLETE_TYPE_P (TREE_TYPE (TREE_TYPE (array)))(((tree_class_check ((((contains_struct_check ((((contains_struct_check ((array), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2682, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2682, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2682, __FUNCTION__))->type_common.size) != (tree) __null ) |
2683 | && TREE_CODE (TYPE_SIZE (TREE_TYPE (TREE_TYPE (array))))((enum tree_code) (((tree_class_check ((((contains_struct_check ((((contains_struct_check ((array), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2683, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2683, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2683, __FUNCTION__))->type_common.size))->base.code) != INTEGER_CST)) |
2684 | { |
2685 | if (!c_mark_addressable (array, true)) |
2686 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
2687 | } |
2688 | /* An array that is indexed by a constant value which is not within |
2689 | the array bounds cannot be stored in a register either; because we |
2690 | would get a crash in store_bit_field/extract_bit_field when trying |
2691 | to access a non-existent part of the register. */ |
2692 | if (TREE_CODE (index)((enum tree_code) (index)->base.code) == INTEGER_CST |
2693 | && TYPE_DOMAIN (TREE_TYPE (array))((tree_check ((((contains_struct_check ((array), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2693, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2693, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) |
2694 | && !int_fits_type_p (index, TYPE_DOMAIN (TREE_TYPE (array))((tree_check ((((contains_struct_check ((array), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2694, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2694, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ))) |
2695 | { |
2696 | if (!c_mark_addressable (array)) |
2697 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
2698 | } |
2699 | |
2700 | if ((pedanticglobal_options.x_pedantic || warn_c90_c99_compatglobal_options.x_warn_c90_c99_compat) |
2701 | && ! was_vector) |
2702 | { |
2703 | tree foo = array; |
2704 | while (TREE_CODE (foo)((enum tree_code) (foo)->base.code) == COMPONENT_REF) |
2705 | foo = TREE_OPERAND (foo, 0)(*((const_cast<tree*> (tree_operand_check ((foo), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2705, __FUNCTION__))))); |
2706 | if (VAR_P (foo)(((enum tree_code) (foo)->base.code) == VAR_DECL) && C_DECL_REGISTER (foo)((contains_struct_check ((foo), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2706, __FUNCTION__))->decl_common.lang_flag_4)) |
2707 | pedwarn (loc, OPT_Wpedantic, |
2708 | "ISO C forbids subscripting %<register%> array"); |
2709 | else if (!lvalue_p (foo)) |
2710 | pedwarn_c90 (loc, OPT_Wpedantic, |
2711 | "ISO C90 forbids subscripting non-lvalue " |
2712 | "array"); |
2713 | } |
2714 | |
2715 | type = TREE_TYPE (TREE_TYPE (array))((contains_struct_check ((((contains_struct_check ((array), ( TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2715, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2715, __FUNCTION__))->typed.type); |
2716 | rval = build4 (ARRAY_REF, type, array, index, NULL_TREE(tree) __null, NULL_TREE(tree) __null); |
2717 | /* Array ref is const/volatile if the array elements are |
2718 | or if the array is. */ |
2719 | TREE_READONLY (rval)((non_type_check ((rval), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2719, __FUNCTION__))->base.readonly_flag) |
2720 | |= (TYPE_READONLY (TREE_TYPE (TREE_TYPE (array)))((tree_class_check ((((contains_struct_check ((((contains_struct_check ((array), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2720, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2720, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2720, __FUNCTION__))->base.readonly_flag) |
2721 | | TREE_READONLY (array)((non_type_check ((array), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2721, __FUNCTION__))->base.readonly_flag)); |
2722 | TREE_SIDE_EFFECTS (rval)((non_type_check ((rval), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2722, __FUNCTION__))->base.side_effects_flag) |
2723 | |= (TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (array)))((tree_class_check ((((contains_struct_check ((((contains_struct_check ((array), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2723, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2723, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2723, __FUNCTION__))->base.volatile_flag) |
2724 | | TREE_SIDE_EFFECTS (array)((non_type_check ((array), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2724, __FUNCTION__))->base.side_effects_flag)); |
2725 | TREE_THIS_VOLATILE (rval)((rval)->base.volatile_flag) |
2726 | |= (TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (array)))((tree_class_check ((((contains_struct_check ((((contains_struct_check ((array), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2726, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2726, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2726, __FUNCTION__))->base.volatile_flag) |
2727 | /* This was added by rms on 16 Nov 91. |
2728 | It fixes vol struct foo *a; a->elts[1] |
2729 | in an inline function. |
2730 | Hope it doesn't break something else. */ |
2731 | | TREE_THIS_VOLATILE (array)((array)->base.volatile_flag)); |
2732 | ret = require_complete_type (loc, rval); |
2733 | protected_set_expr_location (ret, loc); |
2734 | if (non_lvalue) |
2735 | ret = non_lvalue_loc (loc, ret); |
2736 | return ret; |
2737 | } |
2738 | else |
2739 | { |
2740 | tree ar = default_conversion (array); |
2741 | |
2742 | if (ar == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
2743 | return ar; |
2744 | |
2745 | gcc_assert (TREE_CODE (TREE_TYPE (ar)) == POINTER_TYPE)((void)(!(((enum tree_code) (((contains_struct_check ((ar), ( TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2745, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE ) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2745, __FUNCTION__), 0 : 0)); |
2746 | gcc_assert (TREE_CODE (TREE_TYPE (TREE_TYPE (ar))) != FUNCTION_TYPE)((void)(!(((enum tree_code) (((contains_struct_check ((((contains_struct_check ((ar), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2746, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2746, __FUNCTION__))->typed.type))->base.code) != FUNCTION_TYPE ) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2746, __FUNCTION__), 0 : 0)); |
2747 | |
2748 | ret = build_indirect_ref (loc, build_binary_op (loc, PLUS_EXPR, ar, |
2749 | index, false), |
2750 | RO_ARRAY_INDEXING); |
2751 | if (non_lvalue) |
2752 | ret = non_lvalue_loc (loc, ret); |
2753 | return ret; |
2754 | } |
2755 | } |
2756 | |
2757 | /* Build an external reference to identifier ID. FUN indicates |
2758 | whether this will be used for a function call. LOC is the source |
2759 | location of the identifier. This sets *TYPE to the type of the |
2760 | identifier, which is not the same as the type of the returned value |
2761 | for CONST_DECLs defined as enum constants. If the type of the |
2762 | identifier is not available, *TYPE is set to NULL. */ |
2763 | tree |
2764 | build_external_ref (location_t loc, tree id, bool fun, tree *type) |
2765 | { |
2766 | tree ref; |
2767 | tree decl = lookup_name (id); |
2768 | |
2769 | /* In Objective-C, an instance variable (ivar) may be preferred to |
2770 | whatever lookup_name() found. */ |
2771 | decl = objc_lookup_ivar (decl, id); |
2772 | |
2773 | *type = NULL__null; |
2774 | if (decl && decl != error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
2775 | { |
2776 | ref = decl; |
2777 | *type = TREE_TYPE (ref)((contains_struct_check ((ref), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2777, __FUNCTION__))->typed.type); |
2778 | } |
2779 | else if (fun) |
2780 | /* Implicit function declaration. */ |
2781 | ref = implicitly_declare (loc, id); |
2782 | else if (decl == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
2783 | /* Don't complain about something that's already been |
2784 | complained about. */ |
2785 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
2786 | else |
2787 | { |
2788 | undeclared_variable (loc, id); |
2789 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
2790 | } |
2791 | |
2792 | if (TREE_TYPE (ref)((contains_struct_check ((ref), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2792, __FUNCTION__))->typed.type) == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
2793 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
2794 | |
2795 | if (TREE_DEPRECATED (ref)((ref)->base.deprecated_flag)) |
2796 | warn_deprecated_use (ref, NULL_TREE(tree) __null); |
2797 | |
2798 | /* Recursive call does not count as usage. */ |
2799 | if (ref != current_function_decl) |
2800 | { |
2801 | TREE_USED (ref)((ref)->base.used_flag) = 1; |
2802 | } |
2803 | |
2804 | if (TREE_CODE (ref)((enum tree_code) (ref)->base.code) == FUNCTION_DECL && !in_alignof) |
2805 | { |
2806 | if (!in_sizeof && !in_typeof) |
2807 | C_DECL_USED (ref)((contains_struct_check (((tree_check ((ref), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2807, __FUNCTION__, (FUNCTION_DECL)))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2807, __FUNCTION__))->decl_common.lang_flag_5) = 1; |
2808 | else if (DECL_INITIAL (ref)((contains_struct_check ((ref), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2808, __FUNCTION__))->decl_common.initial) == NULL_TREE(tree) __null |
2809 | && DECL_EXTERNAL (ref)((contains_struct_check ((ref), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2809, __FUNCTION__))->decl_common.decl_flag_1) |
2810 | && !TREE_PUBLIC (ref)((ref)->base.public_flag)) |
2811 | record_maybe_used_decl (ref); |
2812 | } |
2813 | |
2814 | if (TREE_CODE (ref)((enum tree_code) (ref)->base.code) == CONST_DECL) |
2815 | { |
2816 | used_types_insert (TREE_TYPE (ref)((contains_struct_check ((ref), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2816, __FUNCTION__))->typed.type)); |
2817 | |
2818 | if (warn_cxx_compatglobal_options.x_warn_cxx_compat |
2819 | && TREE_CODE (TREE_TYPE (ref))((enum tree_code) (((contains_struct_check ((ref), (TS_TYPED) , "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2819, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE |
2820 | && C_TYPE_DEFINED_IN_STRUCT (TREE_TYPE (ref))((tree_class_check ((((contains_struct_check ((ref), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2820, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2820, __FUNCTION__))->type_common.lang_flag_2)) |
2821 | { |
2822 | warning_at (loc, OPT_Wc___compat, |
2823 | ("enum constant defined in struct or union " |
2824 | "is not visible in C++")); |
2825 | inform (DECL_SOURCE_LOCATION (ref)((contains_struct_check ((ref), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2825, __FUNCTION__))->decl_minimal.locus), "enum constant defined here"); |
2826 | } |
2827 | |
2828 | ref = DECL_INITIAL (ref)((contains_struct_check ((ref), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2828, __FUNCTION__))->decl_common.initial); |
2829 | TREE_CONSTANT (ref)((non_type_check ((ref), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2829, __FUNCTION__))->base.constant_flag) = 1; |
2830 | } |
2831 | else if (current_function_decl != NULL_TREE(tree) __null |
2832 | && !DECL_FILE_SCOPE_P (current_function_decl)(! (((contains_struct_check ((current_function_decl), (TS_DECL_MINIMAL ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2832, __FUNCTION__))->decl_minimal.context)) || ((enum tree_code ) (((contains_struct_check ((current_function_decl), (TS_DECL_MINIMAL ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2832, __FUNCTION__))->decl_minimal.context))->base.code ) == TRANSLATION_UNIT_DECL) |
2833 | && (VAR_OR_FUNCTION_DECL_P (ref)(((enum tree_code) (ref)->base.code) == VAR_DECL || ((enum tree_code) (ref)->base.code) == FUNCTION_DECL) |
2834 | || TREE_CODE (ref)((enum tree_code) (ref)->base.code) == PARM_DECL)) |
2835 | { |
2836 | tree context = decl_function_context (ref); |
2837 | |
2838 | if (context != NULL_TREE(tree) __null && context != current_function_decl) |
2839 | DECL_NONLOCAL (ref)((contains_struct_check ((ref), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2839, __FUNCTION__))->decl_common.nonlocal_flag) = 1; |
2840 | } |
2841 | /* C99 6.7.4p3: An inline definition of a function with external |
2842 | linkage ... shall not contain a reference to an identifier with |
2843 | internal linkage. */ |
2844 | else if (current_function_decl != NULL_TREE(tree) __null |
2845 | && DECL_DECLARED_INLINE_P (current_function_decl)((tree_check ((current_function_decl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2845, __FUNCTION__, (FUNCTION_DECL)))->function_decl.declared_inline_flag ) |
2846 | && DECL_EXTERNAL (current_function_decl)((contains_struct_check ((current_function_decl), (TS_DECL_COMMON ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2846, __FUNCTION__))->decl_common.decl_flag_1) |
2847 | && VAR_OR_FUNCTION_DECL_P (ref)(((enum tree_code) (ref)->base.code) == VAR_DECL || ((enum tree_code) (ref)->base.code) == FUNCTION_DECL) |
2848 | && (!VAR_P (ref)(((enum tree_code) (ref)->base.code) == VAR_DECL) || TREE_STATIC (ref)((ref)->base.static_flag)) |
2849 | && ! TREE_PUBLIC (ref)((ref)->base.public_flag) |
2850 | && DECL_CONTEXT (ref)((contains_struct_check ((ref), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2850, __FUNCTION__))->decl_minimal.context) != current_function_decl) |
2851 | record_inline_static (loc, current_function_decl, ref, |
2852 | csi_internal); |
2853 | |
2854 | return ref; |
2855 | } |
2856 | |
2857 | /* Record details of decls possibly used inside sizeof or typeof. */ |
2858 | struct maybe_used_decl |
2859 | { |
2860 | /* The decl. */ |
2861 | tree decl; |
2862 | /* The level seen at (in_sizeof + in_typeof). */ |
2863 | int level; |
2864 | /* The next one at this level or above, or NULL. */ |
2865 | struct maybe_used_decl *next; |
2866 | }; |
2867 | |
2868 | static struct maybe_used_decl *maybe_used_decls; |
2869 | |
2870 | /* Record that DECL, an undefined static function reference seen |
2871 | inside sizeof or typeof, might be used if the operand of sizeof is |
2872 | a VLA type or the operand of typeof is a variably modified |
2873 | type. */ |
2874 | |
2875 | static void |
2876 | record_maybe_used_decl (tree decl) |
2877 | { |
2878 | 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) : (char *) 0) + (((__o1->next_free) - (sizeof (ptrdiff_t) < sizeof (void *) ? (__o1->object_base) : ( char *) 0) + (__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; }); })); |
2879 | t->decl = decl; |
2880 | t->level = in_sizeof + in_typeof; |
2881 | t->next = maybe_used_decls; |
2882 | maybe_used_decls = t; |
2883 | } |
2884 | |
2885 | /* Pop the stack of decls possibly used inside sizeof or typeof. If |
2886 | USED is false, just discard them. If it is true, mark them used |
2887 | (if no longer inside sizeof or typeof) or move them to the next |
2888 | level up (if still inside sizeof or typeof). */ |
2889 | |
2890 | void |
2891 | pop_maybe_used (bool used) |
2892 | { |
2893 | struct maybe_used_decl *p = maybe_used_decls; |
2894 | int cur_level = in_sizeof + in_typeof; |
2895 | while (p && p->level > cur_level) |
2896 | { |
2897 | if (used) |
2898 | { |
2899 | if (cur_level == 0) |
2900 | C_DECL_USED (p->decl)((contains_struct_check (((tree_check ((p->decl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2900, __FUNCTION__, (FUNCTION_DECL)))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2900, __FUNCTION__))->decl_common.lang_flag_5) = 1; |
2901 | else |
2902 | p->level = cur_level; |
2903 | } |
2904 | p = p->next; |
2905 | } |
2906 | if (!used || cur_level == 0) |
2907 | maybe_used_decls = p; |
2908 | } |
2909 | |
2910 | /* Return the result of sizeof applied to EXPR. */ |
2911 | |
2912 | struct c_expr |
2913 | c_expr_sizeof_expr (location_t loc, struct c_expr expr) |
2914 | { |
2915 | struct c_expr ret; |
2916 | if (expr.value == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
2917 | { |
2918 | ret.value = error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
2919 | ret.original_code = ERROR_MARK; |
2920 | ret.original_type = NULL__null; |
2921 | pop_maybe_used (false); |
2922 | } |
2923 | else |
2924 | { |
2925 | bool expr_const_operands = true; |
2926 | |
2927 | if (TREE_CODE (expr.value)((enum tree_code) (expr.value)->base.code) == PARM_DECL |
2928 | && C_ARRAY_PARAMETER (expr.value)((contains_struct_check ((expr.value), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2928, __FUNCTION__))->decl_common.lang_flag_0)) |
2929 | { |
2930 | auto_diagnostic_group d; |
2931 | if (warning_at (loc, OPT_Wsizeof_array_argument, |
2932 | "%<sizeof%> on array function parameter %qE will " |
2933 | "return size of %qT", expr.value, |
2934 | TREE_TYPE (expr.value)((contains_struct_check ((expr.value), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2934, __FUNCTION__))->typed.type))) |
2935 | inform (DECL_SOURCE_LOCATION (expr.value)((contains_struct_check ((expr.value), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2935, __FUNCTION__))->decl_minimal.locus), "declared here"); |
2936 | } |
2937 | tree folded_expr = c_fully_fold (expr.value, require_constant_value, |
2938 | &expr_const_operands); |
2939 | ret.value = c_sizeof (loc, TREE_TYPE (folded_expr))c_sizeof_or_alignof_type (loc, ((contains_struct_check ((folded_expr ), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2939, __FUNCTION__))->typed.type), true, false, 1); |
2940 | c_last_sizeof_arg = expr.value; |
2941 | c_last_sizeof_loc = loc; |
2942 | ret.original_code = SIZEOF_EXPR; |
2943 | ret.original_type = NULL__null; |
2944 | if (c_vla_type_p (TREE_TYPE (folded_expr)((contains_struct_check ((folded_expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2944, __FUNCTION__))->typed.type))) |
2945 | { |
2946 | /* sizeof is evaluated when given a vla (C99 6.5.3.4p2). */ |
2947 | ret.value = build2 (C_MAYBE_CONST_EXPR, TREE_TYPE (ret.value)((contains_struct_check ((ret.value), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2947, __FUNCTION__))->typed.type), |
2948 | folded_expr, ret.value); |
2949 | C_MAYBE_CONST_EXPR_NON_CONST (ret.value)((tree_not_check2 (((tree_check ((ret.value), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2949, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2949, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_1) = !expr_const_operands; |
2950 | SET_EXPR_LOCATION (ret.value, loc)(expr_check (((ret.value)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2950, __FUNCTION__))->exp.locus = (loc); |
2951 | } |
2952 | pop_maybe_used (C_TYPE_VARIABLE_SIZE (TREE_TYPE (folded_expr))((tree_class_check ((((contains_struct_check ((folded_expr), ( TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2952, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2952, __FUNCTION__))->type_common.lang_flag_1)); |
2953 | } |
2954 | return ret; |
2955 | } |
2956 | |
2957 | /* Return the result of sizeof applied to T, a structure for the type |
2958 | name passed to sizeof (rather than the type itself). LOC is the |
2959 | location of the original expression. */ |
2960 | |
2961 | struct c_expr |
2962 | c_expr_sizeof_type (location_t loc, struct c_type_name *t) |
2963 | { |
2964 | tree type; |
2965 | struct c_expr ret; |
2966 | tree type_expr = NULL_TREE(tree) __null; |
2967 | bool type_expr_const = true; |
2968 | type = groktypename (t, &type_expr, &type_expr_const); |
2969 | ret.value = c_sizeof (loc, type)c_sizeof_or_alignof_type (loc, type, true, false, 1); |
2970 | c_last_sizeof_arg = type; |
2971 | c_last_sizeof_loc = loc; |
2972 | ret.original_code = SIZEOF_EXPR; |
2973 | ret.original_type = NULL__null; |
2974 | if ((type_expr || TREE_CODE (ret.value)((enum tree_code) (ret.value)->base.code) == INTEGER_CST) |
2975 | && c_vla_type_p (type)) |
2976 | { |
2977 | /* If the type is a [*] array, it is a VLA but is represented as |
2978 | having a size of zero. In such a case we must ensure that |
2979 | the result of sizeof does not get folded to a constant by |
2980 | c_fully_fold, because if the size is evaluated the result is |
2981 | not constant and so constraints on zero or negative size |
2982 | arrays must not be applied when this sizeof call is inside |
2983 | another array declarator. */ |
2984 | if (!type_expr) |
2985 | type_expr = integer_zero_nodeglobal_trees[TI_INTEGER_ZERO]; |
2986 | ret.value = build2 (C_MAYBE_CONST_EXPR, TREE_TYPE (ret.value)((contains_struct_check ((ret.value), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2986, __FUNCTION__))->typed.type), |
2987 | type_expr, ret.value); |
2988 | C_MAYBE_CONST_EXPR_NON_CONST (ret.value)((tree_not_check2 (((tree_check ((ret.value), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2988, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2988, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_1) = !type_expr_const; |
2989 | } |
2990 | pop_maybe_used (type != error_mark_nodeglobal_trees[TI_ERROR_MARK] |
2991 | ? C_TYPE_VARIABLE_SIZE (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 2991, __FUNCTION__))->type_common.lang_flag_1) : false); |
2992 | return ret; |
2993 | } |
2994 | |
2995 | /* Build a function call to function FUNCTION with parameters PARAMS. |
2996 | The function call is at LOC. |
2997 | PARAMS is a list--a chain of TREE_LIST nodes--in which the |
2998 | TREE_VALUE of each node is a parameter-expression. |
2999 | FUNCTION's data type may be a function type or a pointer-to-function. */ |
3000 | |
3001 | tree |
3002 | build_function_call (location_t loc, tree function, tree params) |
3003 | { |
3004 | vec<tree, va_gc> *v; |
3005 | tree ret; |
3006 | |
3007 | vec_alloc (v, list_length (params)); |
3008 | for (; params; params = TREE_CHAIN (params)((contains_struct_check ((params), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3008, __FUNCTION__))->common.chain)) |
3009 | v->quick_push (TREE_VALUE (params)((tree_check ((params), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3009, __FUNCTION__, (TREE_LIST)))->list.value)); |
3010 | ret = c_build_function_call_vec (loc, vNULL, function, v, NULL__null); |
3011 | vec_free (v); |
3012 | return ret; |
3013 | } |
3014 | |
3015 | /* Give a note about the location of the declaration of DECL. */ |
3016 | |
3017 | static void |
3018 | inform_declaration (tree decl) |
3019 | { |
3020 | if (decl && (TREE_CODE (decl)((enum tree_code) (decl)->base.code) != FUNCTION_DECL |
3021 | || !DECL_IS_UNDECLARED_BUILTIN (decl)(((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3021, __FUNCTION__))->decl_minimal.locus) <= ((location_t ) 1)))) |
3022 | inform (DECL_SOURCE_LOCATION (decl)((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3022, __FUNCTION__))->decl_minimal.locus), "declared here"); |
3023 | } |
3024 | |
3025 | /* Build a function call to function FUNCTION with parameters PARAMS. |
3026 | If FUNCTION is the result of resolving an overloaded target built-in, |
3027 | ORIG_FUNDECL is the original function decl, otherwise it is null. |
3028 | ORIGTYPES, if not NULL, is a vector of types; each element is |
3029 | either NULL or the original type of the corresponding element in |
3030 | PARAMS. The original type may differ from TREE_TYPE of the |
3031 | parameter for enums. FUNCTION's data type may be a function type |
3032 | or pointer-to-function. This function changes the elements of |
3033 | PARAMS. */ |
3034 | |
3035 | tree |
3036 | build_function_call_vec (location_t loc, vec<location_t> arg_loc, |
3037 | tree function, vec<tree, va_gc> *params, |
3038 | vec<tree, va_gc> *origtypes, tree orig_fundecl) |
3039 | { |
3040 | tree fntype, fundecl = NULL_TREE(tree) __null; |
3041 | tree name = NULL_TREE(tree) __null, result; |
3042 | tree tem; |
3043 | int nargs; |
3044 | tree *argarray; |
3045 | |
3046 | |
3047 | /* Strip NON_LVALUE_EXPRs, etc., since we aren't using as an lvalue. */ |
3048 | 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), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3048, __FUNCTION__))))) != global_trees[TI_ERROR_MARK] && (((contains_struct_check ((function), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3048, __FUNCTION__))->typed.type) == ((contains_struct_check (((*((const_cast<tree*> (tree_operand_check ((function ), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3048, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3048, __FUNCTION__))->typed.type))) (function) = (*((const_cast <tree*> (tree_operand_check ((function), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3048, __FUNCTION__))))); |
3049 | |
3050 | /* Convert anything with function type to a pointer-to-function. */ |
3051 | if (TREE_CODE (function)((enum tree_code) (function)->base.code) == FUNCTION_DECL) |
3052 | { |
3053 | name = DECL_NAME (function)((contains_struct_check ((function), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3053, __FUNCTION__))->decl_minimal.name); |
3054 | |
3055 | if (flag_tmglobal_options.x_flag_tm) |
3056 | tm_malloc_replacement (function); |
3057 | fundecl = function; |
3058 | if (!orig_fundecl) |
3059 | orig_fundecl = fundecl; |
3060 | /* Atomic functions have type checking/casting already done. They are |
3061 | often rewritten and don't match the original parameter list. */ |
3062 | if (name && !strncmp (IDENTIFIER_POINTER (name)((const char *) (tree_check ((name), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3062, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.str ), "__atomic_", 9)) |
3063 | origtypes = NULL__null; |
3064 | } |
3065 | if (TREE_CODE (TREE_TYPE (function))((enum tree_code) (((contains_struct_check ((function), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3065, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE) |
3066 | function = function_to_pointer_conversion (loc, function); |
3067 | |
3068 | /* For Objective-C, convert any calls via a cast to OBJC_TYPE_REF |
3069 | expressions, like those used for ObjC messenger dispatches. */ |
3070 | if (params && !params->is_empty ()) |
3071 | function = objc_rewrite_function_call (function, (*params)[0]); |
3072 | |
3073 | function = c_fully_fold (function, false, NULL__null); |
3074 | |
3075 | fntype = TREE_TYPE (function)((contains_struct_check ((function), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3075, __FUNCTION__))->typed.type); |
3076 | |
3077 | if (TREE_CODE (fntype)((enum tree_code) (fntype)->base.code) == ERROR_MARK) |
3078 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
3079 | |
3080 | if (!(TREE_CODE (fntype)((enum tree_code) (fntype)->base.code) == POINTER_TYPE |
3081 | && TREE_CODE (TREE_TYPE (fntype))((enum tree_code) (((contains_struct_check ((fntype), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3081, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE)) |
3082 | { |
3083 | if (!flag_diagnostics_show_caretglobal_options.x_flag_diagnostics_show_caret && !STATEMENT_CLASS_P (function)(tree_code_type[(int) (((enum tree_code) (function)->base. code))] == tcc_statement)) |
3084 | error_at (loc, |
3085 | "called object %qE is not a function or function pointer", |
3086 | function); |
3087 | else if (DECL_P (function)(tree_code_type[(int) (((enum tree_code) (function)->base. code))] == tcc_declaration)) |
3088 | { |
3089 | error_at (loc, |
3090 | "called object %qD is not a function or function pointer", |
3091 | function); |
3092 | inform_declaration (function); |
3093 | } |
3094 | else |
3095 | error_at (loc, |
3096 | "called object is not a function or function pointer"); |
3097 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
3098 | } |
3099 | |
3100 | if (fundecl && TREE_THIS_VOLATILE (fundecl)((fundecl)->base.volatile_flag)) |
3101 | current_function_returns_abnormally = 1; |
3102 | |
3103 | /* fntype now gets the type of function pointed to. */ |
3104 | fntype = TREE_TYPE (fntype)((contains_struct_check ((fntype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3104, __FUNCTION__))->typed.type); |
3105 | |
3106 | /* Convert the parameters to the types declared in the |
3107 | function prototype, or apply default promotions. */ |
3108 | |
3109 | nargs = convert_arguments (loc, arg_loc, TYPE_ARG_TYPES (fntype)((tree_check2 ((fntype), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3109, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values), params, |
3110 | origtypes, function, fundecl); |
3111 | if (nargs < 0) |
3112 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
3113 | |
3114 | /* Check that the function is called through a compatible prototype. |
3115 | If it is not, warn. */ |
3116 | if (CONVERT_EXPR_P (function)((((enum tree_code) (function)->base.code)) == NOP_EXPR || (((enum tree_code) (function)->base.code)) == CONVERT_EXPR ) |
3117 | && TREE_CODE (tem = TREE_OPERAND (function, 0))((enum tree_code) (tem = (*((const_cast<tree*> (tree_operand_check ((function), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3117, __FUNCTION__))))))->base.code) == ADDR_EXPR |
3118 | && TREE_CODE (tem = TREE_OPERAND (tem, 0))((enum tree_code) (tem = (*((const_cast<tree*> (tree_operand_check ((tem), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3118, __FUNCTION__))))))->base.code) == FUNCTION_DECL |
3119 | && !comptypes (fntype, TREE_TYPE (tem)((contains_struct_check ((tem), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3119, __FUNCTION__))->typed.type))) |
3120 | { |
3121 | tree return_type = TREE_TYPE (fntype)((contains_struct_check ((fntype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3121, __FUNCTION__))->typed.type); |
3122 | |
3123 | /* This situation leads to run-time undefined behavior. We can't, |
3124 | therefore, simply error unless we can prove that all possible |
3125 | executions of the program must execute the code. */ |
3126 | warning_at (loc, 0, "function called through a non-compatible type"); |
3127 | |
3128 | if (VOID_TYPE_P (return_type)(((enum tree_code) (return_type)->base.code) == VOID_TYPE) |
3129 | && TYPE_QUALS (return_type)((int) ((((tree_class_check ((return_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3129, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((return_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3129, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((return_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3129, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((return_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3129, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ) | (((((tree_class_check ((return_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3129, __FUNCTION__))->base.u.bits.address_space) & 0xFF ) << 8)))) != TYPE_UNQUALIFIED) |
3130 | pedwarn (loc, 0, |
3131 | "function with qualified void return type called"); |
3132 | } |
3133 | |
3134 | argarray = vec_safe_address (params); |
3135 | |
3136 | /* Check that arguments to builtin functions match the expectations. */ |
3137 | if (fundecl |
3138 | && fndecl_built_in_p (fundecl) |
3139 | && !check_builtin_function_arguments (loc, arg_loc, fundecl, |
3140 | orig_fundecl, nargs, argarray)) |
3141 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
3142 | |
3143 | /* Check that the arguments to the function are valid. */ |
3144 | bool warned_p = check_function_arguments (loc, fundecl, fntype, |
3145 | nargs, argarray, &arg_loc); |
3146 | |
3147 | if (name != NULL_TREE(tree) __null |
3148 | && !strncmp (IDENTIFIER_POINTER (name)((const char *) (tree_check ((name), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3148, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.str ), "__builtin_", 10)) |
3149 | { |
3150 | if (require_constant_value) |
3151 | result |
3152 | = fold_build_call_array_initializer_loc (loc, TREE_TYPE (fntype)((contains_struct_check ((fntype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3152, __FUNCTION__))->typed.type), |
3153 | function, nargs, argarray); |
3154 | else |
3155 | result = fold_build_call_array_loc (loc, TREE_TYPE (fntype)((contains_struct_check ((fntype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3155, __FUNCTION__))->typed.type), |
3156 | function, nargs, argarray); |
3157 | if (TREE_CODE (result)((enum tree_code) (result)->base.code) == NOP_EXPR |
3158 | && TREE_CODE (TREE_OPERAND (result, 0))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check ((result), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3158, __FUNCTION__))))))->base.code) == INTEGER_CST) |
3159 | 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), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3159, __FUNCTION__))))) != global_trees[TI_ERROR_MARK] && (((contains_struct_check ((result), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3159, __FUNCTION__))->typed.type) == ((contains_struct_check (((*((const_cast<tree*> (tree_operand_check ((result), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3159, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3159, __FUNCTION__))->typed.type))) (result) = (*((const_cast <tree*> (tree_operand_check ((result), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3159, __FUNCTION__))))); |
3160 | } |
3161 | else |
3162 | result = build_call_array_loc (loc, TREE_TYPE (fntype)((contains_struct_check ((fntype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3162, __FUNCTION__))->typed.type), |
3163 | function, nargs, argarray); |
3164 | /* If -Wnonnull warning has been diagnosed, avoid diagnosing it again |
3165 | later. */ |
3166 | if (warned_p && TREE_CODE (result)((enum tree_code) (result)->base.code) == CALL_EXPR) |
3167 | TREE_NO_WARNING (result)((result)->base.nowarning_flag) = 1; |
3168 | |
3169 | /* In this improbable scenario, a nested function returns a VM type. |
3170 | Create a TARGET_EXPR so that the call always has a LHS, much as |
3171 | what the C++ FE does for functions returning non-PODs. */ |
3172 | if (variably_modified_type_p (TREE_TYPE (fntype)((contains_struct_check ((fntype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3172, __FUNCTION__))->typed.type), NULL_TREE(tree) __null)) |
3173 | { |
3174 | tree tmp = create_tmp_var_raw (TREE_TYPE (fntype)((contains_struct_check ((fntype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3174, __FUNCTION__))->typed.type)); |
3175 | result = build4 (TARGET_EXPR, TREE_TYPE (fntype)((contains_struct_check ((fntype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3175, __FUNCTION__))->typed.type), tmp, result, |
3176 | NULL_TREE(tree) __null, NULL_TREE(tree) __null); |
3177 | } |
3178 | |
3179 | if (VOID_TYPE_P (TREE_TYPE (result))(((enum tree_code) (((contains_struct_check ((result), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3179, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE )) |
3180 | { |
3181 | if (TYPE_QUALS (TREE_TYPE (result))((int) ((((tree_class_check ((((contains_struct_check ((result ), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3181, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3181, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((((contains_struct_check ((result), ( TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3181, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3181, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((((contains_struct_check ((result), ( TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3181, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3181, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((((contains_struct_check ((result), ( TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3181, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3181, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ) | (((((tree_class_check ((((contains_struct_check ((result) , (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3181, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3181, __FUNCTION__))->base.u.bits.address_space) & 0xFF ) << 8)))) != TYPE_UNQUALIFIED) |
3182 | pedwarn (loc, 0, |
3183 | "function with qualified void return type called"); |
3184 | return result; |
3185 | } |
3186 | return require_complete_type (loc, result); |
3187 | } |
3188 | |
3189 | /* Like build_function_call_vec, but call also resolve_overloaded_builtin. */ |
3190 | |
3191 | tree |
3192 | c_build_function_call_vec (location_t loc, vec<location_t> arg_loc, |
3193 | tree function, vec<tree, va_gc> *params, |
3194 | vec<tree, va_gc> *origtypes) |
3195 | { |
3196 | /* Strip NON_LVALUE_EXPRs, etc., since we aren't using as an lvalue. */ |
3197 | 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), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3197, __FUNCTION__))))) != global_trees[TI_ERROR_MARK] && (((contains_struct_check ((function), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3197, __FUNCTION__))->typed.type) == ((contains_struct_check (((*((const_cast<tree*> (tree_operand_check ((function ), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3197, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3197, __FUNCTION__))->typed.type))) (function) = (*((const_cast <tree*> (tree_operand_check ((function), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3197, __FUNCTION__))))); |
3198 | |
3199 | /* Convert anything with function type to a pointer-to-function. */ |
3200 | if (TREE_CODE (function)((enum tree_code) (function)->base.code) == FUNCTION_DECL) |
3201 | { |
3202 | /* Implement type-directed function overloading for builtins. |
3203 | resolve_overloaded_builtin and targetm.resolve_overloaded_builtin |
3204 | handle all the type checking. The result is a complete expression |
3205 | that implements this function call. */ |
3206 | tree tem = resolve_overloaded_builtin (loc, function, params); |
3207 | if (tem) |
3208 | return tem; |
3209 | } |
3210 | return build_function_call_vec (loc, arg_loc, function, params, origtypes); |
3211 | } |
3212 | |
3213 | /* Helper for convert_arguments called to convert the VALue of argument |
3214 | number ARGNUM from ORIGTYPE to the corresponding parameter number |
3215 | PARMNUM and TYPE. |
3216 | PLOC is the location where the conversion is being performed. |
3217 | FUNCTION and FUNDECL are the same as in convert_arguments. |
3218 | VALTYPE is the original type of VAL before the conversion and, |
3219 | for EXCESS_PRECISION_EXPR, the operand of the expression. |
3220 | NPC is true if VAL represents the null pointer constant (VAL itself |
3221 | will have been folded to an integer constant). |
3222 | RNAME is the same as FUNCTION except in Objective C when it's |
3223 | the function selector. |
3224 | EXCESS_PRECISION is true when VAL was originally represented |
3225 | as EXCESS_PRECISION_EXPR. |
3226 | WARNOPT is the same as in convert_for_assignment. */ |
3227 | |
3228 | static tree |
3229 | convert_argument (location_t ploc, tree function, tree fundecl, |
3230 | tree type, tree origtype, tree val, tree valtype, |
3231 | bool npc, tree rname, int parmnum, int argnum, |
3232 | bool excess_precision, int warnopt) |
3233 | { |
3234 | /* Formal parm type is specified by a function prototype. */ |
3235 | |
3236 | if (type == error_mark_nodeglobal_trees[TI_ERROR_MARK] || !COMPLETE_TYPE_P (type)(((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3236, __FUNCTION__))->type_common.size) != (tree) __null )) |
3237 | { |
3238 | error_at (ploc, "type of formal parameter %d is incomplete", |
3239 | parmnum + 1); |
3240 | return val; |
3241 | } |
3242 | |
3243 | /* Optionally warn about conversions that differ from the default |
3244 | conversions. */ |
3245 | if (warn_traditional_conversionglobal_options.x_warn_traditional_conversion || warn_traditionalglobal_options.x_warn_traditional) |
3246 | { |
3247 | unsigned int formal_prec = TYPE_PRECISION (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3247, __FUNCTION__))->type_common.precision); |
3248 | |
3249 | 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) |
3250 | && TREE_CODE (valtype)((enum tree_code) (valtype)->base.code) == REAL_TYPE) |
3251 | warning_at (ploc, OPT_Wtraditional_conversion, |
3252 | "passing argument %d of %qE as integer rather " |
3253 | "than floating due to prototype", |
3254 | argnum, rname); |
3255 | 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) |
3256 | && TREE_CODE (valtype)((enum tree_code) (valtype)->base.code) == COMPLEX_TYPE) |
3257 | warning_at (ploc, OPT_Wtraditional_conversion, |
3258 | "passing argument %d of %qE as integer rather " |
3259 | "than complex due to prototype", |
3260 | argnum, rname); |
3261 | else if (TREE_CODE (type)((enum tree_code) (type)->base.code) == COMPLEX_TYPE |
3262 | && TREE_CODE (valtype)((enum tree_code) (valtype)->base.code) == REAL_TYPE) |
3263 | warning_at (ploc, OPT_Wtraditional_conversion, |
3264 | "passing argument %d of %qE as complex rather " |
3265 | "than floating due to prototype", |
3266 | argnum, rname); |
3267 | else if (TREE_CODE (type)((enum tree_code) (type)->base.code) == REAL_TYPE |
3268 | && 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)) |
3269 | warning_at (ploc, OPT_Wtraditional_conversion, |
3270 | "passing argument %d of %qE as floating rather " |
3271 | "than integer due to prototype", |
3272 | argnum, rname); |
3273 | else if (TREE_CODE (type)((enum tree_code) (type)->base.code) == COMPLEX_TYPE |
3274 | && 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)) |
3275 | warning_at (ploc, OPT_Wtraditional_conversion, |
3276 | "passing argument %d of %qE as complex rather " |
3277 | "than integer due to prototype", |
3278 | argnum, rname); |
3279 | else if (TREE_CODE (type)((enum tree_code) (type)->base.code) == REAL_TYPE |
3280 | && TREE_CODE (valtype)((enum tree_code) (valtype)->base.code) == COMPLEX_TYPE) |
3281 | warning_at (ploc, OPT_Wtraditional_conversion, |
3282 | "passing argument %d of %qE as floating rather " |
3283 | "than complex due to prototype", |
3284 | argnum, rname); |
3285 | /* ??? At some point, messages should be written about |
3286 | conversions between complex types, but that's too messy |
3287 | to do now. */ |
3288 | else if (TREE_CODE (type)((enum tree_code) (type)->base.code) == REAL_TYPE |
3289 | && TREE_CODE (valtype)((enum tree_code) (valtype)->base.code) == REAL_TYPE) |
3290 | { |
3291 | /* Warn if any argument is passed as `float', |
3292 | since without a prototype it would be `double'. */ |
3293 | if (formal_prec == TYPE_PRECISION (float_type_node)((tree_class_check ((global_trees[TI_FLOAT_TYPE]), (tcc_type) , "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3293, __FUNCTION__))->type_common.precision) |
3294 | && type != dfloat32_type_nodeglobal_trees[TI_DFLOAT32_TYPE]) |
3295 | warning_at (ploc, 0, |
3296 | "passing argument %d of %qE as %<float%> " |
3297 | "rather than %<double%> due to prototype", |
3298 | argnum, rname); |
3299 | |
3300 | /* Warn if mismatch between argument and prototype |
3301 | for decimal float types. Warn of conversions with |
3302 | binary float types and of precision narrowing due to |
3303 | prototype. */ |
3304 | else if (type != valtype |
3305 | && (type == dfloat32_type_nodeglobal_trees[TI_DFLOAT32_TYPE] |
3306 | || type == dfloat64_type_nodeglobal_trees[TI_DFLOAT64_TYPE] |
3307 | || type == dfloat128_type_nodeglobal_trees[TI_DFLOAT128_TYPE] |
3308 | || valtype == dfloat32_type_nodeglobal_trees[TI_DFLOAT32_TYPE] |
3309 | || valtype == dfloat64_type_nodeglobal_trees[TI_DFLOAT64_TYPE] |
3310 | || valtype == dfloat128_type_nodeglobal_trees[TI_DFLOAT128_TYPE]) |
3311 | && (formal_prec |
3312 | <= TYPE_PRECISION (valtype)((tree_class_check ((valtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3312, __FUNCTION__))->type_common.precision) |
3313 | || (type == dfloat128_type_nodeglobal_trees[TI_DFLOAT128_TYPE] |
3314 | && (valtype |
3315 | != dfloat64_type_nodeglobal_trees[TI_DFLOAT64_TYPE] |
3316 | && (valtype |
3317 | != dfloat32_type_nodeglobal_trees[TI_DFLOAT32_TYPE]))) |
3318 | || (type == dfloat64_type_nodeglobal_trees[TI_DFLOAT64_TYPE] |
3319 | && (valtype |
3320 | != dfloat32_type_nodeglobal_trees[TI_DFLOAT32_TYPE])))) |
3321 | warning_at (ploc, 0, |
3322 | "passing argument %d of %qE as %qT " |
3323 | "rather than %qT due to prototype", |
3324 | argnum, rname, type, valtype); |
3325 | |
3326 | } |
3327 | /* Detect integer changing in width or signedness. |
3328 | These warnings are only activated with |
3329 | -Wtraditional-conversion, not with -Wtraditional. */ |
3330 | else if (warn_traditional_conversionglobal_options.x_warn_traditional_conversion |
3331 | && 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) |
3332 | && 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)) |
3333 | { |
3334 | tree would_have_been = default_conversion (val); |
3335 | tree type1 = TREE_TYPE (would_have_been)((contains_struct_check ((would_have_been), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3335, __FUNCTION__))->typed.type); |
3336 | |
3337 | if (val == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
3338 | /* VAL could have been of incomplete type. */; |
3339 | else if (TREE_CODE (type)((enum tree_code) (type)->base.code) == ENUMERAL_TYPE |
3340 | && (TYPE_MAIN_VARIANT (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3340, __FUNCTION__))->type_common.main_variant) |
3341 | == TYPE_MAIN_VARIANT (valtype)((tree_class_check ((valtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3341, __FUNCTION__))->type_common.main_variant))) |
3342 | /* No warning if function asks for enum |
3343 | and the actual arg is that enum type. */ |
3344 | ; |
3345 | else if (formal_prec != TYPE_PRECISION (type1)((tree_class_check ((type1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3345, __FUNCTION__))->type_common.precision)) |
3346 | warning_at (ploc, OPT_Wtraditional_conversion, |
3347 | "passing argument %d of %qE " |
3348 | "with different width due to prototype", |
3349 | argnum, rname); |
3350 | else if (TYPE_UNSIGNED (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3350, __FUNCTION__))->base.u.bits.unsigned_flag) == TYPE_UNSIGNED (type1)((tree_class_check ((type1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3350, __FUNCTION__))->base.u.bits.unsigned_flag)) |
3351 | ; |
3352 | /* Don't complain if the formal parameter type |
3353 | is an enum, because we can't tell now whether |
3354 | the value was an enum--even the same enum. */ |
3355 | else if (TREE_CODE (type)((enum tree_code) (type)->base.code) == ENUMERAL_TYPE) |
3356 | ; |
3357 | else if (TREE_CODE (val)((enum tree_code) (val)->base.code) == INTEGER_CST |
3358 | && int_fits_type_p (val, type)) |
3359 | /* Change in signedness doesn't matter |
3360 | if a constant value is unaffected. */ |
3361 | ; |
3362 | /* If the value is extended from a narrower |
3363 | unsigned type, it doesn't matter whether we |
3364 | pass it as signed or unsigned; the value |
3365 | certainly is the same either way. */ |
3366 | else if (TYPE_PRECISION (valtype)((tree_class_check ((valtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3366, __FUNCTION__))->type_common.precision) < TYPE_PRECISION (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3366, __FUNCTION__))->type_common.precision) |
3367 | && TYPE_UNSIGNED (valtype)((tree_class_check ((valtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3367, __FUNCTION__))->base.u.bits.unsigned_flag)) |
3368 | ; |
3369 | else if (TYPE_UNSIGNED (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3369, __FUNCTION__))->base.u.bits.unsigned_flag)) |
3370 | warning_at (ploc, OPT_Wtraditional_conversion, |
3371 | "passing argument %d of %qE " |
3372 | "as unsigned due to prototype", |
3373 | argnum, rname); |
3374 | else |
3375 | warning_at (ploc, OPT_Wtraditional_conversion, |
3376 | "passing argument %d of %qE " |
3377 | "as signed due to prototype", |
3378 | argnum, rname); |
3379 | } |
3380 | } |
3381 | |
3382 | /* Possibly restore an EXCESS_PRECISION_EXPR for the |
3383 | sake of better warnings from convert_and_check. */ |
3384 | if (excess_precision) |
3385 | val = build1 (EXCESS_PRECISION_EXPR, valtype, val); |
3386 | |
3387 | tree parmval = convert_for_assignment (ploc, ploc, type, |
3388 | val, origtype, ic_argpass, |
3389 | npc, fundecl, function, |
3390 | parmnum + 1, warnopt); |
3391 | |
3392 | if (targetm.calls.promote_prototypes (fundecl ? TREE_TYPE (fundecl)((contains_struct_check ((fundecl), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3392, __FUNCTION__))->typed.type) : 0) |
3393 | && 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) |
3394 | && (TYPE_PRECISION (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3394, __FUNCTION__))->type_common.precision) < TYPE_PRECISION (integer_type_node)((tree_class_check ((integer_types[itk_int]), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3394, __FUNCTION__))->type_common.precision))) |
3395 | parmval = default_conversion (parmval); |
3396 | |
3397 | return parmval; |
3398 | } |
3399 | |
3400 | /* Convert the argument expressions in the vector VALUES |
3401 | to the types in the list TYPELIST. |
3402 | |
3403 | If TYPELIST is exhausted, or when an element has NULL as its type, |
3404 | perform the default conversions. |
3405 | |
3406 | ORIGTYPES is the original types of the expressions in VALUES. This |
3407 | holds the type of enum values which have been converted to integral |
3408 | types. It may be NULL. |
3409 | |
3410 | FUNCTION is a tree for the called function. It is used only for |
3411 | error messages, where it is formatted with %qE. |
3412 | |
3413 | This is also where warnings about wrong number of args are generated. |
3414 | |
3415 | ARG_LOC are locations of function arguments (if any). |
3416 | |
3417 | Returns the actual number of arguments processed (which may be less |
3418 | than the length of VALUES in some error situations), or -1 on |
3419 | failure. */ |
3420 | |
3421 | static int |
3422 | convert_arguments (location_t loc, vec<location_t> arg_loc, tree typelist, |
3423 | vec<tree, va_gc> *values, vec<tree, va_gc> *origtypes, |
3424 | tree function, tree fundecl) |
3425 | { |
3426 | unsigned int parmnum; |
3427 | bool error_args = false; |
3428 | const bool type_generic = fundecl |
3429 | && lookup_attribute ("type generic", TYPE_ATTRIBUTES (TREE_TYPE (fundecl))((tree_class_check ((((contains_struct_check ((fundecl), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3429, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3429, __FUNCTION__))->type_common.attributes)); |
3430 | bool type_generic_remove_excess_precision = false; |
3431 | bool type_generic_overflow_p = false; |
3432 | tree selector; |
3433 | |
3434 | /* Change pointer to function to the function itself for |
3435 | diagnostics. */ |
3436 | if (TREE_CODE (function)((enum tree_code) (function)->base.code) == ADDR_EXPR |
3437 | && TREE_CODE (TREE_OPERAND (function, 0))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check ((function), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3437, __FUNCTION__))))))->base.code) == FUNCTION_DECL) |
3438 | function = TREE_OPERAND (function, 0)(*((const_cast<tree*> (tree_operand_check ((function), ( 0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3438, __FUNCTION__))))); |
3439 | |
3440 | /* Handle an ObjC selector specially for diagnostics. */ |
3441 | selector = objc_message_selector (); |
3442 | |
3443 | /* For a call to a built-in function declared without a prototype, |
3444 | set to the built-in function's argument list. */ |
3445 | tree builtin_typelist = NULL_TREE(tree) __null; |
3446 | |
3447 | /* For type-generic built-in functions, determine whether excess |
3448 | precision should be removed (classification) or not |
3449 | (comparison). */ |
3450 | if (fundecl |
3451 | && fndecl_built_in_p (fundecl, BUILT_IN_NORMAL)) |
3452 | { |
3453 | built_in_function code = DECL_FUNCTION_CODE (fundecl); |
3454 | if (C_DECL_BUILTIN_PROTOTYPE (fundecl)((contains_struct_check (((tree_check ((fundecl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3454, __FUNCTION__, (FUNCTION_DECL)))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3454, __FUNCTION__))->decl_common.lang_flag_6)) |
3455 | { |
3456 | /* For a call to a built-in function declared without a prototype |
3457 | use the types of the parameters of the internal built-in to |
3458 | match those of the arguments to. */ |
3459 | if (tree bdecl = builtin_decl_explicit (code)) |
3460 | builtin_typelist = TYPE_ARG_TYPES (TREE_TYPE (bdecl))((tree_check2 ((((contains_struct_check ((bdecl), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3460, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3460, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values); |
3461 | } |
3462 | |
3463 | /* For type-generic built-in functions, determine whether excess |
3464 | precision should be removed (classification) or not |
3465 | (comparison). */ |
3466 | if (type_generic) |
3467 | switch (code) |
3468 | { |
3469 | case BUILT_IN_ISFINITE: |
3470 | case BUILT_IN_ISINF: |
3471 | case BUILT_IN_ISINF_SIGN: |
3472 | case BUILT_IN_ISNAN: |
3473 | case BUILT_IN_ISNORMAL: |
3474 | case BUILT_IN_FPCLASSIFY: |
3475 | type_generic_remove_excess_precision = true; |
3476 | break; |
3477 | |
3478 | case BUILT_IN_ADD_OVERFLOW_P: |
3479 | case BUILT_IN_SUB_OVERFLOW_P: |
3480 | case BUILT_IN_MUL_OVERFLOW_P: |
3481 | /* The last argument of these type-generic builtins |
3482 | should not be promoted. */ |
3483 | type_generic_overflow_p = true; |
3484 | break; |
3485 | |
3486 | default: |
3487 | break; |
3488 | } |
3489 | } |
3490 | |
3491 | /* Scan the given expressions (VALUES) and types (TYPELIST), producing |
3492 | individual converted arguments. */ |
3493 | |
3494 | tree typetail, builtin_typetail, val; |
3495 | for (typetail = typelist, |
3496 | builtin_typetail = builtin_typelist, |
3497 | parmnum = 0; |
3498 | values && values->iterate (parmnum, &val); |
3499 | ++parmnum) |
3500 | { |
3501 | /* The type of the function parameter (if it was declared with one). */ |
3502 | tree type = typetail ? TREE_VALUE (typetail)((tree_check ((typetail), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3502, __FUNCTION__, (TREE_LIST)))->list.value) : NULL_TREE(tree) __null; |
3503 | /* The type of the built-in function parameter (if the function |
3504 | is a built-in). Used to detect type incompatibilities in |
3505 | calls to built-ins declared without a prototype. */ |
3506 | tree builtin_type = (builtin_typetail |
3507 | ? TREE_VALUE (builtin_typetail)((tree_check ((builtin_typetail), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3507, __FUNCTION__, (TREE_LIST)))->list.value) : NULL_TREE(tree) __null); |
3508 | /* The original type of the argument being passed to the function. */ |
3509 | tree valtype = TREE_TYPE (val)((contains_struct_check ((val), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3509, __FUNCTION__))->typed.type); |
3510 | /* The called function (or function selector in Objective C). */ |
3511 | tree rname = function; |
3512 | int argnum = parmnum + 1; |
3513 | const char *invalid_func_diag; |
3514 | /* Set for EXCESS_PRECISION_EXPR arguments. */ |
3515 | bool excess_precision = false; |
3516 | /* The value of the argument after conversion to the type |
3517 | of the function parameter it is passed to. */ |
3518 | tree parmval; |
3519 | /* Some __atomic_* builtins have additional hidden argument at |
3520 | position 0. */ |
3521 | location_t ploc |
3522 | = !arg_loc.is_empty () && values->length () == arg_loc.length () |
3523 | ? expansion_point_location_if_in_system_header (arg_loc[parmnum]) |
3524 | : input_location; |
3525 | |
3526 | if (type == void_type_nodeglobal_trees[TI_VOID_TYPE]) |
3527 | { |
3528 | if (selector) |
3529 | error_at (loc, "too many arguments to method %qE", selector); |
3530 | else |
3531 | error_at (loc, "too many arguments to function %qE", function); |
3532 | inform_declaration (fundecl); |
3533 | return error_args ? -1 : (int) parmnum; |
3534 | } |
3535 | |
3536 | if (builtin_type == void_type_nodeglobal_trees[TI_VOID_TYPE]) |
3537 | { |
3538 | if (warning_at (loc, OPT_Wbuiltin_declaration_mismatch, |
3539 | "too many arguments to built-in function %qE " |
3540 | "expecting %d", function, parmnum)) |
3541 | inform_declaration (fundecl); |
3542 | builtin_typetail = NULL_TREE(tree) __null; |
3543 | } |
3544 | |
3545 | if (selector && argnum > 2) |
3546 | { |
3547 | rname = selector; |
3548 | argnum -= 2; |
3549 | } |
3550 | |
3551 | /* Determine if VAL is a null pointer constant before folding it. */ |
3552 | bool npc = null_pointer_constant_p (val); |
3553 | |
3554 | /* If there is excess precision and a prototype, convert once to |
3555 | the required type rather than converting via the semantic |
3556 | type. Likewise without a prototype a float value represented |
3557 | as long double should be converted once to double. But for |
3558 | type-generic classification functions excess precision must |
3559 | be removed here. */ |
3560 | if (TREE_CODE (val)((enum tree_code) (val)->base.code) == EXCESS_PRECISION_EXPR |
3561 | && (type || !type_generic || !type_generic_remove_excess_precision)) |
3562 | { |
3563 | val = TREE_OPERAND (val, 0)(*((const_cast<tree*> (tree_operand_check ((val), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3563, __FUNCTION__))))); |
3564 | excess_precision = true; |
3565 | } |
3566 | val = c_fully_fold (val, false, NULL__null); |
3567 | 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), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3567, __FUNCTION__))))) != global_trees[TI_ERROR_MARK] && (((contains_struct_check ((val), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3567, __FUNCTION__))->typed.type) == ((contains_struct_check (((*((const_cast<tree*> (tree_operand_check ((val), (0 ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3567, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3567, __FUNCTION__))->typed.type))) (val) = (*((const_cast <tree*> (tree_operand_check ((val), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3567, __FUNCTION__))))); |
3568 | |
3569 | val = require_complete_type (ploc, val); |
3570 | |
3571 | /* Some floating-point arguments must be promoted to double when |
3572 | no type is specified by a prototype. This applies to |
3573 | arguments of type float, and to architecture-specific types |
3574 | (ARM __fp16), but not to _FloatN or _FloatNx types. */ |
3575 | bool promote_float_arg = false; |
3576 | if (type == NULL_TREE(tree) __null |
3577 | && TREE_CODE (valtype)((enum tree_code) (valtype)->base.code) == REAL_TYPE |
3578 | && (TYPE_PRECISION (valtype)((tree_class_check ((valtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3578, __FUNCTION__))->type_common.precision) |
3579 | <= TYPE_PRECISION (double_type_node)((tree_class_check ((global_trees[TI_DOUBLE_TYPE]), (tcc_type ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3579, __FUNCTION__))->type_common.precision)) |
3580 | && TYPE_MAIN_VARIANT (valtype)((tree_class_check ((valtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3580, __FUNCTION__))->type_common.main_variant) != double_type_nodeglobal_trees[TI_DOUBLE_TYPE] |
3581 | && TYPE_MAIN_VARIANT (valtype)((tree_class_check ((valtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3581, __FUNCTION__))->type_common.main_variant) != long_double_type_nodeglobal_trees[TI_LONG_DOUBLE_TYPE] |
3582 | && !DECIMAL_FLOAT_MODE_P (TYPE_MODE (valtype))(((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check ((valtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3582, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode (valtype) : (valtype)->type_common.mode)]) == MODE_DECIMAL_FLOAT )) |
3583 | { |
3584 | /* Promote this argument, unless it has a _FloatN or |
3585 | _FloatNx type. */ |
3586 | promote_float_arg = true; |
3587 | for (int i = 0; i < NUM_FLOATN_NX_TYPES(TI_FLOATN_NX_TYPE_LAST - TI_FLOATN_NX_TYPE_FIRST + 1); i++) |
3588 | if (TYPE_MAIN_VARIANT (valtype)((tree_class_check ((valtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3588, __FUNCTION__))->type_common.main_variant) == FLOATN_NX_TYPE_NODE (i)global_trees[TI_FLOATN_NX_TYPE_FIRST + (i)]) |
3589 | { |
3590 | promote_float_arg = false; |
3591 | break; |
3592 | } |
3593 | } |
3594 | |
3595 | if (type != NULL_TREE(tree) __null) |
3596 | { |
3597 | tree origtype = (!origtypes) ? NULL_TREE(tree) __null : (*origtypes)[parmnum]; |
3598 | parmval = convert_argument (ploc, function, fundecl, type, origtype, |
3599 | val, valtype, npc, rname, parmnum, argnum, |
3600 | excess_precision, 0); |
3601 | } |
3602 | else if (promote_float_arg) |
3603 | { |
3604 | if (type_generic) |
3605 | parmval = val; |
3606 | else |
3607 | { |
3608 | /* Convert `float' to `double'. */ |
3609 | if (warn_double_promotionglobal_options.x_warn_double_promotion && !c_inhibit_evaluation_warnings) |
3610 | warning_at (ploc, OPT_Wdouble_promotion, |
3611 | "implicit conversion from %qT to %qT when passing " |
3612 | "argument to function", |
3613 | valtype, double_type_nodeglobal_trees[TI_DOUBLE_TYPE]); |
3614 | parmval = convert (double_type_nodeglobal_trees[TI_DOUBLE_TYPE], val); |
3615 | } |
3616 | } |
3617 | else if ((excess_precision && !type_generic) |
3618 | || (type_generic_overflow_p && parmnum == 2)) |
3619 | /* A "double" argument with excess precision being passed |
3620 | without a prototype or in variable arguments. |
3621 | The last argument of __builtin_*_overflow_p should not be |
3622 | promoted. */ |
3623 | parmval = convert (valtype, val); |
3624 | else if ((invalid_func_diag = |
3625 | targetm.calls.invalid_arg_for_unprototyped_fn (typelist, fundecl, val))) |
3626 | { |
3627 | error (invalid_func_diag); |
3628 | return -1; |
3629 | } |
3630 | else if (TREE_CODE (val)((enum tree_code) (val)->base.code) == ADDR_EXPR && reject_gcc_builtin (val)) |
3631 | { |
3632 | return -1; |
3633 | } |
3634 | else |
3635 | /* Convert `short' and `char' to full-size `int'. */ |
3636 | parmval = default_conversion (val); |
3637 | |
3638 | (*values)[parmnum] = parmval; |
3639 | if (parmval == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
3640 | error_args = true; |
3641 | |
3642 | if (!type && builtin_type && TREE_CODE (builtin_type)((enum tree_code) (builtin_type)->base.code) != VOID_TYPE) |
3643 | { |
3644 | /* For a call to a built-in function declared without a prototype, |
3645 | perform the conversions from the argument to the expected type |
3646 | but issue warnings rather than errors for any mismatches. |
3647 | Ignore the converted argument and use the PARMVAL obtained |
3648 | above by applying default conversions instead. */ |
3649 | tree origtype = (!origtypes) ? NULL_TREE(tree) __null : (*origtypes)[parmnum]; |
3650 | convert_argument (ploc, function, fundecl, builtin_type, origtype, |
3651 | val, valtype, npc, rname, parmnum, argnum, |
3652 | excess_precision, |
3653 | OPT_Wbuiltin_declaration_mismatch); |
3654 | } |
3655 | |
3656 | if (typetail) |
3657 | typetail = TREE_CHAIN (typetail)((contains_struct_check ((typetail), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3657, __FUNCTION__))->common.chain); |
3658 | |
3659 | if (builtin_typetail) |
3660 | builtin_typetail = TREE_CHAIN (builtin_typetail)((contains_struct_check ((builtin_typetail), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3660, __FUNCTION__))->common.chain); |
3661 | } |
3662 | |
3663 | gcc_assert (parmnum == vec_safe_length (values))((void)(!(parmnum == vec_safe_length (values)) ? fancy_abort ( "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3663, __FUNCTION__), 0 : 0)); |
3664 | |
3665 | if (typetail != NULL_TREE(tree) __null && TREE_VALUE (typetail)((tree_check ((typetail), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3665, __FUNCTION__, (TREE_LIST)))->list.value) != void_type_nodeglobal_trees[TI_VOID_TYPE]) |
3666 | { |
3667 | error_at (loc, "too few arguments to function %qE", function); |
3668 | inform_declaration (fundecl); |
3669 | return -1; |
3670 | } |
3671 | |
3672 | if (builtin_typetail && TREE_VALUE (builtin_typetail)((tree_check ((builtin_typetail), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3672, __FUNCTION__, (TREE_LIST)))->list.value) != void_type_nodeglobal_trees[TI_VOID_TYPE]) |
3673 | { |
3674 | unsigned nargs = parmnum; |
3675 | for (tree t = builtin_typetail; t; t = TREE_CHAIN (t)((contains_struct_check ((t), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3675, __FUNCTION__))->common.chain)) |
3676 | ++nargs; |
3677 | |
3678 | if (warning_at (loc, OPT_Wbuiltin_declaration_mismatch, |
3679 | "too few arguments to built-in function %qE " |
3680 | "expecting %u", function, nargs - 1)) |
3681 | inform_declaration (fundecl); |
3682 | } |
3683 | |
3684 | return error_args ? -1 : (int) parmnum; |
3685 | } |
3686 | |
3687 | /* This is the entry point used by the parser to build unary operators |
3688 | in the input. CODE, a tree_code, specifies the unary operator, and |
3689 | ARG is the operand. For unary plus, the C parser currently uses |
3690 | CONVERT_EXPR for code. |
3691 | |
3692 | LOC is the location to use for the tree generated. |
3693 | */ |
3694 | |
3695 | struct c_expr |
3696 | parser_build_unary_op (location_t loc, enum tree_code code, struct c_expr arg) |
3697 | { |
3698 | struct c_expr result; |
3699 | |
3700 | result.original_code = code; |
3701 | result.original_type = NULL__null; |
3702 | |
3703 | if (reject_gcc_builtin (arg.value)) |
3704 | { |
3705 | result.value = error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
3706 | } |
3707 | else |
3708 | { |
3709 | result.value = build_unary_op (loc, code, arg.value, false); |
3710 | |
3711 | if (TREE_OVERFLOW_P (result.value)((tree_code_type[(int) (((enum tree_code) (result.value)-> base.code))] == tcc_constant) && ((tree_class_check ( (result.value), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3711, __FUNCTION__))->base.public_flag)) && !TREE_OVERFLOW_P (arg.value)((tree_code_type[(int) (((enum tree_code) (arg.value)->base .code))] == tcc_constant) && ((tree_class_check ((arg .value), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3711, __FUNCTION__))->base.public_flag))) |
3712 | overflow_warning (loc, result.value, arg.value); |
3713 | } |
3714 | |
3715 | /* We are typically called when parsing a prefix token at LOC acting on |
3716 | ARG. Reflect this by updating the source range of the result to |
3717 | start at LOC and end at the end of ARG. */ |
3718 | set_c_expr_source_range (&result, |
3719 | loc, arg.get_finish ()); |
3720 | |
3721 | return result; |
3722 | } |
3723 | |
3724 | /* Returns true if TYPE is a character type, *not* including wchar_t. */ |
3725 | |
3726 | bool |
3727 | char_type_p (tree type) |
3728 | { |
3729 | return (type == char_type_nodeinteger_types[itk_char] |
3730 | || type == unsigned_char_type_nodeinteger_types[itk_unsigned_char] |
3731 | || type == signed_char_type_nodeinteger_types[itk_signed_char] |
3732 | || type == char16_type_nodec_global_trees[CTI_CHAR16_TYPE] |
3733 | || type == char32_type_nodec_global_trees[CTI_CHAR32_TYPE]); |
3734 | } |
3735 | |
3736 | /* This is the entry point used by the parser to build binary operators |
3737 | in the input. CODE, a tree_code, specifies the binary operator, and |
3738 | ARG1 and ARG2 are the operands. In addition to constructing the |
3739 | expression, we check for operands that were written with other binary |
3740 | operators in a way that is likely to confuse the user. |
3741 | |
3742 | LOCATION is the location of the binary operator. */ |
3743 | |
3744 | struct c_expr |
3745 | parser_build_binary_op (location_t location, enum tree_code code, |
3746 | struct c_expr arg1, struct c_expr arg2) |
3747 | { |
3748 | struct c_expr result; |
3749 | |
3750 | enum tree_code code1 = arg1.original_code; |
3751 | enum tree_code code2 = arg2.original_code; |
3752 | tree type1 = (arg1.original_type |
3753 | ? arg1.original_type |
3754 | : TREE_TYPE (arg1.value)((contains_struct_check ((arg1.value), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3754, __FUNCTION__))->typed.type)); |
3755 | tree type2 = (arg2.original_type |
3756 | ? arg2.original_type |
3757 | : TREE_TYPE (arg2.value)((contains_struct_check ((arg2.value), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3757, __FUNCTION__))->typed.type)); |
3758 | |
3759 | result.value = build_binary_op (location, code, |
3760 | arg1.value, arg2.value, true); |
3761 | result.original_code = code; |
3762 | result.original_type = NULL__null; |
3763 | |
3764 | if (TREE_CODE (result.value)((enum tree_code) (result.value)->base.code) == ERROR_MARK) |
3765 | { |
3766 | set_c_expr_source_range (&result, |
3767 | arg1.get_start (), |
3768 | arg2.get_finish ()); |
3769 | return result; |
3770 | } |
3771 | |
3772 | if (location != UNKNOWN_LOCATION((location_t) 0)) |
3773 | protected_set_expr_location (result.value, location); |
3774 | |
3775 | set_c_expr_source_range (&result, |
3776 | arg1.get_start (), |
3777 | arg2.get_finish ()); |
3778 | |
3779 | /* Check for cases such as x+y<<z which users are likely |
3780 | to misinterpret. */ |
3781 | if (warn_parenthesesglobal_options.x_warn_parentheses) |
3782 | warn_about_parentheses (location, code, code1, arg1.value, code2, |
3783 | arg2.value); |
3784 | |
3785 | if (warn_logical_opglobal_options.x_warn_logical_op) |
3786 | warn_logical_operator (location, code, TREE_TYPE (result.value)((contains_struct_check ((result.value), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3786, __FUNCTION__))->typed.type), |
3787 | code1, arg1.value, code2, arg2.value); |
3788 | |
3789 | if (warn_tautological_compareglobal_options.x_warn_tautological_compare) |
3790 | { |
3791 | tree lhs = arg1.value; |
3792 | tree rhs = arg2.value; |
3793 | if (TREE_CODE (lhs)((enum tree_code) (lhs)->base.code) == C_MAYBE_CONST_EXPR) |
3794 | { |
3795 | if (C_MAYBE_CONST_EXPR_PRE (lhs)(*((const_cast<tree*> (tree_operand_check (((tree_check ((lhs), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3795, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3795, __FUNCTION__))))) != NULL_TREE(tree) __null |
3796 | && TREE_SIDE_EFFECTS (C_MAYBE_CONST_EXPR_PRE (lhs))((non_type_check (((*((const_cast<tree*> (tree_operand_check (((tree_check ((lhs), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3796, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3796, __FUNCTION__)))))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3796, __FUNCTION__))->base.side_effects_flag)) |
3797 | lhs = NULL_TREE(tree) __null; |
3798 | else |
3799 | lhs = C_MAYBE_CONST_EXPR_EXPR (lhs)(*((const_cast<tree*> (tree_operand_check (((tree_check ((lhs), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3799, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3799, __FUNCTION__))))); |
3800 | } |
3801 | if (TREE_CODE (rhs)((enum tree_code) (rhs)->base.code) == C_MAYBE_CONST_EXPR) |
3802 | { |
3803 | if (C_MAYBE_CONST_EXPR_PRE (rhs)(*((const_cast<tree*> (tree_operand_check (((tree_check ((rhs), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3803, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3803, __FUNCTION__))))) != NULL_TREE(tree) __null |
3804 | && TREE_SIDE_EFFECTS (C_MAYBE_CONST_EXPR_PRE (rhs))((non_type_check (((*((const_cast<tree*> (tree_operand_check (((tree_check ((rhs), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3804, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3804, __FUNCTION__)))))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3804, __FUNCTION__))->base.side_effects_flag)) |
3805 | rhs = NULL_TREE(tree) __null; |
3806 | else |
3807 | rhs = C_MAYBE_CONST_EXPR_EXPR (rhs)(*((const_cast<tree*> (tree_operand_check (((tree_check ((rhs), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3807, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3807, __FUNCTION__))))); |
3808 | } |
3809 | if (lhs != NULL_TREE(tree) __null && rhs != NULL_TREE(tree) __null) |
3810 | warn_tautological_cmp (location, code, lhs, rhs); |
3811 | } |
3812 | |
3813 | if (warn_logical_not_parenglobal_options.x_warn_logical_not_paren |
3814 | && TREE_CODE_CLASS (code)tree_code_type[(int) (code)] == tcc_comparison |
3815 | && code1 == TRUTH_NOT_EXPR |
3816 | && code2 != TRUTH_NOT_EXPR |
3817 | /* Avoid warning for !!x == y. */ |
3818 | && (TREE_CODE (arg1.value)((enum tree_code) (arg1.value)->base.code) != NE_EXPR |
3819 | || !integer_zerop (TREE_OPERAND (arg1.value, 1)(*((const_cast<tree*> (tree_operand_check ((arg1.value) , (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3819, __FUNCTION__)))))))) |
3820 | { |
3821 | /* Avoid warning for !b == y where b has _Bool type. */ |
3822 | tree t = integer_zero_nodeglobal_trees[TI_INTEGER_ZERO]; |
3823 | if (TREE_CODE (arg1.value)((enum tree_code) (arg1.value)->base.code) == EQ_EXPR |
3824 | && integer_zerop (TREE_OPERAND (arg1.value, 1)(*((const_cast<tree*> (tree_operand_check ((arg1.value) , (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3824, __FUNCTION__)))))) |
3825 | && TREE_TYPE (TREE_OPERAND (arg1.value, 0))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check ((arg1.value), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3825, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3825, __FUNCTION__))->typed.type) == integer_type_nodeinteger_types[itk_int]) |
3826 | { |
3827 | t = TREE_OPERAND (arg1.value, 0)(*((const_cast<tree*> (tree_operand_check ((arg1.value) , (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3827, __FUNCTION__))))); |
3828 | do |
3829 | { |
3830 | if (TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3830, __FUNCTION__))->typed.type) != integer_type_nodeinteger_types[itk_int]) |
3831 | break; |
3832 | if (TREE_CODE (t)((enum tree_code) (t)->base.code) == C_MAYBE_CONST_EXPR) |
3833 | t = C_MAYBE_CONST_EXPR_EXPR (t)(*((const_cast<tree*> (tree_operand_check (((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3833, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3833, __FUNCTION__))))); |
3834 | else if (CONVERT_EXPR_P (t)((((enum tree_code) (t)->base.code)) == NOP_EXPR || (((enum tree_code) (t)->base.code)) == CONVERT_EXPR)) |
3835 | t = TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3835, __FUNCTION__))))); |
3836 | else |
3837 | break; |
3838 | } |
3839 | while (1); |
3840 | } |
3841 | if (TREE_CODE (TREE_TYPE (t))((enum tree_code) (((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3841, __FUNCTION__))->typed.type))->base.code) != BOOLEAN_TYPE) |
3842 | warn_logical_not_parentheses (location, code, arg1.value, arg2.value); |
3843 | } |
3844 | |
3845 | /* Warn about comparisons against string literals, with the exception |
3846 | of testing for equality or inequality of a string literal with NULL. */ |
3847 | if (code == EQ_EXPR || code == NE_EXPR) |
3848 | { |
3849 | if ((code1 == STRING_CST |
3850 | && !integer_zerop (tree_strip_nop_conversions (arg2.value))) |
3851 | || (code2 == STRING_CST |
3852 | && !integer_zerop (tree_strip_nop_conversions (arg1.value)))) |
3853 | warning_at (location, OPT_Waddress, |
3854 | "comparison with string literal results in unspecified behavior"); |
3855 | /* Warn for ptr == '\0', it's likely that it should've been ptr[0]. */ |
3856 | if (POINTER_TYPE_P (type1)(((enum tree_code) (type1)->base.code) == POINTER_TYPE || ( (enum tree_code) (type1)->base.code) == REFERENCE_TYPE) |
3857 | && null_pointer_constant_p (arg2.value) |
3858 | && char_type_p (type2)) |
3859 | { |
3860 | auto_diagnostic_group d; |
3861 | if (warning_at (location, OPT_Wpointer_compare, |
3862 | "comparison between pointer and zero character " |
3863 | "constant")) |
3864 | inform (arg1.get_start (), |
3865 | "did you mean to dereference the pointer?"); |
3866 | } |
3867 | else if (POINTER_TYPE_P (type2)(((enum tree_code) (type2)->base.code) == POINTER_TYPE || ( (enum tree_code) (type2)->base.code) == REFERENCE_TYPE) |
3868 | && null_pointer_constant_p (arg1.value) |
3869 | && char_type_p (type1)) |
3870 | { |
3871 | auto_diagnostic_group d; |
3872 | if (warning_at (location, OPT_Wpointer_compare, |
3873 | "comparison between pointer and zero character " |
3874 | "constant")) |
3875 | inform (arg2.get_start (), |
3876 | "did you mean to dereference the pointer?"); |
3877 | } |
3878 | } |
3879 | else if (TREE_CODE_CLASS (code)tree_code_type[(int) (code)] == tcc_comparison |
3880 | && (code1 == STRING_CST || code2 == STRING_CST)) |
3881 | warning_at (location, OPT_Waddress, |
3882 | "comparison with string literal results in unspecified behavior"); |
3883 | |
3884 | if (TREE_OVERFLOW_P (result.value)((tree_code_type[(int) (((enum tree_code) (result.value)-> base.code))] == tcc_constant) && ((tree_class_check ( (result.value), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3884, __FUNCTION__))->base.public_flag)) |
3885 | && !TREE_OVERFLOW_P (arg1.value)((tree_code_type[(int) (((enum tree_code) (arg1.value)->base .code))] == tcc_constant) && ((tree_class_check ((arg1 .value), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3885, __FUNCTION__))->base.public_flag)) |
3886 | && !TREE_OVERFLOW_P (arg2.value)((tree_code_type[(int) (((enum tree_code) (arg2.value)->base .code))] == tcc_constant) && ((tree_class_check ((arg2 .value), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3886, __FUNCTION__))->base.public_flag))) |
3887 | overflow_warning (location, result.value); |
3888 | |
3889 | /* Warn about comparisons of different enum types. */ |
3890 | if (warn_enum_compareglobal_options.x_warn_enum_compare |
3891 | && TREE_CODE_CLASS (code)tree_code_type[(int) (code)] == tcc_comparison |
3892 | && TREE_CODE (type1)((enum tree_code) (type1)->base.code) == ENUMERAL_TYPE |
3893 | && TREE_CODE (type2)((enum tree_code) (type2)->base.code) == ENUMERAL_TYPE |
3894 | && TYPE_MAIN_VARIANT (type1)((tree_class_check ((type1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3894, __FUNCTION__))->type_common.main_variant) != TYPE_MAIN_VARIANT (type2)((tree_class_check ((type2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3894, __FUNCTION__))->type_common.main_variant)) |
3895 | warning_at (location, OPT_Wenum_compare, |
3896 | "comparison between %qT and %qT", |
3897 | type1, type2); |
3898 | |
3899 | return result; |
3900 | } |
3901 | |
3902 | /* Return a tree for the difference of pointers OP0 and OP1. |
3903 | The resulting tree has type ptrdiff_t. If POINTER_SUBTRACT sanitization is |
3904 | enabled, assign to INSTRUMENT_EXPR call to libsanitizer. */ |
3905 | |
3906 | static tree |
3907 | pointer_diff (location_t loc, tree op0, tree op1, tree *instrument_expr) |
3908 | { |
3909 | tree restype = ptrdiff_type_nodeglobal_trees[TI_PTRDIFF_TYPE]; |
3910 | tree result, inttype; |
3911 | |
3912 | addr_space_t as0 = TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (op0)))((tree_class_check ((((contains_struct_check ((((contains_struct_check ((op0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3912, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3912, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3912, __FUNCTION__))->base.u.bits.address_space); |
3913 | addr_space_t as1 = TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (op1)))((tree_class_check ((((contains_struct_check ((((contains_struct_check ((op1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3913, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3913, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3913, __FUNCTION__))->base.u.bits.address_space); |
3914 | tree target_type = TREE_TYPE (TREE_TYPE (op0))((contains_struct_check ((((contains_struct_check ((op0), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3914, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3914, __FUNCTION__))->typed.type); |
3915 | tree orig_op0 = op0; |
3916 | tree orig_op1 = op1; |
3917 | |
3918 | /* If the operands point into different address spaces, we need to |
3919 | explicitly convert them to pointers into the common address space |
3920 | before we can subtract the numerical address values. */ |
3921 | if (as0 != as1) |
3922 | { |
3923 | addr_space_t as_common; |
3924 | tree common_type; |
3925 | |
3926 | /* Determine the common superset address space. This is guaranteed |
3927 | to exist because the caller verified that comp_target_types |
3928 | returned non-zero. */ |
3929 | if (!addr_space_superset (as0, as1, &as_common)) |
3930 | gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3930, __FUNCTION__)); |
3931 | |
3932 | common_type = common_pointer_type (TREE_TYPE (op0)((contains_struct_check ((op0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3932, __FUNCTION__))->typed.type), TREE_TYPE (op1)((contains_struct_check ((op1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3932, __FUNCTION__))->typed.type)); |
3933 | op0 = convert (common_type, op0); |
3934 | op1 = convert (common_type, op1); |
3935 | } |
3936 | |
3937 | /* Determine integer type result of the subtraction. This will usually |
3938 | be the same as the result type (ptrdiff_t), but may need to be a wider |
3939 | type if pointers for the address space are wider than ptrdiff_t. */ |
3940 | if (TYPE_PRECISION (restype)((tree_class_check ((restype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3940, __FUNCTION__))->type_common.precision) < TYPE_PRECISION (TREE_TYPE (op0))((tree_class_check ((((contains_struct_check ((op0), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3940, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3940, __FUNCTION__))->type_common.precision)) |
3941 | inttype = c_common_type_for_size (TYPE_PRECISION (TREE_TYPE (op0))((tree_class_check ((((contains_struct_check ((op0), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3941, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3941, __FUNCTION__))->type_common.precision), 0); |
3942 | else |
3943 | inttype = restype; |
3944 | |
3945 | if (TREE_CODE (target_type)((enum tree_code) (target_type)->base.code) == VOID_TYPE) |
3946 | pedwarn (loc, OPT_Wpointer_arith, |
3947 | "pointer of type %<void *%> used in subtraction"); |
3948 | if (TREE_CODE (target_type)((enum tree_code) (target_type)->base.code) == FUNCTION_TYPE) |
3949 | pedwarn (loc, OPT_Wpointer_arith, |
3950 | "pointer to a function used in subtraction"); |
3951 | |
3952 | if (current_function_decl != NULL_TREE(tree) __null |
3953 | && sanitize_flags_p (SANITIZE_POINTER_SUBTRACT)) |
3954 | { |
3955 | op0 = save_expr (op0); |
3956 | op1 = save_expr (op1); |
3957 | |
3958 | tree tt = builtin_decl_explicit (BUILT_IN_ASAN_POINTER_SUBTRACT); |
3959 | *instrument_expr = build_call_expr_loc (loc, tt, 2, op0, op1); |
3960 | } |
3961 | |
3962 | /* First do the subtraction, then build the divide operator |
3963 | and only convert at the very end. |
3964 | Do not do default conversions in case restype is a short type. */ |
3965 | |
3966 | /* POINTER_DIFF_EXPR requires a signed integer type of the same size as |
3967 | pointers. If some platform cannot provide that, or has a larger |
3968 | ptrdiff_type to support differences larger than half the address |
3969 | space, cast the pointers to some larger integer type and do the |
3970 | computations in that type. */ |
3971 | if (TYPE_PRECISION (inttype)((tree_class_check ((inttype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3971, __FUNCTION__))->type_common.precision) > TYPE_PRECISION (TREE_TYPE (op0))((tree_class_check ((((contains_struct_check ((op0), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3971, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3971, __FUNCTION__))->type_common.precision)) |
3972 | op0 = build_binary_op (loc, MINUS_EXPR, convert (inttype, op0), |
3973 | convert (inttype, op1), false); |
3974 | else |
3975 | { |
3976 | /* Cast away qualifiers. */ |
3977 | op0 = convert (c_common_type (TREE_TYPE (op0)((contains_struct_check ((op0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3977, __FUNCTION__))->typed.type), TREE_TYPE (op0)((contains_struct_check ((op0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3977, __FUNCTION__))->typed.type)), op0); |
3978 | op1 = convert (c_common_type (TREE_TYPE (op1)((contains_struct_check ((op1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3978, __FUNCTION__))->typed.type), TREE_TYPE (op1)((contains_struct_check ((op1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3978, __FUNCTION__))->typed.type)), op1); |
3979 | op0 = build2_loc (loc, POINTER_DIFF_EXPR, inttype, op0, op1); |
3980 | } |
3981 | |
3982 | /* This generates an error if op1 is pointer to incomplete type. */ |
3983 | 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), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3983, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3983, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3983, __FUNCTION__))->type_common.size) != (tree) __null ) || (((enum tree_code) (((contains_struct_check ((((contains_struct_check ((orig_op1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3983, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3983, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE ))) |
3984 | error_at (loc, "arithmetic on pointer to an incomplete type"); |
3985 | else if (verify_type_context (loc, TCTX_POINTER_ARITH, |
3986 | TREE_TYPE (TREE_TYPE (orig_op0))((contains_struct_check ((((contains_struct_check ((orig_op0) , (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3986, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3986, __FUNCTION__))->typed.type))) |
3987 | verify_type_context (loc, TCTX_POINTER_ARITH, |
3988 | TREE_TYPE (TREE_TYPE (orig_op1))((contains_struct_check ((((contains_struct_check ((orig_op1) , (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3988, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3988, __FUNCTION__))->typed.type)); |
3989 | |
3990 | op1 = c_size_in_bytes (target_type); |
3991 | |
3992 | if (pointer_to_zero_sized_aggr_p (TREE_TYPE (orig_op1)((contains_struct_check ((orig_op1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 3992, __FUNCTION__))->typed.type))) |
3993 | error_at (loc, "arithmetic on pointer to an empty aggregate"); |
3994 | |
3995 | /* Divide by the size, in easiest possible way. */ |
3996 | result = fold_build2_loc (loc, EXACT_DIV_EXPR, inttype, |
3997 | op0, convert (inttype, op1)); |
3998 | |
3999 | /* Convert to final result type if necessary. */ |
4000 | return convert (restype, result); |
4001 | } |
4002 | |
4003 | /* Expand atomic compound assignments into an appropriate sequence as |
4004 | specified by the C11 standard section 6.5.16.2. |
4005 | |
4006 | _Atomic T1 E1 |
4007 | T2 E2 |
4008 | E1 op= E2 |
4009 | |
4010 | This sequence is used for all types for which these operations are |
4011 | supported. |
4012 | |
4013 | In addition, built-in versions of the 'fe' prefixed routines may |
4014 | need to be invoked for floating point (real, complex or vector) when |
4015 | floating-point exceptions are supported. See 6.5.16.2 footnote 113. |
4016 | |
4017 | T1 newval; |
4018 | T1 old; |
4019 | T1 *addr |
4020 | T2 val |
4021 | fenv_t fenv |
4022 | |
4023 | addr = &E1; |
4024 | val = (E2); |
4025 | __atomic_load (addr, &old, SEQ_CST); |
4026 | feholdexcept (&fenv); |
4027 | loop: |
4028 | newval = old op val; |
4029 | if (__atomic_compare_exchange_strong (addr, &old, &newval, SEQ_CST, |
4030 | SEQ_CST)) |
4031 | goto done; |
4032 | feclearexcept (FE_ALL_EXCEPT); |
4033 | goto loop: |
4034 | done: |
4035 | feupdateenv (&fenv); |
4036 | |
4037 | The compiler will issue the __atomic_fetch_* built-in when possible, |
4038 | otherwise it will generate the generic form of the atomic operations. |
4039 | This requires temp(s) and has their address taken. The atomic processing |
4040 | is smart enough to figure out when the size of an object can utilize |
4041 | a lock-free version, and convert the built-in call to the appropriate |
4042 | lock-free routine. The optimizers will then dispose of any temps that |
4043 | are no longer required, and lock-free implementations are utilized as |
4044 | long as there is target support for the required size. |
4045 | |
4046 | If the operator is NOP_EXPR, then this is a simple assignment, and |
4047 | an __atomic_store is issued to perform the assignment rather than |
4048 | the above loop. */ |
4049 | |
4050 | /* Build an atomic assignment at LOC, expanding into the proper |
4051 | sequence to store LHS MODIFYCODE= RHS. Return a value representing |
4052 | the result of the operation, unless RETURN_OLD_P, in which case |
4053 | return the old value of LHS (this is only for postincrement and |
4054 | postdecrement). */ |
4055 | |
4056 | static tree |
4057 | build_atomic_assign (location_t loc, tree lhs, enum tree_code modifycode, |
4058 | tree rhs, bool return_old_p) |
4059 | { |
4060 | tree fndecl, func_call; |
4061 | vec<tree, va_gc> *params; |
4062 | tree val, nonatomic_lhs_type, nonatomic_rhs_type, newval, newval_addr; |
4063 | tree old, old_addr; |
4064 | tree compound_stmt; |
4065 | tree stmt, goto_stmt; |
4066 | tree loop_label, loop_decl, done_label, done_decl; |
4067 | |
4068 | tree lhs_type = TREE_TYPE (lhs)((contains_struct_check ((lhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4068, __FUNCTION__))->typed.type); |
4069 | tree lhs_addr = build_unary_op (loc, ADDR_EXPR, lhs, false); |
4070 | tree seq_cst = build_int_cst (integer_type_nodeinteger_types[itk_int], MEMMODEL_SEQ_CST); |
4071 | tree rhs_semantic_type = TREE_TYPE (rhs)((contains_struct_check ((rhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4071, __FUNCTION__))->typed.type); |
4072 | tree nonatomic_rhs_semantic_type; |
4073 | tree rhs_type; |
4074 | |
4075 | gcc_assert (TYPE_ATOMIC (lhs_type))((void)(!(((tree_class_check ((lhs_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4075, __FUNCTION__))->base.u.bits.atomic_flag)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4075, __FUNCTION__), 0 : 0)); |
4076 | |
4077 | if (return_old_p) |
4078 | gcc_assert (modifycode == PLUS_EXPR || modifycode == MINUS_EXPR)((void)(!(modifycode == PLUS_EXPR || modifycode == MINUS_EXPR ) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4078, __FUNCTION__), 0 : 0)); |
4079 | |
4080 | /* Allocate enough vector items for a compare_exchange. */ |
4081 | vec_alloc (params, 6); |
4082 | |
4083 | /* Create a compound statement to hold the sequence of statements |
4084 | with a loop. */ |
4085 | compound_stmt = c_begin_compound_stmt (false); |
4086 | |
4087 | /* Remove any excess precision (which is only present here in the |
4088 | case of compound assignments). */ |
4089 | if (TREE_CODE (rhs)((enum tree_code) (rhs)->base.code) == EXCESS_PRECISION_EXPR) |
4090 | { |
4091 | gcc_assert (modifycode != NOP_EXPR)((void)(!(modifycode != NOP_EXPR) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4091, __FUNCTION__), 0 : 0)); |
4092 | rhs = TREE_OPERAND (rhs, 0)(*((const_cast<tree*> (tree_operand_check ((rhs), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4092, __FUNCTION__))))); |
4093 | } |
4094 | rhs_type = TREE_TYPE (rhs)((contains_struct_check ((rhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4094, __FUNCTION__))->typed.type); |
4095 | |
4096 | /* Fold the RHS if it hasn't already been folded. */ |
4097 | if (modifycode != NOP_EXPR) |
4098 | rhs = c_fully_fold (rhs, false, NULL__null); |
4099 | |
4100 | /* Remove the qualifiers for the rest of the expressions and create |
4101 | the VAL temp variable to hold the RHS. */ |
4102 | nonatomic_lhs_type = build_qualified_type (lhs_type, TYPE_UNQUALIFIED); |
4103 | nonatomic_rhs_type = build_qualified_type (rhs_type, TYPE_UNQUALIFIED); |
4104 | nonatomic_rhs_semantic_type = build_qualified_type (rhs_semantic_type, |
4105 | TYPE_UNQUALIFIED); |
4106 | val = create_tmp_var_raw (nonatomic_rhs_type); |
4107 | TREE_ADDRESSABLE (val)((val)->base.addressable_flag) = 1; |
4108 | TREE_NO_WARNING (val)((val)->base.nowarning_flag) = 1; |
4109 | rhs = build4 (TARGET_EXPR, nonatomic_rhs_type, val, rhs, NULL_TREE(tree) __null, |
4110 | NULL_TREE(tree) __null); |
4111 | SET_EXPR_LOCATION (rhs, loc)(expr_check (((rhs)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4111, __FUNCTION__))->exp.locus = (loc); |
4112 | add_stmt (rhs); |
4113 | |
4114 | /* NOP_EXPR indicates it's a straight store of the RHS. Simply issue |
4115 | an atomic_store. */ |
4116 | if (modifycode == NOP_EXPR) |
4117 | { |
4118 | /* Build __atomic_store (&lhs, &val, SEQ_CST) */ |
4119 | rhs = build_unary_op (loc, ADDR_EXPR, val, false); |
4120 | fndecl = builtin_decl_explicit (BUILT_IN_ATOMIC_STORE); |
4121 | params->quick_push (lhs_addr); |
4122 | params->quick_push (rhs); |
4123 | params->quick_push (seq_cst); |
4124 | func_call = c_build_function_call_vec (loc, vNULL, fndecl, params, NULL__null); |
4125 | add_stmt (func_call); |
4126 | |
4127 | /* Finish the compound statement. */ |
4128 | compound_stmt = c_end_compound_stmt (loc, compound_stmt, false); |
4129 | |
4130 | /* VAL is the value which was stored, return a COMPOUND_STMT of |
4131 | the statement and that value. */ |
4132 | return build2 (COMPOUND_EXPR, nonatomic_lhs_type, compound_stmt, val); |
4133 | } |
4134 | |
4135 | /* Attempt to implement the atomic operation as an __atomic_fetch_* or |
4136 | __atomic_*_fetch built-in rather than a CAS loop. atomic_bool type |
4137 | isn't applicable for such builtins. ??? Do we want to handle enums? */ |
4138 | 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 )) |
4139 | && TREE_CODE (rhs_type)((enum tree_code) (rhs_type)->base.code) == INTEGER_TYPE) |
4140 | { |
4141 | built_in_function fncode; |
4142 | switch (modifycode) |
4143 | { |
4144 | case PLUS_EXPR: |
4145 | case POINTER_PLUS_EXPR: |
4146 | fncode = (return_old_p |
4147 | ? BUILT_IN_ATOMIC_FETCH_ADD_N |
4148 | : BUILT_IN_ATOMIC_ADD_FETCH_N); |
4149 | break; |
4150 | case MINUS_EXPR: |
4151 | fncode = (return_old_p |
4152 | ? BUILT_IN_ATOMIC_FETCH_SUB_N |
4153 | : BUILT_IN_ATOMIC_SUB_FETCH_N); |
4154 | break; |
4155 | case BIT_AND_EXPR: |
4156 | fncode = (return_old_p |
4157 | ? BUILT_IN_ATOMIC_FETCH_AND_N |
4158 | : BUILT_IN_ATOMIC_AND_FETCH_N); |
4159 | break; |
4160 | case BIT_IOR_EXPR: |
4161 | fncode = (return_old_p |
4162 | ? BUILT_IN_ATOMIC_FETCH_OR_N |
4163 | : BUILT_IN_ATOMIC_OR_FETCH_N); |
4164 | break; |
4165 | case BIT_XOR_EXPR: |
4166 | fncode = (return_old_p |
4167 | ? BUILT_IN_ATOMIC_FETCH_XOR_N |
4168 | : BUILT_IN_ATOMIC_XOR_FETCH_N); |
4169 | break; |
4170 | default: |
4171 | goto cas_loop; |
4172 | } |
4173 | |
4174 | /* We can only use "_1" through "_16" variants of the atomic fetch |
4175 | built-ins. */ |
4176 | unsigned HOST_WIDE_INTlong size = tree_to_uhwi (TYPE_SIZE_UNIT (lhs_type)((tree_class_check ((lhs_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4176, __FUNCTION__))->type_common.size_unit)); |
4177 | if (size != 1 && size != 2 && size != 4 && size != 8 && size != 16) |
4178 | goto cas_loop; |
4179 | |
4180 | /* If this is a pointer type, we need to multiply by the size of |
4181 | the pointer target type. */ |
4182 | if (POINTER_TYPE_P (lhs_type)(((enum tree_code) (lhs_type)->base.code) == POINTER_TYPE || ((enum tree_code) (lhs_type)->base.code) == REFERENCE_TYPE )) |
4183 | { |
4184 | if (!COMPLETE_TYPE_P (TREE_TYPE (lhs_type))(((tree_class_check ((((contains_struct_check ((lhs_type), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4184, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4184, __FUNCTION__))->type_common.size) != (tree) __null ) |
4185 | /* ??? This would introduce -Wdiscarded-qualifiers |
4186 | warning: __atomic_fetch_* expect volatile void * |
4187 | type as the first argument. (Assignments between |
4188 | atomic and non-atomic objects are OK.) */ |
4189 | || TYPE_RESTRICT (lhs_type)((tree_class_check ((lhs_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4189, __FUNCTION__))->type_common.restrict_flag)) |
4190 | goto cas_loop; |
4191 | tree sz = TYPE_SIZE_UNIT (TREE_TYPE (lhs_type))((tree_class_check ((((contains_struct_check ((lhs_type), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4191, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4191, __FUNCTION__))->type_common.size_unit); |
4192 | rhs = fold_build2_loc (loc, MULT_EXPR, ptrdiff_type_nodeglobal_trees[TI_PTRDIFF_TYPE], |
4193 | convert (ptrdiff_type_nodeglobal_trees[TI_PTRDIFF_TYPE], rhs), |
4194 | convert (ptrdiff_type_nodeglobal_trees[TI_PTRDIFF_TYPE], sz)); |
4195 | } |
4196 | |
4197 | /* Build __atomic_fetch_* (&lhs, &val, SEQ_CST), or |
4198 | __atomic_*_fetch (&lhs, &val, SEQ_CST). */ |
4199 | fndecl = builtin_decl_explicit (fncode); |
4200 | params->quick_push (lhs_addr); |
4201 | params->quick_push (rhs); |
4202 | params->quick_push (seq_cst); |
4203 | func_call = c_build_function_call_vec (loc, vNULL, fndecl, params, NULL__null); |
4204 | |
4205 | newval = create_tmp_var_raw (nonatomic_lhs_type); |
4206 | TREE_ADDRESSABLE (newval)((newval)->base.addressable_flag) = 1; |
4207 | TREE_NO_WARNING (newval)((newval)->base.nowarning_flag) = 1; |
4208 | rhs = build4 (TARGET_EXPR, nonatomic_lhs_type, newval, func_call, |
4209 | NULL_TREE(tree) __null, NULL_TREE(tree) __null); |
4210 | SET_EXPR_LOCATION (rhs, loc)(expr_check (((rhs)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4210, __FUNCTION__))->exp.locus = (loc); |
4211 | add_stmt (rhs); |
4212 | |
4213 | /* Finish the compound statement. */ |
4214 | compound_stmt = c_end_compound_stmt (loc, compound_stmt, false); |
4215 | |
4216 | /* NEWVAL is the value which was stored, return a COMPOUND_STMT of |
4217 | the statement and that value. */ |
4218 | return build2 (COMPOUND_EXPR, nonatomic_lhs_type, compound_stmt, newval); |
4219 | } |
4220 | |
4221 | cas_loop: |
4222 | /* Create the variables and labels required for the op= form. */ |
4223 | old = create_tmp_var_raw (nonatomic_lhs_type); |
4224 | old_addr = build_unary_op (loc, ADDR_EXPR, old, false); |
4225 | TREE_ADDRESSABLE (old)((old)->base.addressable_flag) = 1; |
4226 | TREE_NO_WARNING (old)((old)->base.nowarning_flag) = 1; |
4227 | |
4228 | newval = create_tmp_var_raw (nonatomic_lhs_type); |
4229 | newval_addr = build_unary_op (loc, ADDR_EXPR, newval, false); |
4230 | TREE_ADDRESSABLE (newval)((newval)->base.addressable_flag) = 1; |
4231 | TREE_NO_WARNING (newval)((newval)->base.nowarning_flag) = 1; |
4232 | |
4233 | loop_decl = create_artificial_label (loc); |
4234 | loop_label = build1 (LABEL_EXPR, void_type_nodeglobal_trees[TI_VOID_TYPE], loop_decl); |
4235 | |
4236 | done_decl = create_artificial_label (loc); |
4237 | done_label = build1 (LABEL_EXPR, void_type_nodeglobal_trees[TI_VOID_TYPE], done_decl); |
4238 | |
4239 | /* __atomic_load (addr, &old, SEQ_CST). */ |
4240 | fndecl = builtin_decl_explicit (BUILT_IN_ATOMIC_LOAD); |
4241 | params->quick_push (lhs_addr); |
4242 | params->quick_push (old_addr); |
4243 | params->quick_push (seq_cst); |
4244 | func_call = c_build_function_call_vec (loc, vNULL, fndecl, params, NULL__null); |
4245 | old = build4 (TARGET_EXPR, nonatomic_lhs_type, old, func_call, NULL_TREE(tree) __null, |
4246 | NULL_TREE(tree) __null); |
4247 | add_stmt (old); |
4248 | params->truncate (0); |
4249 | |
4250 | /* Create the expressions for floating-point environment |
4251 | manipulation, if required. */ |
4252 | bool need_fenv = (flag_trapping_mathglobal_options.x_flag_trapping_math |
4253 | && (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), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4253, __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), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4253, __FUNCTION__))->typed.type))->base.code) == REAL_TYPE ))))); |
4254 | tree hold_call = NULL_TREE(tree) __null, clear_call = NULL_TREE(tree) __null, update_call = NULL_TREE(tree) __null; |
4255 | if (need_fenv) |
4256 | targetm.atomic_assign_expand_fenv (&hold_call, &clear_call, &update_call); |
4257 | |
4258 | if (hold_call) |
4259 | add_stmt (hold_call); |
4260 | |
4261 | /* loop: */ |
4262 | add_stmt (loop_label); |
4263 | |
4264 | /* newval = old + val; */ |
4265 | if (rhs_type != rhs_semantic_type) |
4266 | val = build1 (EXCESS_PRECISION_EXPR, nonatomic_rhs_semantic_type, val); |
4267 | rhs = build_binary_op (loc, modifycode, old, val, true); |
4268 | if (TREE_CODE (rhs)((enum tree_code) (rhs)->base.code) == EXCESS_PRECISION_EXPR) |
4269 | { |
4270 | tree eptype = TREE_TYPE (rhs)((contains_struct_check ((rhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4270, __FUNCTION__))->typed.type); |
4271 | rhs = c_fully_fold (TREE_OPERAND (rhs, 0)(*((const_cast<tree*> (tree_operand_check ((rhs), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4271, __FUNCTION__))))), false, NULL__null); |
4272 | rhs = build1 (EXCESS_PRECISION_EXPR, eptype, rhs); |
4273 | } |
4274 | else |
4275 | rhs = c_fully_fold (rhs, false, NULL__null); |
4276 | rhs = convert_for_assignment (loc, UNKNOWN_LOCATION((location_t) 0), nonatomic_lhs_type, |
4277 | rhs, NULL_TREE(tree) __null, ic_assign, false, NULL_TREE(tree) __null, |
4278 | NULL_TREE(tree) __null, 0); |
4279 | if (rhs != error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
4280 | { |
4281 | rhs = build4 (TARGET_EXPR, nonatomic_lhs_type, newval, rhs, NULL_TREE(tree) __null, |
4282 | NULL_TREE(tree) __null); |
4283 | SET_EXPR_LOCATION (rhs, loc)(expr_check (((rhs)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4283, __FUNCTION__))->exp.locus = (loc); |
4284 | add_stmt (rhs); |
4285 | } |
4286 | |
4287 | /* if (__atomic_compare_exchange (addr, &old, &new, false, SEQ_CST, SEQ_CST)) |
4288 | goto done; */ |
4289 | fndecl = builtin_decl_explicit (BUILT_IN_ATOMIC_COMPARE_EXCHANGE); |
4290 | params->quick_push (lhs_addr); |
4291 | params->quick_push (old_addr); |
4292 | params->quick_push (newval_addr); |
4293 | params->quick_push (integer_zero_nodeglobal_trees[TI_INTEGER_ZERO]); |
4294 | params->quick_push (seq_cst); |
4295 | params->quick_push (seq_cst); |
4296 | func_call = c_build_function_call_vec (loc, vNULL, fndecl, params, NULL__null); |
4297 | |
4298 | goto_stmt = build1 (GOTO_EXPR, void_type_nodeglobal_trees[TI_VOID_TYPE], done_decl); |
4299 | SET_EXPR_LOCATION (goto_stmt, loc)(expr_check (((goto_stmt)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4299, __FUNCTION__))->exp.locus = (loc); |
4300 | |
4301 | stmt = build3 (COND_EXPR, void_type_nodeglobal_trees[TI_VOID_TYPE], func_call, goto_stmt, NULL_TREE(tree) __null); |
4302 | SET_EXPR_LOCATION (stmt, loc)(expr_check (((stmt)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4302, __FUNCTION__))->exp.locus = (loc); |
4303 | add_stmt (stmt); |
4304 | |
4305 | if (clear_call) |
4306 | add_stmt (clear_call); |
4307 | |
4308 | /* goto loop; */ |
4309 | goto_stmt = build1 (GOTO_EXPR, void_type_nodeglobal_trees[TI_VOID_TYPE], loop_decl); |
4310 | SET_EXPR_LOCATION (goto_stmt, loc)(expr_check (((goto_stmt)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4310, __FUNCTION__))->exp.locus = (loc); |
4311 | add_stmt (goto_stmt); |
4312 | |
4313 | /* done: */ |
4314 | add_stmt (done_label); |
4315 | |
4316 | if (update_call) |
4317 | add_stmt (update_call); |
4318 | |
4319 | /* Finish the compound statement. */ |
4320 | compound_stmt = c_end_compound_stmt (loc, compound_stmt, false); |
4321 | |
4322 | /* NEWVAL is the value that was successfully stored, return a |
4323 | COMPOUND_EXPR of the statement and the appropriate value. */ |
4324 | return build2 (COMPOUND_EXPR, nonatomic_lhs_type, compound_stmt, |
4325 | return_old_p ? old : newval); |
4326 | } |
4327 | |
4328 | /* Construct and perhaps optimize a tree representation |
4329 | for a unary operation. CODE, a tree_code, specifies the operation |
4330 | and XARG is the operand. |
4331 | For any CODE other than ADDR_EXPR, NOCONVERT suppresses the default |
4332 | promotions (such as from short to int). |
4333 | For ADDR_EXPR, the default promotions are not applied; NOCONVERT allows |
4334 | non-lvalues; this is only used to handle conversion of non-lvalue arrays |
4335 | to pointers in C99. |
4336 | |
4337 | LOCATION is the location of the operator. */ |
4338 | |
4339 | tree |
4340 | build_unary_op (location_t location, enum tree_code code, tree xarg, |
4341 | bool noconvert) |
4342 | { |
4343 | /* No default_conversion here. It causes trouble for ADDR_EXPR. */ |
4344 | tree arg = xarg; |
4345 | tree argtype = NULL_TREE(tree) __null; |
4346 | enum tree_code typecode; |
4347 | tree val; |
4348 | tree ret = error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
4349 | tree eptype = NULL_TREE(tree) __null; |
4350 | const char *invalid_op_diag; |
4351 | bool int_operands; |
4352 | |
4353 | int_operands = EXPR_INT_CONST_OPERANDS (xarg)((((enum tree_code) (((contains_struct_check ((xarg), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4353, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE || ((enum tree_code) (((contains_struct_check ((xarg), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4353, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE || ((enum tree_code) (((contains_struct_check ((xarg), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4353, __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), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4353, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4353, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_0)))); |
4354 | if (int_operands) |
4355 | arg = remove_c_maybe_const_expr (arg); |
4356 | |
4357 | if (code != ADDR_EXPR) |
4358 | arg = require_complete_type (location, arg); |
4359 | |
4360 | typecode = TREE_CODE (TREE_TYPE (arg))((enum tree_code) (((contains_struct_check ((arg), (TS_TYPED) , "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4360, __FUNCTION__))->typed.type))->base.code); |
4361 | if (typecode == ERROR_MARK) |
4362 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
4363 | if (typecode == ENUMERAL_TYPE || typecode == BOOLEAN_TYPE) |
4364 | typecode = INTEGER_TYPE; |
4365 | |
4366 | if ((invalid_op_diag |
4367 | = targetm.invalid_unary_op (code, TREE_TYPE (xarg)((contains_struct_check ((xarg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4367, __FUNCTION__))->typed.type)))) |
4368 | { |
4369 | error_at (location, invalid_op_diag); |
4370 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
4371 | } |
4372 | |
4373 | if (TREE_CODE (arg)((enum tree_code) (arg)->base.code) == EXCESS_PRECISION_EXPR) |
4374 | { |
4375 | eptype = TREE_TYPE (arg)((contains_struct_check ((arg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4375, __FUNCTION__))->typed.type); |
4376 | arg = TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4376, __FUNCTION__))))); |
4377 | } |
4378 | |
4379 | switch (code) |
4380 | { |
4381 | case CONVERT_EXPR: |
4382 | /* This is used for unary plus, because a CONVERT_EXPR |
4383 | is enough to prevent anybody from looking inside for |
4384 | associativity, but won't generate any code. */ |
4385 | if (!(typecode == INTEGER_TYPE || typecode == REAL_TYPE |
4386 | || typecode == FIXED_POINT_TYPE || typecode == COMPLEX_TYPE |
4387 | || gnu_vector_type_p (TREE_TYPE (arg)((contains_struct_check ((arg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4387, __FUNCTION__))->typed.type)))) |
4388 | { |
4389 | error_at (location, "wrong type argument to unary plus"); |
4390 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
4391 | } |
4392 | else if (!noconvert) |
4393 | arg = default_conversion (arg); |
4394 | arg = non_lvalue_loc (location, arg); |
4395 | break; |
4396 | |
4397 | case NEGATE_EXPR: |
4398 | if (!(typecode == INTEGER_TYPE || typecode == REAL_TYPE |
4399 | || typecode == FIXED_POINT_TYPE || typecode == COMPLEX_TYPE |
4400 | || gnu_vector_type_p (TREE_TYPE (arg)((contains_struct_check ((arg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4400, __FUNCTION__))->typed.type)))) |
4401 | { |
4402 | error_at (location, "wrong type argument to unary minus"); |
4403 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
4404 | } |
4405 | else if (!noconvert) |
4406 | arg = default_conversion (arg); |
4407 | break; |
4408 | |
4409 | case BIT_NOT_EXPR: |
4410 | /* ~ works on integer types and non float vectors. */ |
4411 | if (typecode == INTEGER_TYPE |
4412 | || (gnu_vector_type_p (TREE_TYPE (arg)((contains_struct_check ((arg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4412, __FUNCTION__))->typed.type)) |
4413 | && !VECTOR_FLOAT_TYPE_P (TREE_TYPE (arg))((((enum tree_code) (((contains_struct_check ((arg), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4413, __FUNCTION__))->typed.type))->base.code) == VECTOR_TYPE ) && ((enum tree_code) (((contains_struct_check ((((contains_struct_check ((arg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4413, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4413, __FUNCTION__))->typed.type))->base.code) == REAL_TYPE ))) |
4414 | { |
4415 | tree e = arg; |
4416 | |
4417 | /* Warn if the expression has boolean value. */ |
4418 | while (TREE_CODE (e)((enum tree_code) (e)->base.code) == COMPOUND_EXPR) |
4419 | e = TREE_OPERAND (e, 1)(*((const_cast<tree*> (tree_operand_check ((e), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4419, __FUNCTION__))))); |
4420 | |
4421 | if ((TREE_CODE (TREE_TYPE (arg))((enum tree_code) (((contains_struct_check ((arg), (TS_TYPED) , "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4421, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE |
4422 | || truth_value_p (TREE_CODE (e)((enum tree_code) (e)->base.code)))) |
4423 | { |
4424 | auto_diagnostic_group d; |
4425 | if (warning_at (location, OPT_Wbool_operation, |
4426 | "%<~%> on a boolean expression")) |
4427 | { |
4428 | gcc_rich_location richloc (location); |
4429 | richloc.add_fixit_insert_before (location, "!"); |
4430 | inform (&richloc, "did you mean to use logical not?"); |
4431 | } |
4432 | } |
4433 | if (!noconvert) |
4434 | arg = default_conversion (arg); |
4435 | } |
4436 | else if (typecode == COMPLEX_TYPE) |
4437 | { |
4438 | code = CONJ_EXPR; |
4439 | pedwarn (location, OPT_Wpedantic, |
4440 | "ISO C does not support %<~%> for complex conjugation"); |
4441 | if (!noconvert) |
4442 | arg = default_conversion (arg); |
4443 | } |
4444 | else |
4445 | { |
4446 | error_at (location, "wrong type argument to bit-complement"); |
4447 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
4448 | } |
4449 | break; |
4450 | |
4451 | case ABS_EXPR: |
4452 | if (!(typecode == INTEGER_TYPE || typecode == REAL_TYPE)) |
4453 | { |
4454 | error_at (location, "wrong type argument to abs"); |
4455 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
4456 | } |
4457 | else if (!noconvert) |
4458 | arg = default_conversion (arg); |
4459 | break; |
4460 | |
4461 | case ABSU_EXPR: |
4462 | if (!(typecode == INTEGER_TYPE)) |
4463 | { |
4464 | error_at (location, "wrong type argument to absu"); |
4465 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
4466 | } |
4467 | else if (!noconvert) |
4468 | arg = default_conversion (arg); |
4469 | break; |
4470 | |
4471 | case CONJ_EXPR: |
4472 | /* Conjugating a real value is a no-op, but allow it anyway. */ |
4473 | if (!(typecode == INTEGER_TYPE || typecode == REAL_TYPE |
4474 | || typecode == COMPLEX_TYPE)) |
4475 | { |
4476 | error_at (location, "wrong type argument to conjugation"); |
4477 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
4478 | } |
4479 | else if (!noconvert) |
4480 | arg = default_conversion (arg); |
4481 | break; |
4482 | |
4483 | case TRUTH_NOT_EXPR: |
4484 | if (typecode != INTEGER_TYPE && typecode != FIXED_POINT_TYPE |
4485 | && typecode != REAL_TYPE && typecode != POINTER_TYPE |
4486 | && typecode != COMPLEX_TYPE) |
4487 | { |
4488 | error_at (location, |
4489 | "wrong type argument to unary exclamation mark"); |
4490 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
4491 | } |
4492 | if (int_operands) |
4493 | { |
4494 | arg = c_objc_common_truthvalue_conversion (location, xarg); |
4495 | arg = remove_c_maybe_const_expr (arg); |
4496 | } |
4497 | else |
4498 | arg = c_objc_common_truthvalue_conversion (location, arg); |
4499 | ret = invert_truthvalue_loc (location, arg); |
4500 | /* If the TRUTH_NOT_EXPR has been folded, reset the location. */ |
4501 | if (EXPR_P (ret)((tree_code_type[(int) (((enum tree_code) (ret)->base.code ))]) >= tcc_reference && (tree_code_type[(int) ((( enum tree_code) (ret)->base.code))]) <= tcc_expression) && EXPR_HAS_LOCATION (ret)(((IS_ADHOC_LOC (((((ret)) && ((tree_code_type[(int) ( ((enum tree_code) ((ret))->base.code))]) >= tcc_reference && (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[(int) (((enum tree_code ) ((ret))->base.code))]) >= tcc_reference && (tree_code_type [(int) (((enum tree_code) ((ret))->base.code))]) <= tcc_expression )) ? (ret)->exp.locus : ((location_t) 0))) : (((((ret)) && ((tree_code_type[(int) (((enum tree_code) ((ret))->base.code ))]) >= tcc_reference && (tree_code_type[(int) ((( enum tree_code) ((ret))->base.code))]) <= tcc_expression )) ? (ret)->exp.locus : ((location_t) 0)))) != ((location_t ) 0))) |
4502 | location = EXPR_LOCATION (ret)((((ret)) && ((tree_code_type[(int) (((enum tree_code ) ((ret))->base.code))]) >= tcc_reference && (tree_code_type [(int) (((enum tree_code) ((ret))->base.code))]) <= tcc_expression )) ? (ret)->exp.locus : ((location_t) 0)); |
4503 | goto return_build_unary_op; |
4504 | |
4505 | case REALPART_EXPR: |
4506 | case IMAGPART_EXPR: |
4507 | ret = build_real_imag_expr (location, code, arg); |
4508 | if (ret == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
4509 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
4510 | if (eptype && TREE_CODE (eptype)((enum tree_code) (eptype)->base.code) == COMPLEX_TYPE) |
4511 | eptype = TREE_TYPE (eptype)((contains_struct_check ((eptype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4511, __FUNCTION__))->typed.type); |
4512 | goto return_build_unary_op; |
4513 | |
4514 | case PREINCREMENT_EXPR: |
4515 | case POSTINCREMENT_EXPR: |
4516 | case PREDECREMENT_EXPR: |
4517 | case POSTDECREMENT_EXPR: |
4518 | |
4519 | if (TREE_CODE (arg)((enum tree_code) (arg)->base.code) == C_MAYBE_CONST_EXPR) |
4520 | { |
4521 | tree inner = build_unary_op (location, code, |
4522 | C_MAYBE_CONST_EXPR_EXPR (arg)(*((const_cast<tree*> (tree_operand_check (((tree_check ((arg), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4522, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4522, __FUNCTION__))))), |
4523 | noconvert); |
4524 | if (inner == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
4525 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
4526 | ret = build2 (C_MAYBE_CONST_EXPR, TREE_TYPE (inner)((contains_struct_check ((inner), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4526, __FUNCTION__))->typed.type), |
4527 | C_MAYBE_CONST_EXPR_PRE (arg)(*((const_cast<tree*> (tree_operand_check (((tree_check ((arg), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4527, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4527, __FUNCTION__))))), inner); |
4528 | gcc_assert (!C_MAYBE_CONST_EXPR_INT_OPERANDS (arg))((void)(!(!((tree_not_check2 (((tree_check ((arg), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4528, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4528, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_0)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4528, __FUNCTION__), 0 : 0)); |
4529 | C_MAYBE_CONST_EXPR_NON_CONST (ret)((tree_not_check2 (((tree_check ((ret), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4529, __FUNCTION__, (C_MAYBE_CONST_EXPR)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4529, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_1) = 1; |
4530 | goto return_build_unary_op; |
4531 | } |
4532 | |
4533 | /* Complain about anything that is not a true lvalue. In |
4534 | Objective-C, skip this check for property_refs. */ |
4535 | if (!objc_is_property_ref (arg) |
4536 | && !lvalue_or_else (location, |
4537 | arg, ((code == PREINCREMENT_EXPR |
4538 | || code == POSTINCREMENT_EXPR) |
4539 | ? lv_increment |
4540 | : lv_decrement))) |
4541 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
4542 | |
4543 | if (warn_cxx_compatglobal_options.x_warn_cxx_compat && TREE_CODE (TREE_TYPE (arg))((enum tree_code) (((contains_struct_check ((arg), (TS_TYPED) , "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4543, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE) |
4544 | { |
4545 | if (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR) |
4546 | warning_at (location, OPT_Wc___compat, |
4547 | "increment of enumeration value is invalid in C++"); |
4548 | else |
4549 | warning_at (location, OPT_Wc___compat, |
4550 | "decrement of enumeration value is invalid in C++"); |
4551 | } |
4552 | |
4553 | if (TREE_CODE (TREE_TYPE (arg))((enum tree_code) (((contains_struct_check ((arg), (TS_TYPED) , "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4553, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE) |
4554 | { |
4555 | if (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR) |
4556 | warning_at (location, OPT_Wbool_operation, |
4557 | "increment of a boolean expression"); |
4558 | else |
4559 | warning_at (location, OPT_Wbool_operation, |
4560 | "decrement of a boolean expression"); |
4561 | } |
4562 | |
4563 | /* Ensure the argument is fully folded inside any SAVE_EXPR. */ |
4564 | arg = c_fully_fold (arg, false, NULL__null, true); |
4565 | |
4566 | bool atomic_op; |
4567 | atomic_op = really_atomic_lvalue (arg); |
4568 | |
4569 | /* Increment or decrement the real part of the value, |
4570 | and don't change the imaginary part. */ |
4571 | if (typecode == COMPLEX_TYPE) |
4572 | { |
4573 | tree real, imag; |
4574 | |
4575 | pedwarn (location, OPT_Wpedantic, |
4576 | "ISO C does not support %<++%> and %<--%> on complex types"); |
4577 | |
4578 | if (!atomic_op) |
4579 | { |
4580 | arg = stabilize_reference (arg); |
4581 | real = build_unary_op (EXPR_LOCATION (arg)((((arg)) && ((tree_code_type[(int) (((enum tree_code ) ((arg))->base.code))]) >= tcc_reference && (tree_code_type [(int) (((enum tree_code) ((arg))->base.code))]) <= tcc_expression )) ? (arg)->exp.locus : ((location_t) 0)), REALPART_EXPR, arg, |
4582 | true); |
4583 | imag = build_unary_op (EXPR_LOCATION (arg)((((arg)) && ((tree_code_type[(int) (((enum tree_code ) ((arg))->base.code))]) >= tcc_reference && (tree_code_type [(int) (((enum tree_code) ((arg))->base.code))]) <= tcc_expression )) ? (arg)->exp.locus : ((location_t) 0)), IMAGPART_EXPR, arg, |
4584 | true); |
4585 | real = build_unary_op (EXPR_LOCATION (arg)((((arg)) && ((tree_code_type[(int) (((enum tree_code ) ((arg))->base.code))]) >= tcc_reference && (tree_code_type [(int) (((enum tree_code) ((arg))->base.code))]) <= tcc_expression )) ? (arg)->exp.locus : ((location_t) 0)), code, real, true); |
4586 | if (real == error_mark_nodeglobal_trees[TI_ERROR_MARK] || imag == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
4587 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
4588 | ret = build2 (COMPLEX_EXPR, TREE_TYPE (arg)((contains_struct_check ((arg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4588, __FUNCTION__))->typed.type), |
4589 | real, imag); |
4590 | goto return_build_unary_op; |
4591 | } |
4592 | } |
4593 | |
4594 | /* Report invalid types. */ |
4595 | |
4596 | if (typecode != POINTER_TYPE && typecode != FIXED_POINT_TYPE |
4597 | && typecode != INTEGER_TYPE && typecode != REAL_TYPE |
4598 | && typecode != COMPLEX_TYPE |
4599 | && !gnu_vector_type_p (TREE_TYPE (arg)((contains_struct_check ((arg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4599, __FUNCTION__))->typed.type))) |
4600 | { |
4601 | if (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR) |
4602 | error_at (location, "wrong type argument to increment"); |
4603 | else |
4604 | error_at (location, "wrong type argument to decrement"); |
4605 | |
4606 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
4607 | } |
4608 | |
4609 | { |
4610 | tree inc; |
4611 | |
4612 | argtype = TREE_TYPE (arg)((contains_struct_check ((arg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4612, __FUNCTION__))->typed.type); |
4613 | |
4614 | /* Compute the increment. */ |
4615 | |
4616 | if (typecode == POINTER_TYPE) |
4617 | { |
4618 | /* If pointer target is an incomplete type, |
4619 | we just cannot know how to do the arithmetic. */ |
4620 | if (!COMPLETE_OR_VOID_TYPE_P (TREE_TYPE (argtype))((((tree_class_check ((((contains_struct_check ((argtype), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4620, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4620, __FUNCTION__))->type_common.size) != (tree) __null ) || (((enum tree_code) (((contains_struct_check ((argtype), ( TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4620, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE ))) |
4621 | { |
4622 | if (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR) |
4623 | error_at (location, |
4624 | "increment of pointer to an incomplete type %qT", |
4625 | TREE_TYPE (argtype)((contains_struct_check ((argtype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4625, __FUNCTION__))->typed.type)); |
4626 | else |
4627 | error_at (location, |
4628 | "decrement of pointer to an incomplete type %qT", |
4629 | TREE_TYPE (argtype)((contains_struct_check ((argtype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4629, __FUNCTION__))->typed.type)); |
4630 | } |
4631 | else if (TREE_CODE (TREE_TYPE (argtype))((enum tree_code) (((contains_struct_check ((argtype), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4631, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE |
4632 | || TREE_CODE (TREE_TYPE (argtype))((enum tree_code) (((contains_struct_check ((argtype), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4632, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE) |
4633 | { |
4634 | if (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR) |
4635 | pedwarn (location, OPT_Wpointer_arith, |
4636 | "wrong type argument to increment"); |
4637 | else |
4638 | pedwarn (location, OPT_Wpointer_arith, |
4639 | "wrong type argument to decrement"); |
4640 | } |
4641 | else |
4642 | verify_type_context (location, TCTX_POINTER_ARITH, |
4643 | TREE_TYPE (argtype)((contains_struct_check ((argtype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4643, __FUNCTION__))->typed.type)); |
4644 | |
4645 | inc = c_size_in_bytes (TREE_TYPE (argtype)((contains_struct_check ((argtype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4645, __FUNCTION__))->typed.type)); |
4646 | inc = convert_to_ptrofftype_loc (location, inc); |
4647 | } |
4648 | else if (FRACT_MODE_P (TYPE_MODE (argtype))(((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check ((argtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4648, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode (argtype) : (argtype)->type_common.mode)]) == MODE_FRACT || ((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check ((argtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4648, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode (argtype) : (argtype)->type_common.mode)]) == MODE_VECTOR_FRACT )) |
4649 | { |
4650 | /* For signed fract types, we invert ++ to -- or |
4651 | -- to ++, and change inc from 1 to -1, because |
4652 | it is not possible to represent 1 in signed fract constants. |
4653 | For unsigned fract types, the result always overflows and |
4654 | we get an undefined (original) or the maximum value. */ |
4655 | if (code == PREINCREMENT_EXPR) |
4656 | code = PREDECREMENT_EXPR; |
4657 | else if (code == PREDECREMENT_EXPR) |
4658 | code = PREINCREMENT_EXPR; |
4659 | else if (code == POSTINCREMENT_EXPR) |
4660 | code = POSTDECREMENT_EXPR; |
4661 | else /* code == POSTDECREMENT_EXPR */ |
4662 | code = POSTINCREMENT_EXPR; |
4663 | |
4664 | inc = integer_minus_one_nodeglobal_trees[TI_INTEGER_MINUS_ONE]; |
4665 | inc = convert (argtype, inc); |
4666 | } |
4667 | else |
4668 | { |
4669 | inc = VECTOR_TYPE_P (argtype)(((enum tree_code) (argtype)->base.code) == VECTOR_TYPE) |
4670 | ? build_one_cst (argtype) |
4671 | : integer_one_nodeglobal_trees[TI_INTEGER_ONE]; |
4672 | inc = convert (argtype, inc); |
4673 | } |
4674 | |
4675 | /* If 'arg' is an Objective-C PROPERTY_REF expression, then we |
4676 | need to ask Objective-C to build the increment or decrement |
4677 | expression for it. */ |
4678 | if (objc_is_property_ref (arg)) |
4679 | return objc_build_incr_expr_for_property_ref (location, code, |
4680 | arg, inc); |
4681 | |
4682 | /* Report a read-only lvalue. */ |
4683 | if (TYPE_READONLY (argtype)((tree_class_check ((argtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4683, __FUNCTION__))->base.readonly_flag)) |
4684 | { |
4685 | readonly_error (location, arg, |
4686 | ((code == PREINCREMENT_EXPR |
4687 | || code == POSTINCREMENT_EXPR) |
4688 | ? lv_increment : lv_decrement)); |
4689 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
4690 | } |
4691 | else if (TREE_READONLY (arg)((non_type_check ((arg), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4691, __FUNCTION__))->base.readonly_flag)) |
4692 | readonly_warning (arg, |
4693 | ((code == PREINCREMENT_EXPR |
4694 | || code == POSTINCREMENT_EXPR) |
4695 | ? lv_increment : lv_decrement)); |
4696 | |
4697 | /* If the argument is atomic, use the special code sequences for |
4698 | atomic compound assignment. */ |
4699 | if (atomic_op) |
4700 | { |
4701 | arg = stabilize_reference (arg); |
4702 | ret = build_atomic_assign (location, arg, |
4703 | ((code == PREINCREMENT_EXPR |
4704 | || code == POSTINCREMENT_EXPR) |
4705 | ? PLUS_EXPR |
4706 | : MINUS_EXPR), |
4707 | (FRACT_MODE_P (TYPE_MODE (argtype))(((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check ((argtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4707, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode (argtype) : (argtype)->type_common.mode)]) == MODE_FRACT || ((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check ((argtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4707, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode (argtype) : (argtype)->type_common.mode)]) == MODE_VECTOR_FRACT ) |
4708 | ? inc |
4709 | : integer_one_nodeglobal_trees[TI_INTEGER_ONE]), |
4710 | (code == POSTINCREMENT_EXPR |
4711 | || code == POSTDECREMENT_EXPR)); |
4712 | goto return_build_unary_op; |
4713 | } |
4714 | |
4715 | if (TREE_CODE (TREE_TYPE (arg))((enum tree_code) (((contains_struct_check ((arg), (TS_TYPED) , "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4715, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE) |
4716 | val = boolean_increment (code, arg); |
4717 | else |
4718 | val = build2 (code, TREE_TYPE (arg)((contains_struct_check ((arg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4718, __FUNCTION__))->typed.type), arg, inc); |
4719 | TREE_SIDE_EFFECTS (val)((non_type_check ((val), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4719, __FUNCTION__))->base.side_effects_flag) = 1; |
4720 | if (TREE_CODE (val)((enum tree_code) (val)->base.code) != code) |
4721 | TREE_NO_WARNING (val)((val)->base.nowarning_flag) = 1; |
4722 | ret = val; |
4723 | goto return_build_unary_op; |
4724 | } |
4725 | |
4726 | case ADDR_EXPR: |
4727 | /* Note that this operation never does default_conversion. */ |
4728 | |
4729 | /* The operand of unary '&' must be an lvalue (which excludes |
4730 | expressions of type void), or, in C99, the result of a [] or |
4731 | unary '*' operator. */ |
4732 | if (VOID_TYPE_P (TREE_TYPE (arg))(((enum tree_code) (((contains_struct_check ((arg), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4732, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE ) |
4733 | && TYPE_QUALS (TREE_TYPE (arg))((int) ((((tree_class_check ((((contains_struct_check ((arg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4733, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4733, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((((contains_struct_check ((arg), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4733, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4733, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((((contains_struct_check ((arg), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4733, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4733, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((((contains_struct_check ((arg), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4733, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4733, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ) | (((((tree_class_check ((((contains_struct_check ((arg), ( TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4733, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4733, __FUNCTION__))->base.u.bits.address_space) & 0xFF ) << 8)))) == TYPE_UNQUALIFIED |
4734 | && (!INDIRECT_REF_P (arg)(((enum tree_code) (arg)->base.code) == INDIRECT_REF) || !flag_isoc99)) |
4735 | pedwarn (location, 0, "taking address of expression of type %<void%>"); |
4736 | |
4737 | /* Let &* cancel out to simplify resulting code. */ |
4738 | if (INDIRECT_REF_P (arg)(((enum tree_code) (arg)->base.code) == INDIRECT_REF)) |
4739 | { |
4740 | /* Don't let this be an lvalue. */ |
4741 | if (lvalue_p (TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4741, __FUNCTION__))))))) |
4742 | return non_lvalue_loc (location, TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4742, __FUNCTION__)))))); |
4743 | ret = TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c/c-typeck.c" , 4743, __FUNCTION__))))); |
4744 | goto return_build_unary_op; |
4745 | } |
4746 | |
4747 | /* Anything not already handled and not a true memory reference |
4748 | or a non-lvalue array is an error. */ |
4749 | if (typecode != FUNCTION_TYPE && !noconvert |
4750 | && !lvalue_or_else (location, arg, lv_addressof)) |
4751 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
4752 | |
4753 | /* Move address operations inside C_MAYBE_CONST_EXPR to simpl |