Bug Summary

File:build/gcc/fold-const.c
Warning:line 14107, column 12
Although the value stored to 'code' is used in the enclosing expression, the value is never actually read from 'code'

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name fold-const.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -analyzer-config-compatibility-mode=true -mrelocation-model static -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/11.0.0 -D IN_GCC -D HAVE_CONFIG_H -I . -I . -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/. -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../include -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../libcpp/include -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../libcody -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../libdecnumber -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../libdecnumber/bid -I ../libdecnumber -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../libbacktrace -internal-isystem /usr/bin/../lib64/gcc/x86_64-suse-linux/10/../../../../include/c++/10 -internal-isystem /usr/bin/../lib64/gcc/x86_64-suse-linux/10/../../../../include/c++/10/x86_64-suse-linux -internal-isystem /usr/bin/../lib64/gcc/x86_64-suse-linux/10/../../../../include/c++/10/backward -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-narrowing -Wwrite-strings -Wno-error=format-diag -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fdeprecated-macro -fdebug-compilation-dir /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/objdir/gcc -ferror-limit 19 -fno-rtti -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-output=plist-html -analyzer-config silence-checkers=core.NullDereference -faddrsig -o /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/objdir/clang-static-analyzer/2021-01-16-135054-17580-1/report-chXcvV.plist -x c++ /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c
1/* Fold a constant sub-tree into a single node for C-compiler
2 Copyright (C) 1987-2021 Free Software Foundation, Inc.
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 3, or (at your option) any later
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
15
16You should have received a copy of the GNU General Public License
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
19
20/*@@ This file should be rewritten to use an arbitrary precision
21 @@ representation for "struct tree_int_cst" and "struct tree_real_cst".
22 @@ Perhaps the routines could also be used for bc/dc, and made a lib.
23 @@ The routines that translate from the ap rep should
24 @@ warn if precision et. al. is lost.
25 @@ This would also make life easier when this technology is used
26 @@ for cross-compilers. */
27
28/* The entry points in this file are fold, size_int_wide and size_binop.
29
30 fold takes a tree as argument and returns a simplified tree.
31
32 size_binop takes a tree code for an arithmetic operation
33 and two operands that are trees, and produces a tree for the
34 result, assuming the type comes from `sizetype'.
35
36 size_int takes an integer value, and creates a tree constant
37 with type from `sizetype'.
38
39 Note: Since the folders get called on non-gimple code as well as
40 gimple code, we need to handle GIMPLE tuples as well as their
41 corresponding tree equivalents. */
42
43#include "config.h"
44#include "system.h"
45#include "coretypes.h"
46#include "backend.h"
47#include "target.h"
48#include "rtl.h"
49#include "tree.h"
50#include "gimple.h"
51#include "predict.h"
52#include "memmodel.h"
53#include "tm_p.h"
54#include "tree-ssa-operands.h"
55#include "optabs-query.h"
56#include "cgraph.h"
57#include "diagnostic-core.h"
58#include "flags.h"
59#include "alias.h"
60#include "fold-const.h"
61#include "fold-const-call.h"
62#include "stor-layout.h"
63#include "calls.h"
64#include "tree-iterator.h"
65#include "expr.h"
66#include "intl.h"
67#include "langhooks.h"
68#include "tree-eh.h"
69#include "gimplify.h"
70#include "tree-dfa.h"
71#include "builtins.h"
72#include "generic-match.h"
73#include "gimple-fold.h"
74#include "tree-into-ssa.h"
75#include "md5.h"
76#include "case-cfn-macros.h"
77#include "stringpool.h"
78#include "tree-vrp.h"
79#include "tree-ssanames.h"
80#include "selftest.h"
81#include "stringpool.h"
82#include "attribs.h"
83#include "tree-vector-builder.h"
84#include "vec-perm-indices.h"
85#include "asan.h"
86
87/* Nonzero if we are folding constants inside an initializer; zero
88 otherwise. */
89int folding_initializer = 0;
90
91/* The following constants represent a bit based encoding of GCC's
92 comparison operators. This encoding simplifies transformations
93 on relational comparison operators, such as AND and OR. */
94enum comparison_code {
95 COMPCODE_FALSE = 0,
96 COMPCODE_LT = 1,
97 COMPCODE_EQ = 2,
98 COMPCODE_LE = 3,
99 COMPCODE_GT = 4,
100 COMPCODE_LTGT = 5,
101 COMPCODE_GE = 6,
102 COMPCODE_ORD = 7,
103 COMPCODE_UNORD = 8,
104 COMPCODE_UNLT = 9,
105 COMPCODE_UNEQ = 10,
106 COMPCODE_UNLE = 11,
107 COMPCODE_UNGT = 12,
108 COMPCODE_NE = 13,
109 COMPCODE_UNGE = 14,
110 COMPCODE_TRUE = 15
111};
112
113static bool negate_expr_p (tree);
114static tree negate_expr (tree);
115static tree associate_trees (location_t, tree, tree, enum tree_code, tree);
116static enum comparison_code comparison_to_compcode (enum tree_code);
117static enum tree_code compcode_to_comparison (enum comparison_code);
118static bool twoval_comparison_p (tree, tree *, tree *);
119static tree eval_subst (location_t, tree, tree, tree, tree, tree);
120static tree optimize_bit_field_compare (location_t, enum tree_code,
121 tree, tree, tree);
122static bool simple_operand_p (const_tree);
123static bool simple_operand_p_2 (tree);
124static tree range_binop (enum tree_code, tree, tree, int, tree, int);
125static tree range_predecessor (tree);
126static tree range_successor (tree);
127static tree fold_range_test (location_t, enum tree_code, tree, tree, tree);
128static tree fold_cond_expr_with_comparison (location_t, tree, tree, tree, tree);
129static tree unextend (tree, int, int, tree);
130static tree extract_muldiv (tree, tree, enum tree_code, tree, bool *);
131static tree extract_muldiv_1 (tree, tree, enum tree_code, tree, bool *);
132static tree fold_binary_op_with_conditional_arg (location_t,
133 enum tree_code, tree,
134 tree, tree,
135 tree, tree, int);
136static tree fold_negate_const (tree, tree);
137static tree fold_not_const (const_tree, tree);
138static tree fold_relational_const (enum tree_code, tree, tree, tree);
139static tree fold_convert_const (enum tree_code, tree, tree);
140static tree fold_view_convert_expr (tree, tree);
141static tree fold_negate_expr (location_t, tree);
142
143
144/* Return EXPR_LOCATION of T if it is not UNKNOWN_LOCATION.
145 Otherwise, return LOC. */
146
147static location_t
148expr_location_or (tree t, location_t loc)
149{
150 location_t tloc = EXPR_LOCATION (t)((((t)) && ((tree_code_type[(int) (((enum tree_code) (
(t))->base.code))]) >= tcc_reference && (tree_code_type
[(int) (((enum tree_code) ((t))->base.code))]) <= tcc_expression
)) ? (t)->exp.locus : ((location_t) 0))
;
151 return tloc == UNKNOWN_LOCATION((location_t) 0) ? loc : tloc;
152}
153
154/* Similar to protected_set_expr_location, but never modify x in place,
155 if location can and needs to be set, unshare it. */
156
157static inline tree
158protected_set_expr_location_unshare (tree x, location_t loc)
159{
160 if (CAN_HAVE_LOCATION_P (x)((x) && ((tree_code_type[(int) (((enum tree_code) (x)
->base.code))]) >= tcc_reference && (tree_code_type
[(int) (((enum tree_code) (x)->base.code))]) <= tcc_expression
))
161 && EXPR_LOCATION (x)((((x)) && ((tree_code_type[(int) (((enum tree_code) (
(x))->base.code))]) >= tcc_reference && (tree_code_type
[(int) (((enum tree_code) ((x))->base.code))]) <= tcc_expression
)) ? (x)->exp.locus : ((location_t) 0))
!= loc
162 && !(TREE_CODE (x)((enum tree_code) (x)->base.code) == SAVE_EXPR
163 || TREE_CODE (x)((enum tree_code) (x)->base.code) == TARGET_EXPR
164 || TREE_CODE (x)((enum tree_code) (x)->base.code) == BIND_EXPR))
165 {
166 x = copy_node (x);
167 SET_EXPR_LOCATION (x, loc)(expr_check (((x)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 167, __FUNCTION__))->exp.locus = (loc)
;
168 }
169 return x;
170}
171
172/* If ARG2 divides ARG1 with zero remainder, carries out the exact
173 division and returns the quotient. Otherwise returns
174 NULL_TREE. */
175
176tree
177div_if_zero_remainder (const_tree arg1, const_tree arg2)
178{
179 widest_int quo;
180
181 if (wi::multiple_of_p (wi::to_widest (arg1), wi::to_widest (arg2),
182 SIGNED, &quo))
183 return wide_int_to_tree (TREE_TYPE (arg1)((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 183, __FUNCTION__))->typed.type)
, quo);
184
185 return NULL_TREE(tree) __null;
186}
187
188/* This is nonzero if we should defer warnings about undefined
189 overflow. This facility exists because these warnings are a
190 special case. The code to estimate loop iterations does not want
191 to issue any warnings, since it works with expressions which do not
192 occur in user code. Various bits of cleanup code call fold(), but
193 only use the result if it has certain characteristics (e.g., is a
194 constant); that code only wants to issue a warning if the result is
195 used. */
196
197static int fold_deferring_overflow_warnings;
198
199/* If a warning about undefined overflow is deferred, this is the
200 warning. Note that this may cause us to turn two warnings into
201 one, but that is fine since it is sufficient to only give one
202 warning per expression. */
203
204static const char* fold_deferred_overflow_warning;
205
206/* If a warning about undefined overflow is deferred, this is the
207 level at which the warning should be emitted. */
208
209static enum warn_strict_overflow_code fold_deferred_overflow_code;
210
211/* Start deferring overflow warnings. We could use a stack here to
212 permit nested calls, but at present it is not necessary. */
213
214void
215fold_defer_overflow_warnings (void)
216{
217 ++fold_deferring_overflow_warnings;
218}
219
220/* Stop deferring overflow warnings. If there is a pending warning,
221 and ISSUE is true, then issue the warning if appropriate. STMT is
222 the statement with which the warning should be associated (used for
223 location information); STMT may be NULL. CODE is the level of the
224 warning--a warn_strict_overflow_code value. This function will use
225 the smaller of CODE and the deferred code when deciding whether to
226 issue the warning. CODE may be zero to mean to always use the
227 deferred code. */
228
229void
230fold_undefer_overflow_warnings (bool issue, const gimple *stmt, int code)
231{
232 const char *warnmsg;
233 location_t locus;
234
235 gcc_assert (fold_deferring_overflow_warnings > 0)((void)(!(fold_deferring_overflow_warnings > 0) ? fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 235, __FUNCTION__), 0 : 0))
;
236 --fold_deferring_overflow_warnings;
237 if (fold_deferring_overflow_warnings > 0)
238 {
239 if (fold_deferred_overflow_warning != NULL__null
240 && code != 0
241 && code < (int) fold_deferred_overflow_code)
242 fold_deferred_overflow_code = (enum warn_strict_overflow_code) code;
243 return;
244 }
245
246 warnmsg = fold_deferred_overflow_warning;
247 fold_deferred_overflow_warning = NULL__null;
248
249 if (!issue || warnmsg == NULL__null)
250 return;
251
252 if (gimple_no_warning_p (stmt))
253 return;
254
255 /* Use the smallest code level when deciding to issue the
256 warning. */
257 if (code == 0 || code > (int) fold_deferred_overflow_code)
258 code = fold_deferred_overflow_code;
259
260 if (!issue_strict_overflow_warning (code)(global_options.x_warn_strict_overflow >= (int) (code)))
261 return;
262
263 if (stmt == NULL__null)
264 locus = input_location;
265 else
266 locus = gimple_location (stmt);
267 warning_at (locus, OPT_Wstrict_overflow, "%s", warnmsg);
268}
269
270/* Stop deferring overflow warnings, ignoring any deferred
271 warnings. */
272
273void
274fold_undefer_and_ignore_overflow_warnings (void)
275{
276 fold_undefer_overflow_warnings (false, NULL__null, 0);
277}
278
279/* Whether we are deferring overflow warnings. */
280
281bool
282fold_deferring_overflow_warnings_p (void)
283{
284 return fold_deferring_overflow_warnings > 0;
285}
286
287/* This is called when we fold something based on the fact that signed
288 overflow is undefined. */
289
290void
291fold_overflow_warning (const char* gmsgid, enum warn_strict_overflow_code wc)
292{
293 if (fold_deferring_overflow_warnings > 0)
294 {
295 if (fold_deferred_overflow_warning == NULL__null
296 || wc < fold_deferred_overflow_code)
297 {
298 fold_deferred_overflow_warning = gmsgid;
299 fold_deferred_overflow_code = wc;
300 }
301 }
302 else if (issue_strict_overflow_warning (wc)(global_options.x_warn_strict_overflow >= (int) (wc)))
303 warning (OPT_Wstrict_overflow, gmsgid);
304}
305
306/* Return true if the built-in mathematical function specified by CODE
307 is odd, i.e. -f(x) == f(-x). */
308
309bool
310negate_mathfn_p (combined_fn fn)
311{
312 switch (fn)
313 {
314 CASE_CFN_ASINcase CFN_ASIN: case CFN_BUILT_IN_ASINF: case CFN_BUILT_IN_ASIN
: case CFN_BUILT_IN_ASINL
:
315 CASE_CFN_ASINHcase CFN_ASINH: case CFN_BUILT_IN_ASINHF: case CFN_BUILT_IN_ASINH
: case CFN_BUILT_IN_ASINHL
:
316 CASE_CFN_ATANcase CFN_ATAN: case CFN_BUILT_IN_ATANF: case CFN_BUILT_IN_ATAN
: case CFN_BUILT_IN_ATANL
:
317 CASE_CFN_ATANHcase CFN_ATANH: case CFN_BUILT_IN_ATANHF: case CFN_BUILT_IN_ATANH
: case CFN_BUILT_IN_ATANHL
:
318 CASE_CFN_CASINcase CFN_BUILT_IN_CASINF: case CFN_BUILT_IN_CASIN: case CFN_BUILT_IN_CASINL:
319 CASE_CFN_CASINHcase CFN_BUILT_IN_CASINHF: case CFN_BUILT_IN_CASINH: case CFN_BUILT_IN_CASINHL:
320 CASE_CFN_CATANcase CFN_BUILT_IN_CATANF: case CFN_BUILT_IN_CATAN: case CFN_BUILT_IN_CATANL:
321 CASE_CFN_CATANHcase CFN_BUILT_IN_CATANHF: case CFN_BUILT_IN_CATANH: case CFN_BUILT_IN_CATANHL:
322 CASE_CFN_CBRTcase CFN_BUILT_IN_CBRTF: case CFN_BUILT_IN_CBRT: case CFN_BUILT_IN_CBRTL:
323 CASE_CFN_CPROJcase CFN_BUILT_IN_CPROJF: case CFN_BUILT_IN_CPROJ: case CFN_BUILT_IN_CPROJL:
324 CASE_CFN_CSINcase CFN_BUILT_IN_CSINF: case CFN_BUILT_IN_CSIN: case CFN_BUILT_IN_CSINL:
325 CASE_CFN_CSINHcase CFN_BUILT_IN_CSINHF: case CFN_BUILT_IN_CSINH: case CFN_BUILT_IN_CSINHL:
326 CASE_CFN_CTANcase CFN_BUILT_IN_CTANF: case CFN_BUILT_IN_CTAN: case CFN_BUILT_IN_CTANL:
327 CASE_CFN_CTANHcase CFN_BUILT_IN_CTANHF: case CFN_BUILT_IN_CTANH: case CFN_BUILT_IN_CTANHL:
328 CASE_CFN_ERFcase CFN_BUILT_IN_ERFF: case CFN_BUILT_IN_ERF: case CFN_BUILT_IN_ERFL:
329 CASE_CFN_LLROUNDcase CFN_BUILT_IN_LLROUNDF: case CFN_BUILT_IN_LLROUND: case CFN_BUILT_IN_LLROUNDL:
330 CASE_CFN_LROUNDcase CFN_BUILT_IN_LROUNDF: case CFN_BUILT_IN_LROUND: case CFN_BUILT_IN_LROUNDL:
331 CASE_CFN_ROUNDcase CFN_ROUND: case CFN_BUILT_IN_ROUNDF: case CFN_BUILT_IN_ROUND
: case CFN_BUILT_IN_ROUNDL
:
332 CASE_CFN_ROUNDEVENcase CFN_ROUNDEVEN: case CFN_BUILT_IN_ROUNDEVENF: case CFN_BUILT_IN_ROUNDEVEN
: case CFN_BUILT_IN_ROUNDEVENL
:
333 CASE_CFN_ROUNDEVEN_FNcase CFN_BUILT_IN_ROUNDEVENF16: case CFN_BUILT_IN_ROUNDEVENF32
: case CFN_BUILT_IN_ROUNDEVENF64: case CFN_BUILT_IN_ROUNDEVENF128
: case CFN_BUILT_IN_ROUNDEVENF32X: case CFN_BUILT_IN_ROUNDEVENF64X
: case CFN_BUILT_IN_ROUNDEVENF128X
:
334 CASE_CFN_SINcase CFN_SIN: case CFN_BUILT_IN_SINF: case CFN_BUILT_IN_SIN: case
CFN_BUILT_IN_SINL
:
335 CASE_CFN_SINHcase CFN_SINH: case CFN_BUILT_IN_SINHF: case CFN_BUILT_IN_SINH
: case CFN_BUILT_IN_SINHL
:
336 CASE_CFN_TANcase CFN_TAN: case CFN_BUILT_IN_TANF: case CFN_BUILT_IN_TAN: case
CFN_BUILT_IN_TANL
:
337 CASE_CFN_TANHcase CFN_TANH: case CFN_BUILT_IN_TANHF: case CFN_BUILT_IN_TANH
: case CFN_BUILT_IN_TANHL
:
338 CASE_CFN_TRUNCcase CFN_TRUNC: case CFN_BUILT_IN_TRUNCF: case CFN_BUILT_IN_TRUNC
: case CFN_BUILT_IN_TRUNCL
:
339 return true;
340
341 CASE_CFN_LLRINTcase CFN_BUILT_IN_LLRINTF: case CFN_BUILT_IN_LLRINT: case CFN_BUILT_IN_LLRINTL:
342 CASE_CFN_LRINTcase CFN_BUILT_IN_LRINTF: case CFN_BUILT_IN_LRINT: case CFN_BUILT_IN_LRINTL:
343 CASE_CFN_NEARBYINTcase CFN_NEARBYINT: case CFN_BUILT_IN_NEARBYINTF: case CFN_BUILT_IN_NEARBYINT
: case CFN_BUILT_IN_NEARBYINTL
:
344 CASE_CFN_RINTcase CFN_RINT: case CFN_BUILT_IN_RINTF: case CFN_BUILT_IN_RINT
: case CFN_BUILT_IN_RINTL
:
345 return !flag_rounding_mathglobal_options.x_flag_rounding_math;
346
347 default:
348 break;
349 }
350 return false;
351}
352
353/* Check whether we may negate an integer constant T without causing
354 overflow. */
355
356bool
357may_negate_without_overflow_p (const_tree t)
358{
359 tree type;
360
361 gcc_assert (TREE_CODE (t) == INTEGER_CST)((void)(!(((enum tree_code) (t)->base.code) == INTEGER_CST
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 361, __FUNCTION__), 0 : 0))
;
362
363 type = TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 363, __FUNCTION__))->typed.type)
;
364 if (TYPE_UNSIGNED (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 364, __FUNCTION__))->base.u.bits.unsigned_flag)
)
365 return false;
366
367 return !wi::only_sign_bit_p (wi::to_wide (t));
368}
369
370/* Determine whether an expression T can be cheaply negated using
371 the function negate_expr without introducing undefined overflow. */
372
373static bool
374negate_expr_p (tree t)
375{
376 tree type;
377
378 if (t == 0)
379 return false;
380
381 type = TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 381, __FUNCTION__))->typed.type)
;
382
383 STRIP_SIGN_NOPS (t)(t) = tree_strip_sign_nop_conversions ((const_cast<union tree_node
*> (((t)))))
;
384 switch (TREE_CODE (t)((enum tree_code) (t)->base.code))
385 {
386 case INTEGER_CST:
387 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)
&& TYPE_UNSIGNED (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 387, __FUNCTION__))->base.u.bits.unsigned_flag)
)
388 return true;
389
390 /* Check that -CST will not overflow type. */
391 return may_negate_without_overflow_p (t);
392 case BIT_NOT_EXPR:
393 return (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)
394 && TYPE_OVERFLOW_WRAPS (type)((((enum tree_code) (type)->base.code) == POINTER_TYPE || (
(enum tree_code) (type)->base.code) == REFERENCE_TYPE) ? global_options
.x_flag_wrapv_pointer : ((any_integral_type_check ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 394, __FUNCTION__))->base.u.bits.unsigned_flag || global_options
.x_flag_wrapv))
);
395
396 case FIXED_CST:
397 return true;
398
399 case NEGATE_EXPR:
400 return !TYPE_OVERFLOW_SANITIZED (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) &&
!((((enum tree_code) (type)->base.code) == POINTER_TYPE ||
((enum tree_code) (type)->base.code) == REFERENCE_TYPE) ?
global_options.x_flag_wrapv_pointer : ((any_integral_type_check
((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 400, __FUNCTION__))->base.u.bits.unsigned_flag || global_options
.x_flag_wrapv)) && (global_options.x_flag_sanitize &
SANITIZE_SI_OVERFLOW))
;
401
402 case REAL_CST:
403 /* We want to canonicalize to positive real constants. Pretend
404 that only negative ones can be easily negated. */
405 return REAL_VALUE_NEGATIVE (TREE_REAL_CST (t))real_isneg (&((*((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 405, __FUNCTION__, (REAL_CST)))->real_cst.real_cst_ptr))
))
;
406
407 case COMPLEX_CST:
408 return negate_expr_p (TREE_REALPART (t)((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 408, __FUNCTION__, (COMPLEX_CST)))->complex.real)
)
409 && negate_expr_p (TREE_IMAGPART (t)((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 409, __FUNCTION__, (COMPLEX_CST)))->complex.imag)
);
410
411 case VECTOR_CST:
412 {
413 if (FLOAT_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/fold-const.c"
, 413, __FUNCTION__))->typed.type))->base.code) == REAL_TYPE
) || ((((enum tree_code) (((contains_struct_check ((type), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 413, __FUNCTION__))->typed.type))->base.code) == COMPLEX_TYPE
|| (((enum tree_code) (((contains_struct_check ((type), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 413, __FUNCTION__))->typed.type))->base.code) == VECTOR_TYPE
)) && (((enum tree_code) (((contains_struct_check (((
(contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 413, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 413, __FUNCTION__))->typed.type))->base.code) == REAL_TYPE
)))
|| TYPE_OVERFLOW_WRAPS (type)((((enum tree_code) (type)->base.code) == POINTER_TYPE || (
(enum tree_code) (type)->base.code) == REFERENCE_TYPE) ? global_options
.x_flag_wrapv_pointer : ((any_integral_type_check ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 413, __FUNCTION__))->base.u.bits.unsigned_flag || global_options
.x_flag_wrapv))
)
414 return true;
415
416 /* Steps don't prevent negation. */
417 unsigned int count = vector_cst_encoded_nelts (t);
418 for (unsigned int i = 0; i < count; ++i)
419 if (!negate_expr_p (VECTOR_CST_ENCODED_ELT (t, i)((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 419, __FUNCTION__, (VECTOR_CST)))->vector.elts[i])
))
420 return false;
421
422 return true;
423 }
424
425 case COMPLEX_EXPR:
426 return negate_expr_p (TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 426, __FUNCTION__)))))
)
427 && negate_expr_p (TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 427, __FUNCTION__)))))
);
428
429 case CONJ_EXPR:
430 return negate_expr_p (TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 430, __FUNCTION__)))))
);
431
432 case PLUS_EXPR:
433 if (HONOR_SIGN_DEPENDENT_ROUNDING (element_mode (type))
434 || HONOR_SIGNED_ZEROS (element_mode (type))
435 || (ANY_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) || ((
((enum tree_code) (type)->base.code) == COMPLEX_TYPE || ((
(enum tree_code) (type)->base.code) == VECTOR_TYPE)) &&
(((enum tree_code) (((contains_struct_check ((type), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 435, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE
|| ((enum tree_code) (((contains_struct_check ((type), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 435, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (((contains_struct_check ((type), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 435, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE
)))
436 && ! TYPE_OVERFLOW_WRAPS (type)((((enum tree_code) (type)->base.code) == POINTER_TYPE || (
(enum tree_code) (type)->base.code) == REFERENCE_TYPE) ? global_options
.x_flag_wrapv_pointer : ((any_integral_type_check ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 436, __FUNCTION__))->base.u.bits.unsigned_flag || global_options
.x_flag_wrapv))
))
437 return false;
438 /* -(A + B) -> (-B) - A. */
439 if (negate_expr_p (TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 439, __FUNCTION__)))))
))
440 return true;
441 /* -(A + B) -> (-A) - B. */
442 return negate_expr_p (TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 442, __FUNCTION__)))))
);
443
444 case MINUS_EXPR:
445 /* We can't turn -(A-B) into B-A when we honor signed zeros. */
446 return !HONOR_SIGN_DEPENDENT_ROUNDING (element_mode (type))
447 && !HONOR_SIGNED_ZEROS (element_mode (type))
448 && (! ANY_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) || ((
((enum tree_code) (type)->base.code) == COMPLEX_TYPE || ((
(enum tree_code) (type)->base.code) == VECTOR_TYPE)) &&
(((enum tree_code) (((contains_struct_check ((type), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 448, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE
|| ((enum tree_code) (((contains_struct_check ((type), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 448, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (((contains_struct_check ((type), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 448, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE
)))
449 || TYPE_OVERFLOW_WRAPS (type)((((enum tree_code) (type)->base.code) == POINTER_TYPE || (
(enum tree_code) (type)->base.code) == REFERENCE_TYPE) ? global_options
.x_flag_wrapv_pointer : ((any_integral_type_check ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 449, __FUNCTION__))->base.u.bits.unsigned_flag || global_options
.x_flag_wrapv))
);
450
451 case MULT_EXPR:
452 if (TYPE_UNSIGNED (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 452, __FUNCTION__))->base.u.bits.unsigned_flag)
)
453 break;
454 /* INT_MIN/n * n doesn't overflow while negating one operand it does
455 if n is a (negative) power of two. */
456 if (INTEGRAL_TYPE_P (TREE_TYPE (t))(((enum tree_code) (((contains_struct_check ((t), (TS_TYPED),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 456, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE
|| ((enum tree_code) (((contains_struct_check ((t), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 456, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (((contains_struct_check ((t), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 456, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE
)
457 && ! TYPE_OVERFLOW_WRAPS (TREE_TYPE (t))((((enum tree_code) (((contains_struct_check ((t), (TS_TYPED)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 457, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE
|| ((enum tree_code) (((contains_struct_check ((t), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 457, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
) ? global_options.x_flag_wrapv_pointer : ((any_integral_type_check
((((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 457, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 457, __FUNCTION__))->base.u.bits.unsigned_flag || global_options
.x_flag_wrapv))
458 && ! ((TREE_CODE (TREE_OPERAND (t, 0))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check
((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 458, __FUNCTION__))))))->base.code)
== INTEGER_CST
459 && (wi::popcount
460 (wi::abs (wi::to_wide (TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 460, __FUNCTION__)))))
)))) != 1)
461 || (TREE_CODE (TREE_OPERAND (t, 1))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check
((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 461, __FUNCTION__))))))->base.code)
== INTEGER_CST
462 && (wi::popcount
463 (wi::abs (wi::to_wide (TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 463, __FUNCTION__)))))
)))) != 1)))
464 break;
465
466 /* Fall through. */
467
468 case RDIV_EXPR:
469 if (! HONOR_SIGN_DEPENDENT_ROUNDING (element_mode (TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 469, __FUNCTION__))->typed.type)
)))
470 return negate_expr_p (TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 470, __FUNCTION__)))))
)
471 || negate_expr_p (TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 471, __FUNCTION__)))))
);
472 break;
473
474 case TRUNC_DIV_EXPR:
475 case ROUND_DIV_EXPR:
476 case EXACT_DIV_EXPR:
477 if (TYPE_UNSIGNED (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 477, __FUNCTION__))->base.u.bits.unsigned_flag)
)
478 break;
479 /* In general we can't negate A in A / B, because if A is INT_MIN and
480 B is not 1 we change the sign of the result. */
481 if (TREE_CODE (TREE_OPERAND (t, 0))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check
((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 481, __FUNCTION__))))))->base.code)
== INTEGER_CST
482 && negate_expr_p (TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 482, __FUNCTION__)))))
))
483 return true;
484 /* In general we can't negate B in A / B, because if A is INT_MIN and
485 B is 1, we may turn this into INT_MIN / -1 which is undefined
486 and actually traps on some architectures. */
487 if (! ANY_INTEGRAL_TYPE_P (TREE_TYPE (t))((((enum tree_code) (((contains_struct_check ((t), (TS_TYPED)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 487, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE
|| ((enum tree_code) (((contains_struct_check ((t), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 487, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (((contains_struct_check ((t), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 487, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE
) || ((((enum tree_code) (((contains_struct_check ((t), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 487, __FUNCTION__))->typed.type))->base.code) == COMPLEX_TYPE
|| (((enum tree_code) (((contains_struct_check ((t), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 487, __FUNCTION__))->typed.type))->base.code) == VECTOR_TYPE
)) && (((enum tree_code) (((contains_struct_check (((
(contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 487, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 487, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE
|| ((enum tree_code) (((contains_struct_check ((((contains_struct_check
((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 487, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 487, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (((contains_struct_check ((((contains_struct_check
((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 487, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 487, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE
)))
488 || TYPE_OVERFLOW_WRAPS (TREE_TYPE (t))((((enum tree_code) (((contains_struct_check ((t), (TS_TYPED)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 488, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE
|| ((enum tree_code) (((contains_struct_check ((t), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 488, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
) ? global_options.x_flag_wrapv_pointer : ((any_integral_type_check
((((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 488, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 488, __FUNCTION__))->base.u.bits.unsigned_flag || global_options
.x_flag_wrapv))
489 || (TREE_CODE (TREE_OPERAND (t, 1))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check
((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 489, __FUNCTION__))))))->base.code)
== INTEGER_CST
490 && ! integer_onep (TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 490, __FUNCTION__)))))
)))
491 return negate_expr_p (TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 491, __FUNCTION__)))))
);
492 break;
493
494 case NOP_EXPR:
495 /* Negate -((double)float) as (double)(-float). */
496 if (TREE_CODE (type)((enum tree_code) (type)->base.code) == REAL_TYPE)
497 {
498 tree tem = strip_float_extensions (t);
499 if (tem != t)
500 return negate_expr_p (tem);
501 }
502 break;
503
504 case CALL_EXPR:
505 /* Negate -f(x) as f(-x). */
506 if (negate_mathfn_p (get_call_combined_fn (t)))
507 return negate_expr_p (CALL_EXPR_ARG (t, 0)(*((const_cast<tree*> (tree_operand_check (((tree_check
((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 507, __FUNCTION__, (CALL_EXPR)))), ((0) + 3), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 507, __FUNCTION__)))))
);
508 break;
509
510 case RSHIFT_EXPR:
511 /* Optimize -((int)x >> 31) into (unsigned)x >> 31 for int. */
512 if (TREE_CODE (TREE_OPERAND (t, 1))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check
((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 512, __FUNCTION__))))))->base.code)
== INTEGER_CST)
513 {
514 tree op1 = TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 514, __FUNCTION__)))))
;
515 if (wi::to_wide (op1) == TYPE_PRECISION (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 515, __FUNCTION__))->type_common.precision)
- 1)
516 return true;
517 }
518 break;
519
520 default:
521 break;
522 }
523 return false;
524}
525
526/* Given T, an expression, return a folded tree for -T or NULL_TREE, if no
527 simplification is possible.
528 If negate_expr_p would return true for T, NULL_TREE will never be
529 returned. */
530
531static tree
532fold_negate_expr_1 (location_t loc, tree t)
533{
534 tree type = TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 534, __FUNCTION__))->typed.type)
;
535 tree tem;
536
537 switch (TREE_CODE (t)((enum tree_code) (t)->base.code))
538 {
539 /* Convert - (~A) to A + 1. */
540 case BIT_NOT_EXPR:
541 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)
)
542 return fold_build2_loc (loc, PLUS_EXPR, type, TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 542, __FUNCTION__)))))
,
543 build_one_cst (type));
544 break;
545
546 case INTEGER_CST:
547 tem = fold_negate_const (t, type);
548 if (TREE_OVERFLOW (tem)((tree_class_check ((tem), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 548, __FUNCTION__))->base.public_flag)
== TREE_OVERFLOW (t)((tree_class_check ((t), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 548, __FUNCTION__))->base.public_flag)
549 || (ANY_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) || ((
((enum tree_code) (type)->base.code) == COMPLEX_TYPE || ((
(enum tree_code) (type)->base.code) == VECTOR_TYPE)) &&
(((enum tree_code) (((contains_struct_check ((type), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 549, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE
|| ((enum tree_code) (((contains_struct_check ((type), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 549, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (((contains_struct_check ((type), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 549, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE
)))
550 && !TYPE_OVERFLOW_TRAPS (type)(!(any_integral_type_check ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 550, __FUNCTION__))->base.u.bits.unsigned_flag &&
global_options.x_flag_trapv)
551 && TYPE_OVERFLOW_WRAPS (type)((((enum tree_code) (type)->base.code) == POINTER_TYPE || (
(enum tree_code) (type)->base.code) == REFERENCE_TYPE) ? global_options
.x_flag_wrapv_pointer : ((any_integral_type_check ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 551, __FUNCTION__))->base.u.bits.unsigned_flag || global_options
.x_flag_wrapv))
)
552 || (flag_sanitizeglobal_options.x_flag_sanitize & SANITIZE_SI_OVERFLOW) == 0)
553 return tem;
554 break;
555
556 case POLY_INT_CST:
557 case REAL_CST:
558 case FIXED_CST:
559 tem = fold_negate_const (t, type);
560 return tem;
561
562 case COMPLEX_CST:
563 {
564 tree rpart = fold_negate_expr (loc, TREE_REALPART (t)((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 564, __FUNCTION__, (COMPLEX_CST)))->complex.real)
);
565 tree ipart = fold_negate_expr (loc, TREE_IMAGPART (t)((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 565, __FUNCTION__, (COMPLEX_CST)))->complex.imag)
);
566 if (rpart && ipart)
567 return build_complex (type, rpart, ipart);
568 }
569 break;
570
571 case VECTOR_CST:
572 {
573 tree_vector_builder elts;
574 elts.new_unary_operation (type, t, true);
575 unsigned int count = elts.encoded_nelts ();
576 for (unsigned int i = 0; i < count; ++i)
577 {
578 tree elt = fold_negate_expr (loc, VECTOR_CST_ELT (t, i)vector_cst_elt (t, i));
579 if (elt == NULL_TREE(tree) __null)
580 return NULL_TREE(tree) __null;
581 elts.quick_push (elt);
582 }
583
584 return elts.build ();
585 }
586
587 case COMPLEX_EXPR:
588 if (negate_expr_p (t))
589 return fold_build2_loc (loc, COMPLEX_EXPR, type,
590 fold_negate_expr (loc, TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 590, __FUNCTION__)))))
),
591 fold_negate_expr (loc, TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 591, __FUNCTION__)))))
));
592 break;
593
594 case CONJ_EXPR:
595 if (negate_expr_p (t))
596 return fold_build1_loc (loc, CONJ_EXPR, type,
597 fold_negate_expr (loc, TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 597, __FUNCTION__)))))
));
598 break;
599
600 case NEGATE_EXPR:
601 if (!TYPE_OVERFLOW_SANITIZED (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) &&
!((((enum tree_code) (type)->base.code) == POINTER_TYPE ||
((enum tree_code) (type)->base.code) == REFERENCE_TYPE) ?
global_options.x_flag_wrapv_pointer : ((any_integral_type_check
((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 601, __FUNCTION__))->base.u.bits.unsigned_flag || global_options
.x_flag_wrapv)) && (global_options.x_flag_sanitize &
SANITIZE_SI_OVERFLOW))
)
602 return TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 602, __FUNCTION__)))))
;
603 break;
604
605 case PLUS_EXPR:
606 if (!HONOR_SIGN_DEPENDENT_ROUNDING (element_mode (type))
607 && !HONOR_SIGNED_ZEROS (element_mode (type)))
608 {
609 /* -(A + B) -> (-B) - A. */
610 if (negate_expr_p (TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 610, __FUNCTION__)))))
))
611 {
612 tem = negate_expr (TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 612, __FUNCTION__)))))
);
613 return fold_build2_loc (loc, MINUS_EXPR, type,
614 tem, TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 614, __FUNCTION__)))))
);
615 }
616
617 /* -(A + B) -> (-A) - B. */
618 if (negate_expr_p (TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 618, __FUNCTION__)))))
))
619 {
620 tem = negate_expr (TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 620, __FUNCTION__)))))
);
621 return fold_build2_loc (loc, MINUS_EXPR, type,
622 tem, TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 622, __FUNCTION__)))))
);
623 }
624 }
625 break;
626
627 case MINUS_EXPR:
628 /* - (A - B) -> B - A */
629 if (!HONOR_SIGN_DEPENDENT_ROUNDING (element_mode (type))
630 && !HONOR_SIGNED_ZEROS (element_mode (type)))
631 return fold_build2_loc (loc, MINUS_EXPR, type,
632 TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 632, __FUNCTION__)))))
, TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 632, __FUNCTION__)))))
);
633 break;
634
635 case MULT_EXPR:
636 if (TYPE_UNSIGNED (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 636, __FUNCTION__))->base.u.bits.unsigned_flag)
)
637 break;
638
639 /* Fall through. */
640
641 case RDIV_EXPR:
642 if (! HONOR_SIGN_DEPENDENT_ROUNDING (element_mode (type)))
643 {
644 tem = TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 644, __FUNCTION__)))))
;
645 if (negate_expr_p (tem))
646 return fold_build2_loc (loc, TREE_CODE (t)((enum tree_code) (t)->base.code), type,
647 TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 647, __FUNCTION__)))))
, negate_expr (tem));
648 tem = TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 648, __FUNCTION__)))))
;
649 if (negate_expr_p (tem))
650 return fold_build2_loc (loc, TREE_CODE (t)((enum tree_code) (t)->base.code), type,
651 negate_expr (tem), TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 651, __FUNCTION__)))))
);
652 }
653 break;
654
655 case TRUNC_DIV_EXPR:
656 case ROUND_DIV_EXPR:
657 case EXACT_DIV_EXPR:
658 if (TYPE_UNSIGNED (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 658, __FUNCTION__))->base.u.bits.unsigned_flag)
)
659 break;
660 /* In general we can't negate A in A / B, because if A is INT_MIN and
661 B is not 1 we change the sign of the result. */
662 if (TREE_CODE (TREE_OPERAND (t, 0))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check
((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 662, __FUNCTION__))))))->base.code)
== INTEGER_CST
663 && negate_expr_p (TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 663, __FUNCTION__)))))
))
664 return fold_build2_loc (loc, TREE_CODE (t)((enum tree_code) (t)->base.code), type,
665 negate_expr (TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 665, __FUNCTION__)))))
),
666 TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 666, __FUNCTION__)))))
);
667 /* In general we can't negate B in A / B, because if A is INT_MIN and
668 B is 1, we may turn this into INT_MIN / -1 which is undefined
669 and actually traps on some architectures. */
670 if ((! ANY_INTEGRAL_TYPE_P (TREE_TYPE (t))((((enum tree_code) (((contains_struct_check ((t), (TS_TYPED)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 670, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE
|| ((enum tree_code) (((contains_struct_check ((t), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 670, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (((contains_struct_check ((t), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 670, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE
) || ((((enum tree_code) (((contains_struct_check ((t), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 670, __FUNCTION__))->typed.type))->base.code) == COMPLEX_TYPE
|| (((enum tree_code) (((contains_struct_check ((t), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 670, __FUNCTION__))->typed.type))->base.code) == VECTOR_TYPE
)) && (((enum tree_code) (((contains_struct_check (((
(contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 670, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 670, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE
|| ((enum tree_code) (((contains_struct_check ((((contains_struct_check
((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 670, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 670, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (((contains_struct_check ((((contains_struct_check
((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 670, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 670, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE
)))
671 || TYPE_OVERFLOW_WRAPS (TREE_TYPE (t))((((enum tree_code) (((contains_struct_check ((t), (TS_TYPED)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 671, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE
|| ((enum tree_code) (((contains_struct_check ((t), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 671, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
) ? global_options.x_flag_wrapv_pointer : ((any_integral_type_check
((((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 671, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 671, __FUNCTION__))->base.u.bits.unsigned_flag || global_options
.x_flag_wrapv))
672 || (TREE_CODE (TREE_OPERAND (t, 1))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check
((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 672, __FUNCTION__))))))->base.code)
== INTEGER_CST
673 && ! integer_onep (TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 673, __FUNCTION__)))))
)))
674 && negate_expr_p (TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 674, __FUNCTION__)))))
))
675 return fold_build2_loc (loc, TREE_CODE (t)((enum tree_code) (t)->base.code), type,
676 TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 676, __FUNCTION__)))))
,
677 negate_expr (TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 677, __FUNCTION__)))))
));
678 break;
679
680 case NOP_EXPR:
681 /* Convert -((double)float) into (double)(-float). */
682 if (TREE_CODE (type)((enum tree_code) (type)->base.code) == REAL_TYPE)
683 {
684 tem = strip_float_extensions (t);
685 if (tem != t && negate_expr_p (tem))
686 return fold_convert_loc (loc, type, negate_expr (tem));
687 }
688 break;
689
690 case CALL_EXPR:
691 /* Negate -f(x) as f(-x). */
692 if (negate_mathfn_p (get_call_combined_fn (t))
693 && negate_expr_p (CALL_EXPR_ARG (t, 0)(*((const_cast<tree*> (tree_operand_check (((tree_check
((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 693, __FUNCTION__, (CALL_EXPR)))), ((0) + 3), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 693, __FUNCTION__)))))
))
694 {
695 tree fndecl, arg;
696
697 fndecl = get_callee_fndecl (t);
698 arg = negate_expr (CALL_EXPR_ARG (t, 0)(*((const_cast<tree*> (tree_operand_check (((tree_check
((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 698, __FUNCTION__, (CALL_EXPR)))), ((0) + 3), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 698, __FUNCTION__)))))
);
699 return build_call_expr_loc (loc, fndecl, 1, arg);
700 }
701 break;
702
703 case RSHIFT_EXPR:
704 /* Optimize -((int)x >> 31) into (unsigned)x >> 31 for int. */
705 if (TREE_CODE (TREE_OPERAND (t, 1))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check
((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 705, __FUNCTION__))))))->base.code)
== INTEGER_CST)
706 {
707 tree op1 = TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 707, __FUNCTION__)))))
;
708 if (wi::to_wide (op1) == TYPE_PRECISION (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 708, __FUNCTION__))->type_common.precision)
- 1)
709 {
710 tree ntype = TYPE_UNSIGNED (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 710, __FUNCTION__))->base.u.bits.unsigned_flag)
711 ? signed_type_for (type)
712 : unsigned_type_for (type);
713 tree temp = fold_convert_loc (loc, ntype, TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 713, __FUNCTION__)))))
);
714 temp = fold_build2_loc (loc, RSHIFT_EXPR, ntype, temp, op1);
715 return fold_convert_loc (loc, type, temp);
716 }
717 }
718 break;
719
720 default:
721 break;
722 }
723
724 return NULL_TREE(tree) __null;
725}
726
727/* A wrapper for fold_negate_expr_1. */
728
729static tree
730fold_negate_expr (location_t loc, tree t)
731{
732 tree type = TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 732, __FUNCTION__))->typed.type)
;
733 STRIP_SIGN_NOPS (t)(t) = tree_strip_sign_nop_conversions ((const_cast<union tree_node
*> (((t)))))
;
734 tree tem = fold_negate_expr_1 (loc, t);
735 if (tem == NULL_TREE(tree) __null)
736 return NULL_TREE(tree) __null;
737 return fold_convert_loc (loc, type, tem);
738}
739
740/* Like fold_negate_expr, but return a NEGATE_EXPR tree, if T cannot be
741 negated in a simpler way. Also allow for T to be NULL_TREE, in which case
742 return NULL_TREE. */
743
744static tree
745negate_expr (tree t)
746{
747 tree type, tem;
748 location_t loc;
749
750 if (t == NULL_TREE(tree) __null)
751 return NULL_TREE(tree) __null;
752
753 loc = EXPR_LOCATION (t)((((t)) && ((tree_code_type[(int) (((enum tree_code) (
(t))->base.code))]) >= tcc_reference && (tree_code_type
[(int) (((enum tree_code) ((t))->base.code))]) <= tcc_expression
)) ? (t)->exp.locus : ((location_t) 0))
;
754 type = TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 754, __FUNCTION__))->typed.type)
;
755 STRIP_SIGN_NOPS (t)(t) = tree_strip_sign_nop_conversions ((const_cast<union tree_node
*> (((t)))))
;
756
757 tem = fold_negate_expr (loc, t);
758 if (!tem)
759 tem = build1_loc (loc, NEGATE_EXPR, TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 759, __FUNCTION__))->typed.type)
, t);
760 return fold_convert_loc (loc, type, tem);
761}
762
763/* Split a tree IN into a constant, literal and variable parts that could be
764 combined with CODE to make IN. "constant" means an expression with
765 TREE_CONSTANT but that isn't an actual constant. CODE must be a
766 commutative arithmetic operation. Store the constant part into *CONP,
767 the literal in *LITP and return the variable part. If a part isn't
768 present, set it to null. If the tree does not decompose in this way,
769 return the entire tree as the variable part and the other parts as null.
770
771 If CODE is PLUS_EXPR we also split trees that use MINUS_EXPR. In that
772 case, we negate an operand that was subtracted. Except if it is a
773 literal for which we use *MINUS_LITP instead.
774
775 If NEGATE_P is true, we are negating all of IN, again except a literal
776 for which we use *MINUS_LITP instead. If a variable part is of pointer
777 type, it is negated after converting to TYPE. This prevents us from
778 generating illegal MINUS pointer expression. LOC is the location of
779 the converted variable part.
780
781 If IN is itself a literal or constant, return it as appropriate.
782
783 Note that we do not guarantee that any of the three values will be the
784 same type as IN, but they will have the same signedness and mode. */
785
786static tree
787split_tree (tree in, tree type, enum tree_code code,
788 tree *minus_varp, tree *conp, tree *minus_conp,
789 tree *litp, tree *minus_litp, int negate_p)
790{
791 tree var = 0;
792 *minus_varp = 0;
793 *conp = 0;
794 *minus_conp = 0;
795 *litp = 0;
796 *minus_litp = 0;
797
798 /* Strip any conversions that don't change the machine mode or signedness. */
799 STRIP_SIGN_NOPS (in)(in) = tree_strip_sign_nop_conversions ((const_cast<union tree_node
*> (((in)))))
;
800
801 if (TREE_CODE (in)((enum tree_code) (in)->base.code) == INTEGER_CST || TREE_CODE (in)((enum tree_code) (in)->base.code) == REAL_CST
802 || TREE_CODE (in)((enum tree_code) (in)->base.code) == FIXED_CST)
803 *litp = in;
804 else if (TREE_CODE (in)((enum tree_code) (in)->base.code) == code
805 || ((! FLOAT_TYPE_P (TREE_TYPE (in))((((enum tree_code) (((contains_struct_check ((in), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 805, __FUNCTION__))->typed.type))->base.code) == REAL_TYPE
) || ((((enum tree_code) (((contains_struct_check ((in), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 805, __FUNCTION__))->typed.type))->base.code) == COMPLEX_TYPE
|| (((enum tree_code) (((contains_struct_check ((in), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 805, __FUNCTION__))->typed.type))->base.code) == VECTOR_TYPE
)) && (((enum tree_code) (((contains_struct_check (((
(contains_struct_check ((in), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 805, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 805, __FUNCTION__))->typed.type))->base.code) == REAL_TYPE
)))
|| flag_associative_mathglobal_options.x_flag_associative_math)
806 && ! SAT_FIXED_POINT_TYPE_P (TREE_TYPE (in))(((enum tree_code) (((contains_struct_check ((in), (TS_TYPED)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 806, __FUNCTION__))->typed.type))->base.code) == FIXED_POINT_TYPE
&& ((tree_not_check4 ((((contains_struct_check ((in)
, (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 806, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 806, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
), (ARRAY_TYPE)))->base.u.bits.saturating_flag))
807 /* We can associate addition and subtraction together (even
808 though the C standard doesn't say so) for integers because
809 the value is not affected. For reals, the value might be
810 affected, so we can't. */
811 && ((code == PLUS_EXPR && TREE_CODE (in)((enum tree_code) (in)->base.code) == POINTER_PLUS_EXPR)
812 || (code == PLUS_EXPR && TREE_CODE (in)((enum tree_code) (in)->base.code) == MINUS_EXPR)
813 || (code == MINUS_EXPR
814 && (TREE_CODE (in)((enum tree_code) (in)->base.code) == PLUS_EXPR
815 || TREE_CODE (in)((enum tree_code) (in)->base.code) == POINTER_PLUS_EXPR)))))
816 {
817 tree op0 = TREE_OPERAND (in, 0)(*((const_cast<tree*> (tree_operand_check ((in), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 817, __FUNCTION__)))))
;
818 tree op1 = TREE_OPERAND (in, 1)(*((const_cast<tree*> (tree_operand_check ((in), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 818, __FUNCTION__)))))
;
819 int neg1_p = TREE_CODE (in)((enum tree_code) (in)->base.code) == MINUS_EXPR;
820 int neg_litp_p = 0, neg_conp_p = 0, neg_var_p = 0;
821
822 /* First see if either of the operands is a literal, then a constant. */
823 if (TREE_CODE (op0)((enum tree_code) (op0)->base.code) == INTEGER_CST || TREE_CODE (op0)((enum tree_code) (op0)->base.code) == REAL_CST
824 || TREE_CODE (op0)((enum tree_code) (op0)->base.code) == FIXED_CST)
825 *litp = op0, op0 = 0;
826 else if (TREE_CODE (op1)((enum tree_code) (op1)->base.code) == INTEGER_CST || TREE_CODE (op1)((enum tree_code) (op1)->base.code) == REAL_CST
827 || TREE_CODE (op1)((enum tree_code) (op1)->base.code) == FIXED_CST)
828 *litp = op1, neg_litp_p = neg1_p, op1 = 0;
829
830 if (op0 != 0 && TREE_CONSTANT (op0)((non_type_check ((op0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 830, __FUNCTION__))->base.constant_flag)
)
831 *conp = op0, op0 = 0;
832 else if (op1 != 0 && TREE_CONSTANT (op1)((non_type_check ((op1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 832, __FUNCTION__))->base.constant_flag)
)
833 *conp = op1, neg_conp_p = neg1_p, op1 = 0;
834
835 /* If we haven't dealt with either operand, this is not a case we can
836 decompose. Otherwise, VAR is either of the ones remaining, if any. */
837 if (op0 != 0 && op1 != 0)
838 var = in;
839 else if (op0 != 0)
840 var = op0;
841 else
842 var = op1, neg_var_p = neg1_p;
843
844 /* Now do any needed negations. */
845 if (neg_litp_p)
846 *minus_litp = *litp, *litp = 0;
847 if (neg_conp_p && *conp)
848 *minus_conp = *conp, *conp = 0;
849 if (neg_var_p && var)
850 *minus_varp = var, var = 0;
851 }
852 else if (TREE_CONSTANT (in)((non_type_check ((in), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 852, __FUNCTION__))->base.constant_flag)
)
853 *conp = in;
854 else if (TREE_CODE (in)((enum tree_code) (in)->base.code) == BIT_NOT_EXPR
855 && code == PLUS_EXPR)
856 {
857 /* -1 - X is folded to ~X, undo that here. Do _not_ do this
858 when IN is constant. */
859 *litp = build_minus_one_cst (type);
860 *minus_varp = TREE_OPERAND (in, 0)(*((const_cast<tree*> (tree_operand_check ((in), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 860, __FUNCTION__)))))
;
861 }
862 else
863 var = in;
864
865 if (negate_p)
866 {
867 if (*litp)
868 *minus_litp = *litp, *litp = 0;
869 else if (*minus_litp)
870 *litp = *minus_litp, *minus_litp = 0;
871 if (*conp)
872 *minus_conp = *conp, *conp = 0;
873 else if (*minus_conp)
874 *conp = *minus_conp, *minus_conp = 0;
875 if (var)
876 *minus_varp = var, var = 0;
877 else if (*minus_varp)
878 var = *minus_varp, *minus_varp = 0;
879 }
880
881 if (*litp
882 && TREE_OVERFLOW_P (*litp)((tree_code_type[(int) (((enum tree_code) (*litp)->base.code
))] == tcc_constant) && ((tree_class_check ((*litp), (
tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 882, __FUNCTION__))->base.public_flag))
)
883 *litp = drop_tree_overflow (*litp);
884 if (*minus_litp
885 && TREE_OVERFLOW_P (*minus_litp)((tree_code_type[(int) (((enum tree_code) (*minus_litp)->base
.code))] == tcc_constant) && ((tree_class_check ((*minus_litp
), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 885, __FUNCTION__))->base.public_flag))
)
886 *minus_litp = drop_tree_overflow (*minus_litp);
887
888 return var;
889}
890
891/* Re-associate trees split by the above function. T1 and T2 are
892 either expressions to associate or null. Return the new
893 expression, if any. LOC is the location of the new expression. If
894 we build an operation, do it in TYPE and with CODE. */
895
896static tree
897associate_trees (location_t loc, tree t1, tree t2, enum tree_code code, tree type)
898{
899 if (t1 == 0)
900 {
901 gcc_assert (t2 == 0 || code != MINUS_EXPR)((void)(!(t2 == 0 || code != MINUS_EXPR) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 901, __FUNCTION__), 0 : 0))
;
902 return t2;
903 }
904 else if (t2 == 0)
905 return t1;
906
907 /* If either input is CODE, a PLUS_EXPR, or a MINUS_EXPR, don't
908 try to fold this since we will have infinite recursion. But do
909 deal with any NEGATE_EXPRs. */
910 if (TREE_CODE (t1)((enum tree_code) (t1)->base.code) == code || TREE_CODE (t2)((enum tree_code) (t2)->base.code) == code
911 || TREE_CODE (t1)((enum tree_code) (t1)->base.code) == PLUS_EXPR || TREE_CODE (t2)((enum tree_code) (t2)->base.code) == PLUS_EXPR
912 || TREE_CODE (t1)((enum tree_code) (t1)->base.code) == MINUS_EXPR || TREE_CODE (t2)((enum tree_code) (t2)->base.code) == MINUS_EXPR)
913 {
914 if (code == PLUS_EXPR)
915 {
916 if (TREE_CODE (t1)((enum tree_code) (t1)->base.code) == NEGATE_EXPR)
917 return build2_loc (loc, MINUS_EXPR, type,
918 fold_convert_loc (loc, type, t2),
919 fold_convert_loc (loc, type,
920 TREE_OPERAND (t1, 0)(*((const_cast<tree*> (tree_operand_check ((t1), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 920, __FUNCTION__)))))
));
921 else if (TREE_CODE (t2)((enum tree_code) (t2)->base.code) == NEGATE_EXPR)
922 return build2_loc (loc, MINUS_EXPR, type,
923 fold_convert_loc (loc, type, t1),
924 fold_convert_loc (loc, type,
925 TREE_OPERAND (t2, 0)(*((const_cast<tree*> (tree_operand_check ((t2), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 925, __FUNCTION__)))))
));
926 else if (integer_zerop (t2))
927 return fold_convert_loc (loc, type, t1);
928 }
929 else if (code == MINUS_EXPR)
930 {
931 if (integer_zerop (t2))
932 return fold_convert_loc (loc, type, t1);
933 }
934
935 return build2_loc (loc, code, type, fold_convert_loc (loc, type, t1),
936 fold_convert_loc (loc, type, t2));
937 }
938
939 return fold_build2_loc (loc, code, type, fold_convert_loc (loc, type, t1),
940 fold_convert_loc (loc, type, t2));
941}
942
943/* Check whether TYPE1 and TYPE2 are equivalent integer types, suitable
944 for use in int_const_binop, size_binop and size_diffop. */
945
946static bool
947int_binop_types_match_p (enum tree_code code, const_tree type1, const_tree type2)
948{
949 if (!INTEGRAL_TYPE_P (type1)(((enum tree_code) (type1)->base.code) == ENUMERAL_TYPE ||
((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE || (
(enum tree_code) (type1)->base.code) == INTEGER_TYPE)
&& !POINTER_TYPE_P (type1)(((enum tree_code) (type1)->base.code) == POINTER_TYPE || (
(enum tree_code) (type1)->base.code) == REFERENCE_TYPE)
)
950 return false;
951 if (!INTEGRAL_TYPE_P (type2)(((enum tree_code) (type2)->base.code) == ENUMERAL_TYPE ||
((enum tree_code) (type2)->base.code) == BOOLEAN_TYPE || (
(enum tree_code) (type2)->base.code) == INTEGER_TYPE)
&& !POINTER_TYPE_P (type2)(((enum tree_code) (type2)->base.code) == POINTER_TYPE || (
(enum tree_code) (type2)->base.code) == REFERENCE_TYPE)
)
952 return false;
953
954 switch (code)
955 {
956 case LSHIFT_EXPR:
957 case RSHIFT_EXPR:
958 case LROTATE_EXPR:
959 case RROTATE_EXPR:
960 return true;
961
962 default:
963 break;
964 }
965
966 return TYPE_UNSIGNED (type1)((tree_class_check ((type1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 966, __FUNCTION__))->base.u.bits.unsigned_flag)
== TYPE_UNSIGNED (type2)((tree_class_check ((type2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 966, __FUNCTION__))->base.u.bits.unsigned_flag)
967 && TYPE_PRECISION (type1)((tree_class_check ((type1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 967, __FUNCTION__))->type_common.precision)
== TYPE_PRECISION (type2)((tree_class_check ((type2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 967, __FUNCTION__))->type_common.precision)
968 && TYPE_MODE (type1)((((enum tree_code) ((tree_class_check ((type1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 968, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(type1) : (type1)->type_common.mode)
== TYPE_MODE (type2)((((enum tree_code) ((tree_class_check ((type2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 968, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(type2) : (type2)->type_common.mode)
;
969}
970
971/* Combine two wide ints ARG1 and ARG2 under operation CODE to produce
972 a new constant in RES. Return FALSE if we don't know how to
973 evaluate CODE at compile-time. */
974
975bool
976wide_int_binop (wide_int &res,
977 enum tree_code code, const wide_int &arg1, const wide_int &arg2,
978 signop sign, wi::overflow_type *overflow)
979{
980 wide_int tmp;
981 *overflow = wi::OVF_NONE;
982 switch (code)
983 {
984 case BIT_IOR_EXPR:
985 res = wi::bit_or (arg1, arg2);
986 break;
987
988 case BIT_XOR_EXPR:
989 res = wi::bit_xor (arg1, arg2);
990 break;
991
992 case BIT_AND_EXPR:
993 res = wi::bit_and (arg1, arg2);
994 break;
995
996 case LSHIFT_EXPR:
997 if (wi::neg_p (arg2))
998 return false;
999 res = wi::lshift (arg1, arg2);
1000 break;
1001
1002 case RSHIFT_EXPR:
1003 if (wi::neg_p (arg2))
1004 return false;
1005 /* It's unclear from the C standard whether shifts can overflow.
1006 The following code ignores overflow; perhaps a C standard
1007 interpretation ruling is needed. */
1008 res = wi::rshift (arg1, arg2, sign);
1009 break;
1010
1011 case RROTATE_EXPR:
1012 case LROTATE_EXPR:
1013 if (wi::neg_p (arg2))
1014 {
1015 tmp = -arg2;
1016 if (code == RROTATE_EXPR)
1017 code = LROTATE_EXPR;
1018 else
1019 code = RROTATE_EXPR;
1020 }
1021 else
1022 tmp = arg2;
1023
1024 if (code == RROTATE_EXPR)
1025 res = wi::rrotate (arg1, tmp);
1026 else
1027 res = wi::lrotate (arg1, tmp);
1028 break;
1029
1030 case PLUS_EXPR:
1031 res = wi::add (arg1, arg2, sign, overflow);
1032 break;
1033
1034 case MINUS_EXPR:
1035 res = wi::sub (arg1, arg2, sign, overflow);
1036 break;
1037
1038 case MULT_EXPR:
1039 res = wi::mul (arg1, arg2, sign, overflow);
1040 break;
1041
1042 case MULT_HIGHPART_EXPR:
1043 res = wi::mul_high (arg1, arg2, sign);
1044 break;
1045
1046 case TRUNC_DIV_EXPR:
1047 case EXACT_DIV_EXPR:
1048 if (arg2 == 0)
1049 return false;
1050 res = wi::div_trunc (arg1, arg2, sign, overflow);
1051 break;
1052
1053 case FLOOR_DIV_EXPR:
1054 if (arg2 == 0)
1055 return false;
1056 res = wi::div_floor (arg1, arg2, sign, overflow);
1057 break;
1058
1059 case CEIL_DIV_EXPR:
1060 if (arg2 == 0)
1061 return false;
1062 res = wi::div_ceil (arg1, arg2, sign, overflow);
1063 break;
1064
1065 case ROUND_DIV_EXPR:
1066 if (arg2 == 0)
1067 return false;
1068 res = wi::div_round (arg1, arg2, sign, overflow);
1069 break;
1070
1071 case TRUNC_MOD_EXPR:
1072 if (arg2 == 0)
1073 return false;
1074 res = wi::mod_trunc (arg1, arg2, sign, overflow);
1075 break;
1076
1077 case FLOOR_MOD_EXPR:
1078 if (arg2 == 0)
1079 return false;
1080 res = wi::mod_floor (arg1, arg2, sign, overflow);
1081 break;
1082
1083 case CEIL_MOD_EXPR:
1084 if (arg2 == 0)
1085 return false;
1086 res = wi::mod_ceil (arg1, arg2, sign, overflow);
1087 break;
1088
1089 case ROUND_MOD_EXPR:
1090 if (arg2 == 0)
1091 return false;
1092 res = wi::mod_round (arg1, arg2, sign, overflow);
1093 break;
1094
1095 case MIN_EXPR:
1096 res = wi::min (arg1, arg2, sign);
1097 break;
1098
1099 case MAX_EXPR:
1100 res = wi::max (arg1, arg2, sign);
1101 break;
1102
1103 default:
1104 return false;
1105 }
1106 return true;
1107}
1108
1109/* Combine two poly int's ARG1 and ARG2 under operation CODE to
1110 produce a new constant in RES. Return FALSE if we don't know how
1111 to evaluate CODE at compile-time. */
1112
1113static bool
1114poly_int_binop (poly_wide_int &res, enum tree_code code,
1115 const_tree arg1, const_tree arg2,
1116 signop sign, wi::overflow_type *overflow)
1117{
1118 gcc_assert (NUM_POLY_INT_COEFFS != 1)((void)(!(1 != 1) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1118, __FUNCTION__), 0 : 0))
;
1119 gcc_assert (poly_int_tree_p (arg1) && poly_int_tree_p (arg2))((void)(!(poly_int_tree_p (arg1) && poly_int_tree_p (
arg2)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1119, __FUNCTION__), 0 : 0))
;
1120 switch (code)
1121 {
1122 case PLUS_EXPR:
1123 res = wi::add (wi::to_poly_wide (arg1),
1124 wi::to_poly_wide (arg2), sign, overflow);
1125 break;
1126
1127 case MINUS_EXPR:
1128 res = wi::sub (wi::to_poly_wide (arg1),
1129 wi::to_poly_wide (arg2), sign, overflow);
1130 break;
1131
1132 case MULT_EXPR:
1133 if (TREE_CODE (arg2)((enum tree_code) (arg2)->base.code) == INTEGER_CST)
1134 res = wi::mul (wi::to_poly_wide (arg1),
1135 wi::to_wide (arg2), sign, overflow);
1136 else if (TREE_CODE (arg1)((enum tree_code) (arg1)->base.code) == INTEGER_CST)
1137 res = wi::mul (wi::to_poly_wide (arg2),
1138 wi::to_wide (arg1), sign, overflow);
1139 else
1140 return NULL_TREE(tree) __null;
1141 break;
1142
1143 case LSHIFT_EXPR:
1144 if (TREE_CODE (arg2)((enum tree_code) (arg2)->base.code) == INTEGER_CST)
1145 res = wi::to_poly_wide (arg1) << wi::to_wide (arg2);
1146 else
1147 return false;
1148 break;
1149
1150 case BIT_IOR_EXPR:
1151 if (TREE_CODE (arg2)((enum tree_code) (arg2)->base.code) != INTEGER_CST
1152 || !can_ior_p (wi::to_poly_wide (arg1), wi::to_wide (arg2),
1153 &res))
1154 return false;
1155 break;
1156
1157 default:
1158 return false;
1159 }
1160 return true;
1161}
1162
1163/* Combine two integer constants ARG1 and ARG2 under operation CODE to
1164 produce a new constant. Return NULL_TREE if we don't know how to
1165 evaluate CODE at compile-time. */
1166
1167tree
1168int_const_binop (enum tree_code code, const_tree arg1, const_tree arg2,
1169 int overflowable)
1170{
1171 poly_wide_int poly_res;
1172 tree type = TREE_TYPE (arg1)((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1172, __FUNCTION__))->typed.type)
;
1173 signop sign = TYPE_SIGN (type)((signop) ((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1173, __FUNCTION__))->base.u.bits.unsigned_flag))
;
1174 wi::overflow_type overflow = wi::OVF_NONE;
1175
1176 if (TREE_CODE (arg1)((enum tree_code) (arg1)->base.code) == INTEGER_CST && TREE_CODE (arg2)((enum tree_code) (arg2)->base.code) == INTEGER_CST)
1177 {
1178 wide_int warg1 = wi::to_wide (arg1), res;
1179 wide_int warg2 = wi::to_wide (arg2, TYPE_PRECISION (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1179, __FUNCTION__))->type_common.precision)
);
1180 if (!wide_int_binop (res, code, warg1, warg2, sign, &overflow))
1181 return NULL_TREE(tree) __null;
1182 poly_res = res;
1183 }
1184 else if (!poly_int_tree_p (arg1)
1185 || !poly_int_tree_p (arg2)
1186 || !poly_int_binop (poly_res, code, arg1, arg2, sign, &overflow))
1187 return NULL_TREE(tree) __null;
1188 return force_fit_type (type, poly_res, overflowable,
1189 (((sign == SIGNED || overflowable == -1)
1190 && overflow)
1191 | TREE_OVERFLOW (arg1)((tree_class_check ((arg1), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1191, __FUNCTION__))->base.public_flag)
| TREE_OVERFLOW (arg2)((tree_class_check ((arg2), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1191, __FUNCTION__))->base.public_flag)
));
1192}
1193
1194/* Return true if binary operation OP distributes over addition in operand
1195 OPNO, with the other operand being held constant. OPNO counts from 1. */
1196
1197static bool
1198distributes_over_addition_p (tree_code op, int opno)
1199{
1200 switch (op)
1201 {
1202 case PLUS_EXPR:
1203 case MINUS_EXPR:
1204 case MULT_EXPR:
1205 return true;
1206
1207 case LSHIFT_EXPR:
1208 return opno == 1;
1209
1210 default:
1211 return false;
1212 }
1213}
1214
1215/* Combine two constants ARG1 and ARG2 under operation CODE to produce a new
1216 constant. We assume ARG1 and ARG2 have the same data type, or at least
1217 are the same kind of constant and the same machine mode. Return zero if
1218 combining the constants is not allowed in the current operating mode. */
1219
1220static tree
1221const_binop (enum tree_code code, tree arg1, tree arg2)
1222{
1223 /* Sanity check for the recursive cases. */
1224 if (!arg1 || !arg2)
1225 return NULL_TREE(tree) __null;
1226
1227 STRIP_NOPS (arg1)(arg1) = tree_strip_nop_conversions ((const_cast<union tree_node
*> (((arg1)))))
;
1228 STRIP_NOPS (arg2)(arg2) = tree_strip_nop_conversions ((const_cast<union tree_node
*> (((arg2)))))
;
1229
1230 if (poly_int_tree_p (arg1) && poly_int_tree_p (arg2))
1231 {
1232 if (code == POINTER_PLUS_EXPR)
1233 return int_const_binop (PLUS_EXPR,
1234 arg1, fold_convert (TREE_TYPE (arg1), arg2)fold_convert_loc (((location_t) 0), ((contains_struct_check (
(arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1234, __FUNCTION__))->typed.type), arg2)
);
1235
1236 return int_const_binop (code, arg1, arg2);
1237 }
1238
1239 if (TREE_CODE (arg1)((enum tree_code) (arg1)->base.code) == REAL_CST && TREE_CODE (arg2)((enum tree_code) (arg2)->base.code) == REAL_CST)
1240 {
1241 machine_mode mode;
1242 REAL_VALUE_TYPEstruct real_value d1;
1243 REAL_VALUE_TYPEstruct real_value d2;
1244 REAL_VALUE_TYPEstruct real_value value;
1245 REAL_VALUE_TYPEstruct real_value result;
1246 bool inexact;
1247 tree t, type;
1248
1249 /* The following codes are handled by real_arithmetic. */
1250 switch (code)
1251 {
1252 case PLUS_EXPR:
1253 case MINUS_EXPR:
1254 case MULT_EXPR:
1255 case RDIV_EXPR:
1256 case MIN_EXPR:
1257 case MAX_EXPR:
1258 break;
1259
1260 default:
1261 return NULL_TREE(tree) __null;
1262 }
1263
1264 d1 = TREE_REAL_CST (arg1)(*((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1264, __FUNCTION__, (REAL_CST)))->real_cst.real_cst_ptr)
)
;
1265 d2 = TREE_REAL_CST (arg2)(*((tree_check ((arg2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1265, __FUNCTION__, (REAL_CST)))->real_cst.real_cst_ptr)
)
;
1266
1267 type = TREE_TYPE (arg1)((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1267, __FUNCTION__))->typed.type)
;
1268 mode = TYPE_MODE (type)((((enum tree_code) ((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1268, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(type) : (type)->type_common.mode)
;
1269
1270 /* Don't perform operation if we honor signaling NaNs and
1271 either operand is a signaling NaN. */
1272 if (HONOR_SNANS (mode)
1273 && (REAL_VALUE_ISSIGNALING_NAN (d1)real_issignaling_nan (&(d1))
1274 || REAL_VALUE_ISSIGNALING_NAN (d2)real_issignaling_nan (&(d2))))
1275 return NULL_TREE(tree) __null;
1276
1277 /* Don't perform operation if it would raise a division
1278 by zero exception. */
1279 if (code == RDIV_EXPR
1280 && real_equal (&d2, &dconst0)
1281 && (flag_trapping_mathglobal_options.x_flag_trapping_math || ! MODE_HAS_INFINITIES (mode)((((enum mode_class) mode_class[mode]) == MODE_FLOAT || ((enum
mode_class) mode_class[mode]) == MODE_DECIMAL_FLOAT || ((enum
mode_class) mode_class[mode]) == MODE_COMPLEX_FLOAT || ((enum
mode_class) mode_class[mode]) == MODE_VECTOR_FLOAT) &&
((real_format_for_mode[(((enum mode_class) mode_class[as_a <
scalar_float_mode> ((mode_to_inner (mode)))]) == MODE_DECIMAL_FLOAT
) ? (((as_a <scalar_float_mode> ((mode_to_inner (mode))
)) - MIN_MODE_DECIMAL_FLOAT) + (MAX_MODE_FLOAT - MIN_MODE_FLOAT
+ 1)) : ((enum mode_class) mode_class[as_a <scalar_float_mode
> ((mode_to_inner (mode)))]) == MODE_FLOAT ? ((as_a <scalar_float_mode
> ((mode_to_inner (mode)))) - MIN_MODE_FLOAT) : ((fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1281, __FUNCTION__)), 0)]))->has_inf)
))
1282 return NULL_TREE(tree) __null;
1283
1284 /* If either operand is a NaN, just return it. Otherwise, set up
1285 for floating-point trap; we return an overflow. */
1286 if (REAL_VALUE_ISNAN (d1)real_isnan (&(d1)))
1287 {
1288 /* Make resulting NaN value to be qNaN when flag_signaling_nans
1289 is off. */
1290 d1.signalling = 0;
1291 t = build_real (type, d1);
1292 return t;
1293 }
1294 else if (REAL_VALUE_ISNAN (d2)real_isnan (&(d2)))
1295 {
1296 /* Make resulting NaN value to be qNaN when flag_signaling_nans
1297 is off. */
1298 d2.signalling = 0;
1299 t = build_real (type, d2);
1300 return t;
1301 }
1302
1303 inexact = real_arithmetic (&value, code, &d1, &d2);
1304 real_convert (&result, mode, &value);
1305
1306 /* Don't constant fold this floating point operation if
1307 the result has overflowed and flag_trapping_math. */
1308 if (flag_trapping_mathglobal_options.x_flag_trapping_math
1309 && MODE_HAS_INFINITIES (mode)((((enum mode_class) mode_class[mode]) == MODE_FLOAT || ((enum
mode_class) mode_class[mode]) == MODE_DECIMAL_FLOAT || ((enum
mode_class) mode_class[mode]) == MODE_COMPLEX_FLOAT || ((enum
mode_class) mode_class[mode]) == MODE_VECTOR_FLOAT) &&
((real_format_for_mode[(((enum mode_class) mode_class[as_a <
scalar_float_mode> ((mode_to_inner (mode)))]) == MODE_DECIMAL_FLOAT
) ? (((as_a <scalar_float_mode> ((mode_to_inner (mode))
)) - MIN_MODE_DECIMAL_FLOAT) + (MAX_MODE_FLOAT - MIN_MODE_FLOAT
+ 1)) : ((enum mode_class) mode_class[as_a <scalar_float_mode
> ((mode_to_inner (mode)))]) == MODE_FLOAT ? ((as_a <scalar_float_mode
> ((mode_to_inner (mode)))) - MIN_MODE_FLOAT) : ((fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1309, __FUNCTION__)), 0)]))->has_inf)
1310 && REAL_VALUE_ISINF (result)real_isinf (&(result))
1311 && !REAL_VALUE_ISINF (d1)real_isinf (&(d1))
1312 && !REAL_VALUE_ISINF (d2)real_isinf (&(d2)))
1313 return NULL_TREE(tree) __null;
1314
1315 /* Don't constant fold this floating point operation if the
1316 result may dependent upon the run-time rounding mode and
1317 flag_rounding_math is set, or if GCC's software emulation
1318 is unable to accurately represent the result. */
1319 if ((flag_rounding_mathglobal_options.x_flag_rounding_math
1320 || (MODE_COMPOSITE_P (mode)((((enum mode_class) mode_class[mode]) == MODE_FLOAT || ((enum
mode_class) mode_class[mode]) == MODE_DECIMAL_FLOAT || ((enum
mode_class) mode_class[mode]) == MODE_COMPLEX_FLOAT || ((enum
mode_class) mode_class[mode]) == MODE_VECTOR_FLOAT) &&
((real_format_for_mode[(((enum mode_class) mode_class[as_a <
scalar_float_mode> ((mode_to_inner (mode)))]) == MODE_DECIMAL_FLOAT
) ? (((as_a <scalar_float_mode> ((mode_to_inner (mode))
)) - MIN_MODE_DECIMAL_FLOAT) + (MAX_MODE_FLOAT - MIN_MODE_FLOAT
+ 1)) : ((enum mode_class) mode_class[as_a <scalar_float_mode
> ((mode_to_inner (mode)))]) == MODE_FLOAT ? ((as_a <scalar_float_mode
> ((mode_to_inner (mode)))) - MIN_MODE_FLOAT) : ((fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1320, __FUNCTION__)), 0)]))->pnan < ((real_format_for_mode
[(((enum mode_class) mode_class[as_a <scalar_float_mode>
((mode_to_inner (mode)))]) == MODE_DECIMAL_FLOAT) ? (((as_a <
scalar_float_mode> ((mode_to_inner (mode)))) - MIN_MODE_DECIMAL_FLOAT
) + (MAX_MODE_FLOAT - MIN_MODE_FLOAT + 1)) : ((enum mode_class
) mode_class[as_a <scalar_float_mode> ((mode_to_inner (
mode)))]) == MODE_FLOAT ? ((as_a <scalar_float_mode> ((
mode_to_inner (mode)))) - MIN_MODE_FLOAT) : ((fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1320, __FUNCTION__)), 0)]))->p)
&& !flag_unsafe_math_optimizationsglobal_options.x_flag_unsafe_math_optimizations))
1321 && (inexact || !real_identical (&result, &value)))
1322 return NULL_TREE(tree) __null;
1323
1324 t = build_real (type, result);
1325
1326 TREE_OVERFLOW (t)((tree_class_check ((t), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1326, __FUNCTION__))->base.public_flag)
= TREE_OVERFLOW (arg1)((tree_class_check ((arg1), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1326, __FUNCTION__))->base.public_flag)
| TREE_OVERFLOW (arg2)((tree_class_check ((arg2), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1326, __FUNCTION__))->base.public_flag)
;
1327 return t;
1328 }
1329
1330 if (TREE_CODE (arg1)((enum tree_code) (arg1)->base.code) == FIXED_CST)
1331 {
1332 FIXED_VALUE_TYPEstruct fixed_value f1;
1333 FIXED_VALUE_TYPEstruct fixed_value f2;
1334 FIXED_VALUE_TYPEstruct fixed_value result;
1335 tree t, type;
1336 int sat_p;
1337 bool overflow_p;
1338
1339 /* The following codes are handled by fixed_arithmetic. */
1340 switch (code)
1341 {
1342 case PLUS_EXPR:
1343 case MINUS_EXPR:
1344 case MULT_EXPR:
1345 case TRUNC_DIV_EXPR:
1346 if (TREE_CODE (arg2)((enum tree_code) (arg2)->base.code) != FIXED_CST)
1347 return NULL_TREE(tree) __null;
1348 f2 = TREE_FIXED_CST (arg2)(*((tree_check ((arg2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1348, __FUNCTION__, (FIXED_CST)))->fixed_cst.fixed_cst_ptr
))
;
1349 break;
1350
1351 case LSHIFT_EXPR:
1352 case RSHIFT_EXPR:
1353 {
1354 if (TREE_CODE (arg2)((enum tree_code) (arg2)->base.code) != INTEGER_CST)
1355 return NULL_TREE(tree) __null;
1356 wi::tree_to_wide_ref w2 = wi::to_wide (arg2);
1357 f2.data.high = w2.elt (1);
1358 f2.data.low = w2.ulow ();
1359 f2.mode = SImode(scalar_int_mode ((scalar_int_mode::from_int) E_SImode));
1360 }
1361 break;
1362
1363 default:
1364 return NULL_TREE(tree) __null;
1365 }
1366
1367 f1 = TREE_FIXED_CST (arg1)(*((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1367, __FUNCTION__, (FIXED_CST)))->fixed_cst.fixed_cst_ptr
))
;
1368 type = TREE_TYPE (arg1)((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1368, __FUNCTION__))->typed.type)
;
1369 sat_p = TYPE_SATURATING (type)((tree_not_check4 ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1369, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
), (ARRAY_TYPE)))->base.u.bits.saturating_flag)
;
1370 overflow_p = fixed_arithmetic (&result, code, &f1, &f2, sat_p);
1371 t = build_fixed (type, result);
1372 /* Propagate overflow flags. */
1373 if (overflow_p | TREE_OVERFLOW (arg1)((tree_class_check ((arg1), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1373, __FUNCTION__))->base.public_flag)
| TREE_OVERFLOW (arg2)((tree_class_check ((arg2), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1373, __FUNCTION__))->base.public_flag)
)
1374 TREE_OVERFLOW (t)((tree_class_check ((t), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1374, __FUNCTION__))->base.public_flag)
= 1;
1375 return t;
1376 }
1377
1378 if (TREE_CODE (arg1)((enum tree_code) (arg1)->base.code) == COMPLEX_CST && TREE_CODE (arg2)((enum tree_code) (arg2)->base.code) == COMPLEX_CST)
1379 {
1380 tree type = TREE_TYPE (arg1)((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1380, __FUNCTION__))->typed.type)
;
1381 tree r1 = TREE_REALPART (arg1)((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1381, __FUNCTION__, (COMPLEX_CST)))->complex.real)
;
1382 tree i1 = TREE_IMAGPART (arg1)((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1382, __FUNCTION__, (COMPLEX_CST)))->complex.imag)
;
1383 tree r2 = TREE_REALPART (arg2)((tree_check ((arg2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1383, __FUNCTION__, (COMPLEX_CST)))->complex.real)
;
1384 tree i2 = TREE_IMAGPART (arg2)((tree_check ((arg2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1384, __FUNCTION__, (COMPLEX_CST)))->complex.imag)
;
1385 tree real, imag;
1386
1387 switch (code)
1388 {
1389 case PLUS_EXPR:
1390 case MINUS_EXPR:
1391 real = const_binop (code, r1, r2);
1392 imag = const_binop (code, i1, i2);
1393 break;
1394
1395 case MULT_EXPR:
1396 if (COMPLEX_FLOAT_TYPE_P (type)(((enum tree_code) (type)->base.code) == COMPLEX_TYPE &&
((enum tree_code) (((contains_struct_check ((type), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1396, __FUNCTION__))->typed.type))->base.code) == REAL_TYPE
)
)
1397 return do_mpc_arg2 (arg1, arg2, type,
1398 /* do_nonfinite= */ folding_initializer,
1399 mpc_mul);
1400
1401 real = const_binop (MINUS_EXPR,
1402 const_binop (MULT_EXPR, r1, r2),
1403 const_binop (MULT_EXPR, i1, i2));
1404 imag = const_binop (PLUS_EXPR,
1405 const_binop (MULT_EXPR, r1, i2),
1406 const_binop (MULT_EXPR, i1, r2));
1407 break;
1408
1409 case RDIV_EXPR:
1410 if (COMPLEX_FLOAT_TYPE_P (type)(((enum tree_code) (type)->base.code) == COMPLEX_TYPE &&
((enum tree_code) (((contains_struct_check ((type), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1410, __FUNCTION__))->typed.type))->base.code) == REAL_TYPE
)
)
1411 return do_mpc_arg2 (arg1, arg2, type,
1412 /* do_nonfinite= */ folding_initializer,
1413 mpc_div);
1414 /* Fallthru. */
1415 case TRUNC_DIV_EXPR:
1416 case CEIL_DIV_EXPR:
1417 case FLOOR_DIV_EXPR:
1418 case ROUND_DIV_EXPR:
1419 if (flag_complex_methodglobal_options.x_flag_complex_method == 0)
1420 {
1421 /* Keep this algorithm in sync with
1422 tree-complex.c:expand_complex_div_straight().
1423
1424 Expand complex division to scalars, straightforward algorithm.
1425 a / b = ((ar*br + ai*bi)/t) + i((ai*br - ar*bi)/t)
1426 t = br*br + bi*bi
1427 */
1428 tree magsquared
1429 = const_binop (PLUS_EXPR,
1430 const_binop (MULT_EXPR, r2, r2),
1431 const_binop (MULT_EXPR, i2, i2));
1432 tree t1
1433 = const_binop (PLUS_EXPR,
1434 const_binop (MULT_EXPR, r1, r2),
1435 const_binop (MULT_EXPR, i1, i2));
1436 tree t2
1437 = const_binop (MINUS_EXPR,
1438 const_binop (MULT_EXPR, i1, r2),
1439 const_binop (MULT_EXPR, r1, i2));
1440
1441 real = const_binop (code, t1, magsquared);
1442 imag = const_binop (code, t2, magsquared);
1443 }
1444 else
1445 {
1446 /* Keep this algorithm in sync with
1447 tree-complex.c:expand_complex_div_wide().
1448
1449 Expand complex division to scalars, modified algorithm to minimize
1450 overflow with wide input ranges. */
1451 tree compare = fold_build2 (LT_EXPR, boolean_type_node,fold_build2_loc (((location_t) 0), LT_EXPR, global_trees[TI_BOOLEAN_TYPE
], fold_abs_const (r2, ((contains_struct_check ((type), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1452, __FUNCTION__))->typed.type)), fold_abs_const (i2, (
(contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1453, __FUNCTION__))->typed.type)) )
1452 fold_abs_const (r2, TREE_TYPE (type)),fold_build2_loc (((location_t) 0), LT_EXPR, global_trees[TI_BOOLEAN_TYPE
], fold_abs_const (r2, ((contains_struct_check ((type), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1452, __FUNCTION__))->typed.type)), fold_abs_const (i2, (
(contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1453, __FUNCTION__))->typed.type)) )
1453 fold_abs_const (i2, TREE_TYPE (type)))fold_build2_loc (((location_t) 0), LT_EXPR, global_trees[TI_BOOLEAN_TYPE
], fold_abs_const (r2, ((contains_struct_check ((type), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1452, __FUNCTION__))->typed.type)), fold_abs_const (i2, (
(contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1453, __FUNCTION__))->typed.type)) )
;
1454
1455 if (integer_nonzerop (compare))
1456 {
1457 /* In the TRUE branch, we compute
1458 ratio = br/bi;
1459 div = (br * ratio) + bi;
1460 tr = (ar * ratio) + ai;
1461 ti = (ai * ratio) - ar;
1462 tr = tr / div;
1463 ti = ti / div; */
1464 tree ratio = const_binop (code, r2, i2);
1465 tree div = const_binop (PLUS_EXPR, i2,
1466 const_binop (MULT_EXPR, r2, ratio));
1467 real = const_binop (MULT_EXPR, r1, ratio);
1468 real = const_binop (PLUS_EXPR, real, i1);
1469 real = const_binop (code, real, div);
1470
1471 imag = const_binop (MULT_EXPR, i1, ratio);
1472 imag = const_binop (MINUS_EXPR, imag, r1);
1473 imag = const_binop (code, imag, div);
1474 }
1475 else
1476 {
1477 /* In the FALSE branch, we compute
1478 ratio = d/c;
1479 divisor = (d * ratio) + c;
1480 tr = (b * ratio) + a;
1481 ti = b - (a * ratio);
1482 tr = tr / div;
1483 ti = ti / div; */
1484 tree ratio = const_binop (code, i2, r2);
1485 tree div = const_binop (PLUS_EXPR, r2,
1486 const_binop (MULT_EXPR, i2, ratio));
1487
1488 real = const_binop (MULT_EXPR, i1, ratio);
1489 real = const_binop (PLUS_EXPR, real, r1);
1490 real = const_binop (code, real, div);
1491
1492 imag = const_binop (MULT_EXPR, r1, ratio);
1493 imag = const_binop (MINUS_EXPR, i1, imag);
1494 imag = const_binop (code, imag, div);
1495 }
1496 }
1497 break;
1498
1499 default:
1500 return NULL_TREE(tree) __null;
1501 }
1502
1503 if (real && imag)
1504 return build_complex (type, real, imag);
1505 }
1506
1507 if (TREE_CODE (arg1)((enum tree_code) (arg1)->base.code) == VECTOR_CST
1508 && TREE_CODE (arg2)((enum tree_code) (arg2)->base.code) == VECTOR_CST
1509 && known_eq (TYPE_VECTOR_SUBPARTS (TREE_TYPE (arg1)),(!maybe_ne (TYPE_VECTOR_SUBPARTS (((contains_struct_check ((arg1
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1509, __FUNCTION__))->typed.type)), TYPE_VECTOR_SUBPARTS
(((contains_struct_check ((arg2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1510, __FUNCTION__))->typed.type))))
1510 TYPE_VECTOR_SUBPARTS (TREE_TYPE (arg2)))(!maybe_ne (TYPE_VECTOR_SUBPARTS (((contains_struct_check ((arg1
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1509, __FUNCTION__))->typed.type)), TYPE_VECTOR_SUBPARTS
(((contains_struct_check ((arg2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1510, __FUNCTION__))->typed.type))))
)
1511 {
1512 tree type = TREE_TYPE (arg1)((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1512, __FUNCTION__))->typed.type)
;
1513 bool step_ok_p;
1514 if (VECTOR_CST_STEPPED_P (arg1)(((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1514, __FUNCTION__, (VECTOR_CST)))->base.u.vector_cst.nelts_per_pattern
) == 3)
1515 && VECTOR_CST_STEPPED_P (arg2)(((tree_check ((arg2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1515, __FUNCTION__, (VECTOR_CST)))->base.u.vector_cst.nelts_per_pattern
) == 3)
)
1516 /* We can operate directly on the encoding if:
1517
1518 a3 - a2 == a2 - a1 && b3 - b2 == b2 - b1
1519 implies
1520 (a3 op b3) - (a2 op b2) == (a2 op b2) - (a1 op b1)
1521
1522 Addition and subtraction are the supported operators
1523 for which this is true. */
1524 step_ok_p = (code == PLUS_EXPR || code == MINUS_EXPR);
1525 else if (VECTOR_CST_STEPPED_P (arg1)(((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1525, __FUNCTION__, (VECTOR_CST)))->base.u.vector_cst.nelts_per_pattern
) == 3)
)
1526 /* We can operate directly on stepped encodings if:
1527
1528 a3 - a2 == a2 - a1
1529 implies:
1530 (a3 op c) - (a2 op c) == (a2 op c) - (a1 op c)
1531
1532 which is true if (x -> x op c) distributes over addition. */
1533 step_ok_p = distributes_over_addition_p (code, 1);
1534 else
1535 /* Similarly in reverse. */
1536 step_ok_p = distributes_over_addition_p (code, 2);
1537 tree_vector_builder elts;
1538 if (!elts.new_binary_operation (type, arg1, arg2, step_ok_p))
1539 return NULL_TREE(tree) __null;
1540 unsigned int count = elts.encoded_nelts ();
1541 for (unsigned int i = 0; i < count; ++i)
1542 {
1543 tree elem1 = VECTOR_CST_ELT (arg1, i)vector_cst_elt (arg1, i);
1544 tree elem2 = VECTOR_CST_ELT (arg2, i)vector_cst_elt (arg2, i);
1545
1546 tree elt = const_binop (code, elem1, elem2);
1547
1548 /* It is possible that const_binop cannot handle the given
1549 code and return NULL_TREE */
1550 if (elt == NULL_TREE(tree) __null)
1551 return NULL_TREE(tree) __null;
1552 elts.quick_push (elt);
1553 }
1554
1555 return elts.build ();
1556 }
1557
1558 /* Shifts allow a scalar offset for a vector. */
1559 if (TREE_CODE (arg1)((enum tree_code) (arg1)->base.code) == VECTOR_CST
1560 && TREE_CODE (arg2)((enum tree_code) (arg2)->base.code) == INTEGER_CST)
1561 {
1562 tree type = TREE_TYPE (arg1)((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1562, __FUNCTION__))->typed.type)
;
1563 bool step_ok_p = distributes_over_addition_p (code, 1);
1564 tree_vector_builder elts;
1565 if (!elts.new_unary_operation (type, arg1, step_ok_p))
1566 return NULL_TREE(tree) __null;
1567 unsigned int count = elts.encoded_nelts ();
1568 for (unsigned int i = 0; i < count; ++i)
1569 {
1570 tree elem1 = VECTOR_CST_ELT (arg1, i)vector_cst_elt (arg1, i);
1571
1572 tree elt = const_binop (code, elem1, arg2);
1573
1574 /* It is possible that const_binop cannot handle the given
1575 code and return NULL_TREE. */
1576 if (elt == NULL_TREE(tree) __null)
1577 return NULL_TREE(tree) __null;
1578 elts.quick_push (elt);
1579 }
1580
1581 return elts.build ();
1582 }
1583 return NULL_TREE(tree) __null;
1584}
1585
1586/* Overload that adds a TYPE parameter to be able to dispatch
1587 to fold_relational_const. */
1588
1589tree
1590const_binop (enum tree_code code, tree type, tree arg1, tree arg2)
1591{
1592 if (TREE_CODE_CLASS (code)tree_code_type[(int) (code)] == tcc_comparison)
1593 return fold_relational_const (code, type, arg1, arg2);
1594
1595 /* ??? Until we make the const_binop worker take the type of the
1596 result as argument put those cases that need it here. */
1597 switch (code)
1598 {
1599 case VEC_SERIES_EXPR:
1600 if (CONSTANT_CLASS_P (arg1)(tree_code_type[(int) (((enum tree_code) (arg1)->base.code
))] == tcc_constant)
1601 && CONSTANT_CLASS_P (arg2)(tree_code_type[(int) (((enum tree_code) (arg2)->base.code
))] == tcc_constant)
)
1602 return build_vec_series (type, arg1, arg2);
1603 return NULL_TREE(tree) __null;
1604
1605 case COMPLEX_EXPR:
1606 if ((TREE_CODE (arg1)((enum tree_code) (arg1)->base.code) == REAL_CST
1607 && TREE_CODE (arg2)((enum tree_code) (arg2)->base.code) == REAL_CST)
1608 || (TREE_CODE (arg1)((enum tree_code) (arg1)->base.code) == INTEGER_CST
1609 && TREE_CODE (arg2)((enum tree_code) (arg2)->base.code) == INTEGER_CST))
1610 return build_complex (type, arg1, arg2);
1611 return NULL_TREE(tree) __null;
1612
1613 case POINTER_DIFF_EXPR:
1614 if (poly_int_tree_p (arg1) && poly_int_tree_p (arg2))
1615 {
1616 poly_offset_int res = (wi::to_poly_offset (arg1)
1617 - wi::to_poly_offset (arg2));
1618 return force_fit_type (type, res, 1,
1619 TREE_OVERFLOW (arg1)((tree_class_check ((arg1), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1619, __FUNCTION__))->base.public_flag)
| TREE_OVERFLOW (arg2)((tree_class_check ((arg2), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1619, __FUNCTION__))->base.public_flag)
);
1620 }
1621 return NULL_TREE(tree) __null;
1622
1623 case VEC_PACK_TRUNC_EXPR:
1624 case VEC_PACK_FIX_TRUNC_EXPR:
1625 case VEC_PACK_FLOAT_EXPR:
1626 {
1627 unsigned int HOST_WIDE_INTlong out_nelts, in_nelts, i;
1628
1629 if (TREE_CODE (arg1)((enum tree_code) (arg1)->base.code) != VECTOR_CST
1630 || TREE_CODE (arg2)((enum tree_code) (arg2)->base.code) != VECTOR_CST)
1631 return NULL_TREE(tree) __null;
1632
1633 if (!VECTOR_CST_NELTS (arg1)(TYPE_VECTOR_SUBPARTS (((contains_struct_check ((arg1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1633, __FUNCTION__))->typed.type)))
.is_constant (&in_nelts))
1634 return NULL_TREE(tree) __null;
1635
1636 out_nelts = in_nelts * 2;
1637 gcc_assert (known_eq (in_nelts, VECTOR_CST_NELTS (arg2))((void)(!((!maybe_ne (in_nelts, (TYPE_VECTOR_SUBPARTS (((contains_struct_check
((arg2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1637, __FUNCTION__))->typed.type))))) && (!maybe_ne
(out_nelts, TYPE_VECTOR_SUBPARTS (type)))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1638, __FUNCTION__), 0 : 0))
1638 && known_eq (out_nelts, TYPE_VECTOR_SUBPARTS (type)))((void)(!((!maybe_ne (in_nelts, (TYPE_VECTOR_SUBPARTS (((contains_struct_check
((arg2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1637, __FUNCTION__))->typed.type))))) && (!maybe_ne
(out_nelts, TYPE_VECTOR_SUBPARTS (type)))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1638, __FUNCTION__), 0 : 0))
;
1639
1640 tree_vector_builder elts (type, out_nelts, 1);
1641 for (i = 0; i < out_nelts; i++)
1642 {
1643 tree elt = (i < in_nelts
1644 ? VECTOR_CST_ELT (arg1, i)vector_cst_elt (arg1, i)
1645 : VECTOR_CST_ELT (arg2, i - in_nelts)vector_cst_elt (arg2, i - in_nelts));
1646 elt = fold_convert_const (code == VEC_PACK_TRUNC_EXPR
1647 ? NOP_EXPR
1648 : code == VEC_PACK_FLOAT_EXPR
1649 ? FLOAT_EXPR : FIX_TRUNC_EXPR,
1650 TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1650, __FUNCTION__))->typed.type)
, elt);
1651 if (elt == NULL_TREE(tree) __null || !CONSTANT_CLASS_P (elt)(tree_code_type[(int) (((enum tree_code) (elt)->base.code)
)] == tcc_constant)
)
1652 return NULL_TREE(tree) __null;
1653 elts.quick_push (elt);
1654 }
1655
1656 return elts.build ();
1657 }
1658
1659 case VEC_WIDEN_MULT_LO_EXPR:
1660 case VEC_WIDEN_MULT_HI_EXPR:
1661 case VEC_WIDEN_MULT_EVEN_EXPR:
1662 case VEC_WIDEN_MULT_ODD_EXPR:
1663 {
1664 unsigned HOST_WIDE_INTlong out_nelts, in_nelts, out, ofs, scale;
1665
1666 if (TREE_CODE (arg1)((enum tree_code) (arg1)->base.code) != VECTOR_CST || TREE_CODE (arg2)((enum tree_code) (arg2)->base.code) != VECTOR_CST)
1667 return NULL_TREE(tree) __null;
1668
1669 if (!VECTOR_CST_NELTS (arg1)(TYPE_VECTOR_SUBPARTS (((contains_struct_check ((arg1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1669, __FUNCTION__))->typed.type)))
.is_constant (&in_nelts))
1670 return NULL_TREE(tree) __null;
1671 out_nelts = in_nelts / 2;
1672 gcc_assert (known_eq (in_nelts, VECTOR_CST_NELTS (arg2))((void)(!((!maybe_ne (in_nelts, (TYPE_VECTOR_SUBPARTS (((contains_struct_check
((arg2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1672, __FUNCTION__))->typed.type))))) && (!maybe_ne
(out_nelts, TYPE_VECTOR_SUBPARTS (type)))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1673, __FUNCTION__), 0 : 0))
1673 && known_eq (out_nelts, TYPE_VECTOR_SUBPARTS (type)))((void)(!((!maybe_ne (in_nelts, (TYPE_VECTOR_SUBPARTS (((contains_struct_check
((arg2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1672, __FUNCTION__))->typed.type))))) && (!maybe_ne
(out_nelts, TYPE_VECTOR_SUBPARTS (type)))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1673, __FUNCTION__), 0 : 0))
;
1674
1675 if (code == VEC_WIDEN_MULT_LO_EXPR)
1676 scale = 0, ofs = BYTES_BIG_ENDIAN0 ? out_nelts : 0;
1677 else if (code == VEC_WIDEN_MULT_HI_EXPR)
1678 scale = 0, ofs = BYTES_BIG_ENDIAN0 ? 0 : out_nelts;
1679 else if (code == VEC_WIDEN_MULT_EVEN_EXPR)
1680 scale = 1, ofs = 0;
1681 else /* if (code == VEC_WIDEN_MULT_ODD_EXPR) */
1682 scale = 1, ofs = 1;
1683
1684 tree_vector_builder elts (type, out_nelts, 1);
1685 for (out = 0; out < out_nelts; out++)
1686 {
1687 unsigned int in = (out << scale) + ofs;
1688 tree t1 = fold_convert_const (NOP_EXPR, TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1688, __FUNCTION__))->typed.type)
,
1689 VECTOR_CST_ELT (arg1, in)vector_cst_elt (arg1, in));
1690 tree t2 = fold_convert_const (NOP_EXPR, TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1690, __FUNCTION__))->typed.type)
,
1691 VECTOR_CST_ELT (arg2, in)vector_cst_elt (arg2, in));
1692
1693 if (t1 == NULL_TREE(tree) __null || t2 == NULL_TREE(tree) __null)
1694 return NULL_TREE(tree) __null;
1695 tree elt = const_binop (MULT_EXPR, t1, t2);
1696 if (elt == NULL_TREE(tree) __null || !CONSTANT_CLASS_P (elt)(tree_code_type[(int) (((enum tree_code) (elt)->base.code)
)] == tcc_constant)
)
1697 return NULL_TREE(tree) __null;
1698 elts.quick_push (elt);
1699 }
1700
1701 return elts.build ();
1702 }
1703
1704 default:;
1705 }
1706
1707 if (TREE_CODE_CLASS (code)tree_code_type[(int) (code)] != tcc_binary)
1708 return NULL_TREE(tree) __null;
1709
1710 /* Make sure type and arg0 have the same saturating flag. */
1711 gcc_checking_assert (TYPE_SATURATING (type)((void)(!(((tree_not_check4 ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1711, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
), (ARRAY_TYPE)))->base.u.bits.saturating_flag) == ((tree_not_check4
((((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1712, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1712, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
), (ARRAY_TYPE)))->base.u.bits.saturating_flag)) ? fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1712, __FUNCTION__), 0 : 0))
1712 == TYPE_SATURATING (TREE_TYPE (arg1)))((void)(!(((tree_not_check4 ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1711, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
), (ARRAY_TYPE)))->base.u.bits.saturating_flag) == ((tree_not_check4
((((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1712, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1712, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
), (ARRAY_TYPE)))->base.u.bits.saturating_flag)) ? fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1712, __FUNCTION__), 0 : 0))
;
1713
1714 return const_binop (code, arg1, arg2);
1715}
1716
1717/* Compute CODE ARG1 with resulting type TYPE with ARG1 being constant.
1718 Return zero if computing the constants is not possible. */
1719
1720tree
1721const_unop (enum tree_code code, tree type, tree arg0)
1722{
1723 /* Don't perform the operation, other than NEGATE and ABS, if
1724 flag_signaling_nans is on and the operand is a signaling NaN. */
1725 if (TREE_CODE (arg0)((enum tree_code) (arg0)->base.code) == REAL_CST
1726 && HONOR_SNANS (TYPE_MODE (TREE_TYPE (arg0))((((enum tree_code) ((tree_class_check ((((contains_struct_check
((arg0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1726, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1726, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(((contains_struct_check ((arg0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1726, __FUNCTION__))->typed.type)) : (((contains_struct_check
((arg0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1726, __FUNCTION__))->typed.type))->type_common.mode)
)
1727 && REAL_VALUE_ISSIGNALING_NAN (TREE_REAL_CST (arg0))real_issignaling_nan (&((*((tree_check ((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1727, __FUNCTION__, (REAL_CST)))->real_cst.real_cst_ptr)
)))
1728 && code != NEGATE_EXPR
1729 && code != ABS_EXPR
1730 && code != ABSU_EXPR)
1731 return NULL_TREE(tree) __null;
1732
1733 switch (code)
1734 {
1735 CASE_CONVERTcase NOP_EXPR: case CONVERT_EXPR:
1736 case FLOAT_EXPR:
1737 case FIX_TRUNC_EXPR:
1738 case FIXED_CONVERT_EXPR:
1739 return fold_convert_const (code, type, arg0);
1740
1741 case ADDR_SPACE_CONVERT_EXPR:
1742 /* If the source address is 0, and the source address space
1743 cannot have a valid object at 0, fold to dest type null. */
1744 if (integer_zerop (arg0)
1745 && !(targetm.addr_space.zero_address_valid
1746 (TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (arg0)))((tree_class_check ((((contains_struct_check ((((contains_struct_check
((arg0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1746, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1746, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1746, __FUNCTION__))->base.u.bits.address_space)
)))
1747 return fold_convert_const (code, type, arg0);
1748 break;
1749
1750 case VIEW_CONVERT_EXPR:
1751 return fold_view_convert_expr (type, arg0);
1752
1753 case NEGATE_EXPR:
1754 {
1755 /* Can't call fold_negate_const directly here as that doesn't
1756 handle all cases and we might not be able to negate some
1757 constants. */
1758 tree tem = fold_negate_expr (UNKNOWN_LOCATION((location_t) 0), arg0);
1759 if (tem && CONSTANT_CLASS_P (tem)(tree_code_type[(int) (((enum tree_code) (tem)->base.code)
)] == tcc_constant)
)
1760 return tem;
1761 break;
1762 }
1763
1764 case ABS_EXPR:
1765 case ABSU_EXPR:
1766 if (TREE_CODE (arg0)((enum tree_code) (arg0)->base.code) == INTEGER_CST || TREE_CODE (arg0)((enum tree_code) (arg0)->base.code) == REAL_CST)
1767 return fold_abs_const (arg0, type);
1768 break;
1769
1770 case CONJ_EXPR:
1771 if (TREE_CODE (arg0)((enum tree_code) (arg0)->base.code) == COMPLEX_CST)
1772 {
1773 tree ipart = fold_negate_const (TREE_IMAGPART (arg0)((tree_check ((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1773, __FUNCTION__, (COMPLEX_CST)))->complex.imag)
,
1774 TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1774, __FUNCTION__))->typed.type)
);
1775 return build_complex (type, TREE_REALPART (arg0)((tree_check ((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1775, __FUNCTION__, (COMPLEX_CST)))->complex.real)
, ipart);
1776 }
1777 break;
1778
1779 case BIT_NOT_EXPR:
1780 if (TREE_CODE (arg0)((enum tree_code) (arg0)->base.code) == INTEGER_CST)
1781 return fold_not_const (arg0, type);
1782 else if (POLY_INT_CST_P (arg0)(1 > 1 && ((enum tree_code) (arg0)->base.code) ==
POLY_INT_CST)
)
1783 return wide_int_to_tree (type, -poly_int_cst_value (arg0));
1784 /* Perform BIT_NOT_EXPR on each element individually. */
1785 else if (TREE_CODE (arg0)((enum tree_code) (arg0)->base.code) == VECTOR_CST)
1786 {
1787 tree elem;
1788
1789 /* This can cope with stepped encodings because ~x == -1 - x. */
1790 tree_vector_builder elements;
1791 elements.new_unary_operation (type, arg0, true);
1792 unsigned int i, count = elements.encoded_nelts ();
1793 for (i = 0; i < count; ++i)
1794 {
1795 elem = VECTOR_CST_ELT (arg0, i)vector_cst_elt (arg0, i);
1796 elem = const_unop (BIT_NOT_EXPR, TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1796, __FUNCTION__))->typed.type)
, elem);
1797 if (elem == NULL_TREE(tree) __null)
1798 break;
1799 elements.quick_push (elem);
1800 }
1801 if (i == count)
1802 return elements.build ();
1803 }
1804 break;
1805
1806 case TRUTH_NOT_EXPR:
1807 if (TREE_CODE (arg0)((enum tree_code) (arg0)->base.code) == INTEGER_CST)
1808 return constant_boolean_node (integer_zerop (arg0), type);
1809 break;
1810
1811 case REALPART_EXPR:
1812 if (TREE_CODE (arg0)((enum tree_code) (arg0)->base.code) == COMPLEX_CST)
1813 return fold_convert (type, TREE_REALPART (arg0))fold_convert_loc (((location_t) 0), type, ((tree_check ((arg0
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1813, __FUNCTION__, (COMPLEX_CST)))->complex.real))
;
1814 break;
1815
1816 case IMAGPART_EXPR:
1817 if (TREE_CODE (arg0)((enum tree_code) (arg0)->base.code) == COMPLEX_CST)
1818 return fold_convert (type, TREE_IMAGPART (arg0))fold_convert_loc (((location_t) 0), type, ((tree_check ((arg0
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1818, __FUNCTION__, (COMPLEX_CST)))->complex.imag))
;
1819 break;
1820
1821 case VEC_UNPACK_LO_EXPR:
1822 case VEC_UNPACK_HI_EXPR:
1823 case VEC_UNPACK_FLOAT_LO_EXPR:
1824 case VEC_UNPACK_FLOAT_HI_EXPR:
1825 case VEC_UNPACK_FIX_TRUNC_LO_EXPR:
1826 case VEC_UNPACK_FIX_TRUNC_HI_EXPR:
1827 {
1828 unsigned HOST_WIDE_INTlong out_nelts, in_nelts, i;
1829 enum tree_code subcode;
1830
1831 if (TREE_CODE (arg0)((enum tree_code) (arg0)->base.code) != VECTOR_CST)
1832 return NULL_TREE(tree) __null;
1833
1834 if (!VECTOR_CST_NELTS (arg0)(TYPE_VECTOR_SUBPARTS (((contains_struct_check ((arg0), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1834, __FUNCTION__))->typed.type)))
.is_constant (&in_nelts))
1835 return NULL_TREE(tree) __null;
1836 out_nelts = in_nelts / 2;
1837 gcc_assert (known_eq (out_nelts, TYPE_VECTOR_SUBPARTS (type)))((void)(!((!maybe_ne (out_nelts, TYPE_VECTOR_SUBPARTS (type))
)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1837, __FUNCTION__), 0 : 0))
;
1838
1839 unsigned int offset = 0;
1840 if ((!BYTES_BIG_ENDIAN0) ^ (code == VEC_UNPACK_LO_EXPR
1841 || code == VEC_UNPACK_FLOAT_LO_EXPR
1842 || code == VEC_UNPACK_FIX_TRUNC_LO_EXPR))
1843 offset = out_nelts;
1844
1845 if (code == VEC_UNPACK_LO_EXPR || code == VEC_UNPACK_HI_EXPR)
1846 subcode = NOP_EXPR;
1847 else if (code == VEC_UNPACK_FLOAT_LO_EXPR
1848 || code == VEC_UNPACK_FLOAT_HI_EXPR)
1849 subcode = FLOAT_EXPR;
1850 else
1851 subcode = FIX_TRUNC_EXPR;
1852
1853 tree_vector_builder elts (type, out_nelts, 1);
1854 for (i = 0; i < out_nelts; i++)
1855 {
1856 tree elt = fold_convert_const (subcode, TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1856, __FUNCTION__))->typed.type)
,
1857 VECTOR_CST_ELT (arg0, i + offset)vector_cst_elt (arg0, i + offset));
1858 if (elt == NULL_TREE(tree) __null || !CONSTANT_CLASS_P (elt)(tree_code_type[(int) (((enum tree_code) (elt)->base.code)
)] == tcc_constant)
)
1859 return NULL_TREE(tree) __null;
1860 elts.quick_push (elt);
1861 }
1862
1863 return elts.build ();
1864 }
1865
1866 case VEC_DUPLICATE_EXPR:
1867 if (CONSTANT_CLASS_P (arg0)(tree_code_type[(int) (((enum tree_code) (arg0)->base.code
))] == tcc_constant)
)
1868 return build_vector_from_val (type, arg0);
1869 return NULL_TREE(tree) __null;
1870
1871 default:
1872 break;
1873 }
1874
1875 return NULL_TREE(tree) __null;
1876}
1877
1878/* Create a sizetype INT_CST node with NUMBER sign extended. KIND
1879 indicates which particular sizetype to create. */
1880
1881tree
1882size_int_kind (poly_int64 number, enum size_type_kind kind)
1883{
1884 return build_int_cst (sizetype_tab[(int) kind], number);
1885}
1886
1887/* Combine operands OP1 and OP2 with arithmetic operation CODE. CODE
1888 is a tree code. The type of the result is taken from the operands.
1889 Both must be equivalent integer types, ala int_binop_types_match_p.
1890 If the operands are constant, so is the result. */
1891
1892tree
1893size_binop_loc (location_t loc, enum tree_code code, tree arg0, tree arg1)
1894{
1895 tree type = TREE_TYPE (arg0)((contains_struct_check ((arg0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1895, __FUNCTION__))->typed.type)
;
1896
1897 if (arg0 == error_mark_nodeglobal_trees[TI_ERROR_MARK] || arg1 == error_mark_nodeglobal_trees[TI_ERROR_MARK])
1898 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
1899
1900 gcc_assert (int_binop_types_match_p (code, TREE_TYPE (arg0),((void)(!(int_binop_types_match_p (code, ((contains_struct_check
((arg0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1900, __FUNCTION__))->typed.type), ((contains_struct_check
((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1901, __FUNCTION__))->typed.type))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1901, __FUNCTION__), 0 : 0))
1901 TREE_TYPE (arg1)))((void)(!(int_binop_types_match_p (code, ((contains_struct_check
((arg0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1900, __FUNCTION__))->typed.type), ((contains_struct_check
((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1901, __FUNCTION__))->typed.type))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1901, __FUNCTION__), 0 : 0))
;
1902
1903 /* Handle the special case of two poly_int constants faster. */
1904 if (poly_int_tree_p (arg0) && poly_int_tree_p (arg1))
1905 {
1906 /* And some specific cases even faster than that. */
1907 if (code == PLUS_EXPR)
1908 {
1909 if (integer_zerop (arg0)
1910 && !TREE_OVERFLOW (tree_strip_any_location_wrapper (arg0))((tree_class_check ((tree_strip_any_location_wrapper (arg0)),
(tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1910, __FUNCTION__))->base.public_flag)
)
1911 return arg1;
1912 if (integer_zerop (arg1)
1913 && !TREE_OVERFLOW (tree_strip_any_location_wrapper (arg1))((tree_class_check ((tree_strip_any_location_wrapper (arg1)),
(tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1913, __FUNCTION__))->base.public_flag)
)
1914 return arg0;
1915 }
1916 else if (code == MINUS_EXPR)
1917 {
1918 if (integer_zerop (arg1)
1919 && !TREE_OVERFLOW (tree_strip_any_location_wrapper (arg1))((tree_class_check ((tree_strip_any_location_wrapper (arg1)),
(tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1919, __FUNCTION__))->base.public_flag)
)
1920 return arg0;
1921 }
1922 else if (code == MULT_EXPR)
1923 {
1924 if (integer_onep (arg0)
1925 && !TREE_OVERFLOW (tree_strip_any_location_wrapper (arg0))((tree_class_check ((tree_strip_any_location_wrapper (arg0)),
(tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1925, __FUNCTION__))->base.public_flag)
)
1926 return arg1;
1927 }
1928
1929 /* Handle general case of two integer constants. For sizetype
1930 constant calculations we always want to know about overflow,
1931 even in the unsigned case. */
1932 tree res = int_const_binop (code, arg0, arg1, -1);
1933 if (res != NULL_TREE(tree) __null)
1934 return res;
1935 }
1936
1937 return fold_build2_loc (loc, code, type, arg0, arg1);
1938}
1939
1940/* Given two values, either both of sizetype or both of bitsizetype,
1941 compute the difference between the two values. Return the value
1942 in signed type corresponding to the type of the operands. */
1943
1944tree
1945size_diffop_loc (location_t loc, tree arg0, tree arg1)
1946{
1947 tree type = TREE_TYPE (arg0)((contains_struct_check ((arg0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1947, __FUNCTION__))->typed.type)
;
1948 tree ctype;
1949
1950 gcc_assert (int_binop_types_match_p (MINUS_EXPR, TREE_TYPE (arg0),((void)(!(int_binop_types_match_p (MINUS_EXPR, ((contains_struct_check
((arg0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1950, __FUNCTION__))->typed.type), ((contains_struct_check
((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1951, __FUNCTION__))->typed.type))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1951, __FUNCTION__), 0 : 0))
1951 TREE_TYPE (arg1)))((void)(!(int_binop_types_match_p (MINUS_EXPR, ((contains_struct_check
((arg0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1950, __FUNCTION__))->typed.type), ((contains_struct_check
((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1951, __FUNCTION__))->typed.type))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1951, __FUNCTION__), 0 : 0))
;
1952
1953 /* If the type is already signed, just do the simple thing. */
1954 if (!TYPE_UNSIGNED (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1954, __FUNCTION__))->base.u.bits.unsigned_flag)
)
1955 return size_binop_loc (loc, MINUS_EXPR, arg0, arg1);
1956
1957 if (type == sizetypesizetype_tab[(int) stk_sizetype])
1958 ctype = ssizetypesizetype_tab[(int) stk_ssizetype];
1959 else if (type == bitsizetypesizetype_tab[(int) stk_bitsizetype])
1960 ctype = sbitsizetypesizetype_tab[(int) stk_sbitsizetype];
1961 else
1962 ctype = signed_type_for (type);
1963
1964 /* If either operand is not a constant, do the conversions to the signed
1965 type and subtract. The hardware will do the right thing with any
1966 overflow in the subtraction. */
1967 if (TREE_CODE (arg0)((enum tree_code) (arg0)->base.code) != INTEGER_CST || TREE_CODE (arg1)((enum tree_code) (arg1)->base.code) != INTEGER_CST)
1968 return size_binop_loc (loc, MINUS_EXPR,
1969 fold_convert_loc (loc, ctype, arg0),
1970 fold_convert_loc (loc, ctype, arg1));
1971
1972 /* If ARG0 is larger than ARG1, subtract and return the result in CTYPE.
1973 Otherwise, subtract the other way, convert to CTYPE (we know that can't
1974 overflow) and negate (which can't either). Special-case a result
1975 of zero while we're here. */
1976 if (tree_int_cst_equal (arg0, arg1))
1977 return build_int_cst (ctype, 0);
1978 else if (tree_int_cst_lt (arg1, arg0))
1979 return fold_convert_loc (loc, ctype,
1980 size_binop_loc (loc, MINUS_EXPR, arg0, arg1));
1981 else
1982 return size_binop_loc (loc, MINUS_EXPR, build_int_cst (ctype, 0),
1983 fold_convert_loc (loc, ctype,
1984 size_binop_loc (loc,
1985 MINUS_EXPR,
1986 arg1, arg0)));
1987}
1988
1989/* A subroutine of fold_convert_const handling conversions of an
1990 INTEGER_CST to another integer type. */
1991
1992static tree
1993fold_convert_const_int_from_int (tree type, const_tree arg1)
1994{
1995 /* Given an integer constant, make new constant with new type,
1996 appropriately sign-extended or truncated. Use widest_int
1997 so that any extension is done according ARG1's type. */
1998 return force_fit_type (type, wi::to_widest (arg1),
1999 !POINTER_TYPE_P (TREE_TYPE (arg1))(((enum tree_code) (((contains_struct_check ((arg1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1999, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE
|| ((enum tree_code) (((contains_struct_check ((arg1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 1999, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
)
,
2000 TREE_OVERFLOW (arg1)((tree_class_check ((arg1), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2000, __FUNCTION__))->base.public_flag)
);
2001}
2002
2003/* A subroutine of fold_convert_const handling conversions a REAL_CST
2004 to an integer type. */
2005
2006static tree
2007fold_convert_const_int_from_real (enum tree_code code, tree type, const_tree arg1)
2008{
2009 bool overflow = false;
2010 tree t;
2011
2012 /* The following code implements the floating point to integer
2013 conversion rules required by the Java Language Specification,
2014 that IEEE NaNs are mapped to zero and values that overflow
2015 the target precision saturate, i.e. values greater than
2016 INT_MAX are mapped to INT_MAX, and values less than INT_MIN
2017 are mapped to INT_MIN. These semantics are allowed by the
2018 C and C++ standards that simply state that the behavior of
2019 FP-to-integer conversion is unspecified upon overflow. */
2020
2021 wide_int val;
2022 REAL_VALUE_TYPEstruct real_value r;
2023 REAL_VALUE_TYPEstruct real_value x = TREE_REAL_CST (arg1)(*((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2023, __FUNCTION__, (REAL_CST)))->real_cst.real_cst_ptr)
)
;
2024
2025 switch (code)
2026 {
2027 case FIX_TRUNC_EXPR:
2028 real_trunc (&r, VOIDmode((void) 0, E_VOIDmode), &x);
2029 break;
2030
2031 default:
2032 gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2032, __FUNCTION__))
;
2033 }
2034
2035 /* If R is NaN, return zero and show we have an overflow. */
2036 if (REAL_VALUE_ISNAN (r)real_isnan (&(r)))
2037 {
2038 overflow = true;
2039 val = wi::zero (TYPE_PRECISION (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2039, __FUNCTION__))->type_common.precision)
);
2040 }
2041
2042 /* See if R is less than the lower bound or greater than the
2043 upper bound. */
2044
2045 if (! overflow)
2046 {
2047 tree lt = TYPE_MIN_VALUE (type)((tree_check5 ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2047, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE
), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.minval
)
;
2048 REAL_VALUE_TYPEstruct real_value l = real_value_from_int_cst (NULL_TREE(tree) __null, lt);
2049 if (real_less (&r, &l))
2050 {
2051 overflow = true;
2052 val = wi::to_wide (lt);
2053 }
2054 }
2055
2056 if (! overflow)
2057 {
2058 tree ut = TYPE_MAX_VALUE (type)((tree_check5 ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2058, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE
), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval
)
;
2059 if (ut)
2060 {
2061 REAL_VALUE_TYPEstruct real_value u = real_value_from_int_cst (NULL_TREE(tree) __null, ut);
2062 if (real_less (&u, &r))
2063 {
2064 overflow = true;
2065 val = wi::to_wide (ut);
2066 }
2067 }
2068 }
2069
2070 if (! overflow)
2071 val = real_to_integer (&r, &overflow, TYPE_PRECISION (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2071, __FUNCTION__))->type_common.precision)
);
2072
2073 t = force_fit_type (type, val, -1, overflow | TREE_OVERFLOW (arg1)((tree_class_check ((arg1), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2073, __FUNCTION__))->base.public_flag)
);
2074 return t;
2075}
2076
2077/* A subroutine of fold_convert_const handling conversions of a
2078 FIXED_CST to an integer type. */
2079
2080static tree
2081fold_convert_const_int_from_fixed (tree type, const_tree arg1)
2082{
2083 tree t;
2084 double_int temp, temp_trunc;
2085 scalar_mode mode;
2086
2087 /* Right shift FIXED_CST to temp by fbit. */
2088 temp = TREE_FIXED_CST (arg1)(*((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2088, __FUNCTION__, (FIXED_CST)))->fixed_cst.fixed_cst_ptr
))
.data;
2089 mode = TREE_FIXED_CST (arg1)(*((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2089, __FUNCTION__, (FIXED_CST)))->fixed_cst.fixed_cst_ptr
))
.mode;
2090 if (GET_MODE_FBIT (mode)mode_fbit[mode] < HOST_BITS_PER_DOUBLE_INT(2 * 64))
2091 {
2092 temp = temp.rshift (GET_MODE_FBIT (mode)mode_fbit[mode],
2093 HOST_BITS_PER_DOUBLE_INT(2 * 64),
2094 SIGNED_FIXED_POINT_MODE_P (mode)((((enum mode_class) mode_class[mode]) == MODE_FRACT || ((enum
mode_class) mode_class[mode]) == MODE_VECTOR_FRACT) || (((enum
mode_class) mode_class[mode]) == MODE_ACCUM || ((enum mode_class
) mode_class[mode]) == MODE_VECTOR_ACCUM))
);
2095
2096 /* Left shift temp to temp_trunc by fbit. */
2097 temp_trunc = temp.lshift (GET_MODE_FBIT (mode)mode_fbit[mode],
2098 HOST_BITS_PER_DOUBLE_INT(2 * 64),
2099 SIGNED_FIXED_POINT_MODE_P (mode)((((enum mode_class) mode_class[mode]) == MODE_FRACT || ((enum
mode_class) mode_class[mode]) == MODE_VECTOR_FRACT) || (((enum
mode_class) mode_class[mode]) == MODE_ACCUM || ((enum mode_class
) mode_class[mode]) == MODE_VECTOR_ACCUM))
);
2100 }
2101 else
2102 {
2103 temp = double_int_zero(double_int::from_shwi (0));
2104 temp_trunc = double_int_zero(double_int::from_shwi (0));
2105 }
2106
2107 /* If FIXED_CST is negative, we need to round the value toward 0.
2108 By checking if the fractional bits are not zero to add 1 to temp. */
2109 if (SIGNED_FIXED_POINT_MODE_P (mode)((((enum mode_class) mode_class[mode]) == MODE_FRACT || ((enum
mode_class) mode_class[mode]) == MODE_VECTOR_FRACT) || (((enum
mode_class) mode_class[mode]) == MODE_ACCUM || ((enum mode_class
) mode_class[mode]) == MODE_VECTOR_ACCUM))
2110 && temp_trunc.is_negative ()
2111 && TREE_FIXED_CST (arg1)(*((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2111, __FUNCTION__, (FIXED_CST)))->fixed_cst.fixed_cst_ptr
))
.data != temp_trunc)
2112 temp += double_int_one(double_int::from_shwi (1));
2113
2114 /* Given a fixed-point constant, make new constant with new type,
2115 appropriately sign-extended or truncated. */
2116 t = force_fit_type (type, temp, -1,
2117 (temp.is_negative ()
2118 && (TYPE_UNSIGNED (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2118, __FUNCTION__))->base.u.bits.unsigned_flag)
2119 < TYPE_UNSIGNED (TREE_TYPE (arg1))((tree_class_check ((((contains_struct_check ((arg1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2119, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2119, __FUNCTION__))->base.u.bits.unsigned_flag)
))
2120 | TREE_OVERFLOW (arg1)((tree_class_check ((arg1), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2120, __FUNCTION__))->base.public_flag)
);
2121
2122 return t;
2123}
2124
2125/* A subroutine of fold_convert_const handling conversions a REAL_CST
2126 to another floating point type. */
2127
2128static tree
2129fold_convert_const_real_from_real (tree type, const_tree arg1)
2130{
2131 REAL_VALUE_TYPEstruct real_value value;
2132 tree t;
2133
2134 /* Don't perform the operation if flag_signaling_nans is on
2135 and the operand is a signaling NaN. */
2136 if (HONOR_SNANS (TYPE_MODE (TREE_TYPE (arg1))((((enum tree_code) ((tree_class_check ((((contains_struct_check
((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2136, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2136, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2136, __FUNCTION__))->typed.type)) : (((contains_struct_check
((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2136, __FUNCTION__))->typed.type))->type_common.mode)
)
2137 && REAL_VALUE_ISSIGNALING_NAN (TREE_REAL_CST (arg1))real_issignaling_nan (&((*((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2137, __FUNCTION__, (REAL_CST)))->real_cst.real_cst_ptr)
)))
)
2138 return NULL_TREE(tree) __null;
2139
2140 real_convert (&value, TYPE_MODE (type)((((enum tree_code) ((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2140, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(type) : (type)->type_common.mode)
, &TREE_REAL_CST (arg1)(*((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2140, __FUNCTION__, (REAL_CST)))->real_cst.real_cst_ptr)
)
);
2141 t = build_real (type, value);
2142
2143 /* If converting an infinity or NAN to a representation that doesn't
2144 have one, set the overflow bit so that we can produce some kind of
2145 error message at the appropriate point if necessary. It's not the
2146 most user-friendly message, but it's better than nothing. */
2147 if (REAL_VALUE_ISINF (TREE_REAL_CST (arg1))real_isinf (&((*((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2147, __FUNCTION__, (REAL_CST)))->real_cst.real_cst_ptr)
)))
2148 && !MODE_HAS_INFINITIES (TYPE_MODE (type))((((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check
((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2148, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(type) : (type)->type_common.mode)]) == MODE_FLOAT || ((enum
mode_class) mode_class[((((enum tree_code) ((tree_class_check
((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2148, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(type) : (type)->type_common.mode)]) == MODE_DECIMAL_FLOAT
|| ((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check
((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2148, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(type) : (type)->type_common.mode)]) == MODE_COMPLEX_FLOAT
|| ((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check
((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2148, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(type) : (type)->type_common.mode)]) == MODE_VECTOR_FLOAT
) && ((real_format_for_mode[(((enum mode_class) mode_class
[as_a <scalar_float_mode> ((mode_to_inner (((((enum tree_code
) ((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2148, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(type) : (type)->type_common.mode))))]) == MODE_DECIMAL_FLOAT
) ? (((as_a <scalar_float_mode> ((mode_to_inner (((((enum
tree_code) ((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2148, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(type) : (type)->type_common.mode))))) - MIN_MODE_DECIMAL_FLOAT
) + (MAX_MODE_FLOAT - MIN_MODE_FLOAT + 1)) : ((enum mode_class
) mode_class[as_a <scalar_float_mode> ((mode_to_inner (
((((enum tree_code) ((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2148, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(type) : (type)->type_common.mode))))]) == MODE_FLOAT ? (
(as_a <scalar_float_mode> ((mode_to_inner (((((enum tree_code
) ((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2148, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(type) : (type)->type_common.mode))))) - MIN_MODE_FLOAT) :
((fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2148, __FUNCTION__)), 0)]))->has_inf)
)
2149 TREE_OVERFLOW (t)((tree_class_check ((t), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2149, __FUNCTION__))->base.public_flag)
= 1;
2150 else if (REAL_VALUE_ISNAN (TREE_REAL_CST (arg1))real_isnan (&((*((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2150, __FUNCTION__, (REAL_CST)))->real_cst.real_cst_ptr)
)))
2151 && !MODE_HAS_NANS (TYPE_MODE (type))((((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check
((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2151, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(type) : (type)->type_common.mode)]) == MODE_FLOAT || ((enum
mode_class) mode_class[((((enum tree_code) ((tree_class_check
((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2151, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(type) : (type)->type_common.mode)]) == MODE_DECIMAL_FLOAT
|| ((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check
((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2151, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(type) : (type)->type_common.mode)]) == MODE_COMPLEX_FLOAT
|| ((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check
((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2151, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(type) : (type)->type_common.mode)]) == MODE_VECTOR_FLOAT
) && ((real_format_for_mode[(((enum mode_class) mode_class
[as_a <scalar_float_mode> ((mode_to_inner (((((enum tree_code
) ((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2151, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(type) : (type)->type_common.mode))))]) == MODE_DECIMAL_FLOAT
) ? (((as_a <scalar_float_mode> ((mode_to_inner (((((enum
tree_code) ((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2151, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(type) : (type)->type_common.mode))))) - MIN_MODE_DECIMAL_FLOAT
) + (MAX_MODE_FLOAT - MIN_MODE_FLOAT + 1)) : ((enum mode_class
) mode_class[as_a <scalar_float_mode> ((mode_to_inner (
((((enum tree_code) ((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2151, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(type) : (type)->type_common.mode))))]) == MODE_FLOAT ? (
(as_a <scalar_float_mode> ((mode_to_inner (((((enum tree_code
) ((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2151, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(type) : (type)->type_common.mode))))) - MIN_MODE_FLOAT) :
((fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2151, __FUNCTION__)), 0)]))->has_nans)
)
2152 TREE_OVERFLOW (t)((tree_class_check ((t), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2152, __FUNCTION__))->base.public_flag)
= 1;
2153 /* Regular overflow, conversion produced an infinity in a mode that
2154 can't represent them. */
2155 else if (!MODE_HAS_INFINITIES (TYPE_MODE (type))((((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check
((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2155, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(type) : (type)->type_common.mode)]) == MODE_FLOAT || ((enum
mode_class) mode_class[((((enum tree_code) ((tree_class_check
((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2155, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(type) : (type)->type_common.mode)]) == MODE_DECIMAL_FLOAT
|| ((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check
((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2155, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(type) : (type)->type_common.mode)]) == MODE_COMPLEX_FLOAT
|| ((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check
((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2155, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(type) : (type)->type_common.mode)]) == MODE_VECTOR_FLOAT
) && ((real_format_for_mode[(((enum mode_class) mode_class
[as_a <scalar_float_mode> ((mode_to_inner (((((enum tree_code
) ((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2155, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(type) : (type)->type_common.mode))))]) == MODE_DECIMAL_FLOAT
) ? (((as_a <scalar_float_mode> ((mode_to_inner (((((enum
tree_code) ((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2155, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(type) : (type)->type_common.mode))))) - MIN_MODE_DECIMAL_FLOAT
) + (MAX_MODE_FLOAT - MIN_MODE_FLOAT + 1)) : ((enum mode_class
) mode_class[as_a <scalar_float_mode> ((mode_to_inner (
((((enum tree_code) ((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2155, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(type) : (type)->type_common.mode))))]) == MODE_FLOAT ? (
(as_a <scalar_float_mode> ((mode_to_inner (((((enum tree_code
) ((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2155, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(type) : (type)->type_common.mode))))) - MIN_MODE_FLOAT) :
((fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2155, __FUNCTION__)), 0)]))->has_inf)
2156 && REAL_VALUE_ISINF (value)real_isinf (&(value))
2157 && !REAL_VALUE_ISINF (TREE_REAL_CST (arg1))real_isinf (&((*((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2157, __FUNCTION__, (REAL_CST)))->real_cst.real_cst_ptr)
)))
)
2158 TREE_OVERFLOW (t)((tree_class_check ((t), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2158, __FUNCTION__))->base.public_flag)
= 1;
2159 else
2160 TREE_OVERFLOW (t)((tree_class_check ((t), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2160, __FUNCTION__))->base.public_flag)
= TREE_OVERFLOW (arg1)((tree_class_check ((arg1), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2160, __FUNCTION__))->base.public_flag)
;
2161 return t;
2162}
2163
2164/* A subroutine of fold_convert_const handling conversions a FIXED_CST
2165 to a floating point type. */
2166
2167static tree
2168fold_convert_const_real_from_fixed (tree type, const_tree arg1)
2169{
2170 REAL_VALUE_TYPEstruct real_value value;
2171 tree t;
2172
2173 real_convert_from_fixed (&value, SCALAR_FLOAT_TYPE_MODE (type)(as_a <scalar_float_mode> ((tree_class_check ((type), (
tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2173, __FUNCTION__))->type_common.mode))
,
2174 &TREE_FIXED_CST (arg1)(*((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2174, __FUNCTION__, (FIXED_CST)))->fixed_cst.fixed_cst_ptr
))
);
2175 t = build_real (type, value);
2176
2177 TREE_OVERFLOW (t)((tree_class_check ((t), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2177, __FUNCTION__))->base.public_flag)
= TREE_OVERFLOW (arg1)((tree_class_check ((arg1), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2177, __FUNCTION__))->base.public_flag)
;
2178 return t;
2179}
2180
2181/* A subroutine of fold_convert_const handling conversions a FIXED_CST
2182 to another fixed-point type. */
2183
2184static tree
2185fold_convert_const_fixed_from_fixed (tree type, const_tree arg1)
2186{
2187 FIXED_VALUE_TYPEstruct fixed_value value;
2188 tree t;
2189 bool overflow_p;
2190
2191 overflow_p = fixed_convert (&value, SCALAR_TYPE_MODE (type)(as_a <scalar_mode> ((tree_class_check ((type), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2191, __FUNCTION__))->type_common.mode))
,
2192 &TREE_FIXED_CST (arg1)(*((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2192, __FUNCTION__, (FIXED_CST)))->fixed_cst.fixed_cst_ptr
))
, TYPE_SATURATING (type)((tree_not_check4 ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2192, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
), (ARRAY_TYPE)))->base.u.bits.saturating_flag)
);
2193 t = build_fixed (type, value);
2194
2195 /* Propagate overflow flags. */
2196 if (overflow_p | TREE_OVERFLOW (arg1)((tree_class_check ((arg1), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2196, __FUNCTION__))->base.public_flag)
)
2197 TREE_OVERFLOW (t)((tree_class_check ((t), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2197, __FUNCTION__))->base.public_flag)
= 1;
2198 return t;
2199}
2200
2201/* A subroutine of fold_convert_const handling conversions an INTEGER_CST
2202 to a fixed-point type. */
2203
2204static tree
2205fold_convert_const_fixed_from_int (tree type, const_tree arg1)
2206{
2207 FIXED_VALUE_TYPEstruct fixed_value value;
2208 tree t;
2209 bool overflow_p;
2210 double_int di;
2211
2212 gcc_assert (TREE_INT_CST_NUNITS (arg1) <= 2)((void)(!(((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2212, __FUNCTION__, (INTEGER_CST)))->base.u.int_length.unextended
) <= 2) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2212, __FUNCTION__), 0 : 0))
;
2213
2214 di.low = TREE_INT_CST_ELT (arg1, 0)(*tree_int_cst_elt_check ((arg1), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2214, __FUNCTION__))
;
2215 if (TREE_INT_CST_NUNITS (arg1)((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2215, __FUNCTION__, (INTEGER_CST)))->base.u.int_length.unextended
)
== 1)
2216 di.high = (HOST_WIDE_INTlong) di.low < 0 ? HOST_WIDE_INT_M1-1L : 0;
2217 else
2218 di.high = TREE_INT_CST_ELT (arg1, 1)(*tree_int_cst_elt_check ((arg1), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2218, __FUNCTION__))
;
2219
2220 overflow_p = fixed_convert_from_int (&value, SCALAR_TYPE_MODE (type)(as_a <scalar_mode> ((tree_class_check ((type), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2220, __FUNCTION__))->type_common.mode))
, di,
2221 TYPE_UNSIGNED (TREE_TYPE (arg1))((tree_class_check ((((contains_struct_check ((arg1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2221, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2221, __FUNCTION__))->base.u.bits.unsigned_flag)
,
2222 TYPE_SATURATING (type)((tree_not_check4 ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2222, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
), (ARRAY_TYPE)))->base.u.bits.saturating_flag)
);
2223 t = build_fixed (type, value);
2224
2225 /* Propagate overflow flags. */
2226 if (overflow_p | TREE_OVERFLOW (arg1)((tree_class_check ((arg1), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2226, __FUNCTION__))->base.public_flag)
)
2227 TREE_OVERFLOW (t)((tree_class_check ((t), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2227, __FUNCTION__))->base.public_flag)
= 1;
2228 return t;
2229}
2230
2231/* A subroutine of fold_convert_const handling conversions a REAL_CST
2232 to a fixed-point type. */
2233
2234static tree
2235fold_convert_const_fixed_from_real (tree type, const_tree arg1)
2236{
2237 FIXED_VALUE_TYPEstruct fixed_value value;
2238 tree t;
2239 bool overflow_p;
2240
2241 overflow_p = fixed_convert_from_real (&value, SCALAR_TYPE_MODE (type)(as_a <scalar_mode> ((tree_class_check ((type), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2241, __FUNCTION__))->type_common.mode))
,
2242 &TREE_REAL_CST (arg1)(*((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2242, __FUNCTION__, (REAL_CST)))->real_cst.real_cst_ptr)
)
,
2243 TYPE_SATURATING (type)((tree_not_check4 ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2243, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
), (ARRAY_TYPE)))->base.u.bits.saturating_flag)
);
2244 t = build_fixed (type, value);
2245
2246 /* Propagate overflow flags. */
2247 if (overflow_p | TREE_OVERFLOW (arg1)((tree_class_check ((arg1), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2247, __FUNCTION__))->base.public_flag)
)
2248 TREE_OVERFLOW (t)((tree_class_check ((t), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2248, __FUNCTION__))->base.public_flag)
= 1;
2249 return t;
2250}
2251
2252/* Attempt to fold type conversion operation CODE of expression ARG1 to
2253 type TYPE. If no simplification can be done return NULL_TREE. */
2254
2255static tree
2256fold_convert_const (enum tree_code code, tree type, tree arg1)
2257{
2258 tree arg_type = TREE_TYPE (arg1)((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2258, __FUNCTION__))->typed.type)
;
2259 if (arg_type == type)
2260 return arg1;
2261
2262 /* We can't widen types, since the runtime value could overflow the
2263 original type before being extended to the new type. */
2264 if (POLY_INT_CST_P (arg1)(1 > 1 && ((enum tree_code) (arg1)->base.code) ==
POLY_INT_CST)
2265 && (POINTER_TYPE_P (type)(((enum tree_code) (type)->base.code) == POINTER_TYPE || (
(enum tree_code) (type)->base.code) == REFERENCE_TYPE)
|| 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)
)
2266 && TYPE_PRECISION (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2266, __FUNCTION__))->type_common.precision)
<= TYPE_PRECISION (arg_type)((tree_class_check ((arg_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2266, __FUNCTION__))->type_common.precision)
)
2267 return build_poly_int_cst (type,
2268 poly_wide_int::from (poly_int_cst_value (arg1),
2269 TYPE_PRECISION (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2269, __FUNCTION__))->type_common.precision)
,
2270 TYPE_SIGN (arg_type)((signop) ((tree_class_check ((arg_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2270, __FUNCTION__))->base.u.bits.unsigned_flag))
));
2271
2272 if (POINTER_TYPE_P (type)(((enum tree_code) (type)->base.code) == POINTER_TYPE || (
(enum tree_code) (type)->base.code) == REFERENCE_TYPE)
|| 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)
2273 || TREE_CODE (type)((enum tree_code) (type)->base.code) == OFFSET_TYPE)
2274 {
2275 if (TREE_CODE (arg1)((enum tree_code) (arg1)->base.code) == INTEGER_CST)
2276 return fold_convert_const_int_from_int (type, arg1);
2277 else if (TREE_CODE (arg1)((enum tree_code) (arg1)->base.code) == REAL_CST)
2278 return fold_convert_const_int_from_real (code, type, arg1);
2279 else if (TREE_CODE (arg1)((enum tree_code) (arg1)->base.code) == FIXED_CST)
2280 return fold_convert_const_int_from_fixed (type, arg1);
2281 }
2282 else if (TREE_CODE (type)((enum tree_code) (type)->base.code) == REAL_TYPE)
2283 {
2284 if (TREE_CODE (arg1)((enum tree_code) (arg1)->base.code) == INTEGER_CST)
2285 return build_real_from_int_cst (type, arg1);
2286 else if (TREE_CODE (arg1)((enum tree_code) (arg1)->base.code) == REAL_CST)
2287 return fold_convert_const_real_from_real (type, arg1);
2288 else if (TREE_CODE (arg1)((enum tree_code) (arg1)->base.code) == FIXED_CST)
2289 return fold_convert_const_real_from_fixed (type, arg1);
2290 }
2291 else if (TREE_CODE (type)((enum tree_code) (type)->base.code) == FIXED_POINT_TYPE)
2292 {
2293 if (TREE_CODE (arg1)((enum tree_code) (arg1)->base.code) == FIXED_CST)
2294 return fold_convert_const_fixed_from_fixed (type, arg1);
2295 else if (TREE_CODE (arg1)((enum tree_code) (arg1)->base.code) == INTEGER_CST)
2296 return fold_convert_const_fixed_from_int (type, arg1);
2297 else if (TREE_CODE (arg1)((enum tree_code) (arg1)->base.code) == REAL_CST)
2298 return fold_convert_const_fixed_from_real (type, arg1);
2299 }
2300 else if (TREE_CODE (type)((enum tree_code) (type)->base.code) == VECTOR_TYPE)
2301 {
2302 if (TREE_CODE (arg1)((enum tree_code) (arg1)->base.code) == VECTOR_CST
2303 && known_eq (TYPE_VECTOR_SUBPARTS (type), VECTOR_CST_NELTS (arg1))(!maybe_ne (TYPE_VECTOR_SUBPARTS (type), (TYPE_VECTOR_SUBPARTS
(((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2303, __FUNCTION__))->typed.type)))))
)
2304 {
2305 tree elttype = TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2305, __FUNCTION__))->typed.type)
;
2306 tree arg1_elttype = TREE_TYPE (TREE_TYPE (arg1))((contains_struct_check ((((contains_struct_check ((arg1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2306, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2306, __FUNCTION__))->typed.type)
;
2307 /* We can't handle steps directly when extending, since the
2308 values need to wrap at the original precision first. */
2309 bool step_ok_p
2310 = (INTEGRAL_TYPE_P (elttype)(((enum tree_code) (elttype)->base.code) == ENUMERAL_TYPE ||
((enum tree_code) (elttype)->base.code) == BOOLEAN_TYPE ||
((enum tree_code) (elttype)->base.code) == INTEGER_TYPE)
2311 && INTEGRAL_TYPE_P (arg1_elttype)(((enum tree_code) (arg1_elttype)->base.code) == ENUMERAL_TYPE
|| ((enum tree_code) (arg1_elttype)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (arg1_elttype)->base.code) == INTEGER_TYPE
)
2312 && TYPE_PRECISION (elttype)((tree_class_check ((elttype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2312, __FUNCTION__))->type_common.precision)
<= TYPE_PRECISION (arg1_elttype)((tree_class_check ((arg1_elttype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2312, __FUNCTION__))->type_common.precision)
);
2313 tree_vector_builder v;
2314 if (!v.new_unary_operation (type, arg1, step_ok_p))
2315 return NULL_TREE(tree) __null;
2316 unsigned int len = v.encoded_nelts ();
2317 for (unsigned int i = 0; i < len; ++i)
2318 {
2319 tree elt = VECTOR_CST_ELT (arg1, i)vector_cst_elt (arg1, i);
2320 tree cvt = fold_convert_const (code, elttype, elt);
2321 if (cvt == NULL_TREE(tree) __null)
2322 return NULL_TREE(tree) __null;
2323 v.quick_push (cvt);
2324 }
2325 return v.build ();
2326 }
2327 }
2328 return NULL_TREE(tree) __null;
2329}
2330
2331/* Construct a vector of zero elements of vector type TYPE. */
2332
2333static tree
2334build_zero_vector (tree type)
2335{
2336 tree t;
2337
2338 t = fold_convert_const (NOP_EXPR, TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2338, __FUNCTION__))->typed.type)
, integer_zero_nodeglobal_trees[TI_INTEGER_ZERO]);
2339 return build_vector_from_val (type, t);
2340}
2341
2342/* Returns true, if ARG is convertible to TYPE using a NOP_EXPR. */
2343
2344bool
2345fold_convertible_p (const_tree type, const_tree arg)
2346{
2347 tree orig = TREE_TYPE (arg)((contains_struct_check ((arg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2347, __FUNCTION__))->typed.type)
;
2348
2349 if (type == orig)
2350 return true;
2351
2352 if (TREE_CODE (arg)((enum tree_code) (arg)->base.code) == ERROR_MARK
2353 || TREE_CODE (type)((enum tree_code) (type)->base.code) == ERROR_MARK
2354 || TREE_CODE (orig)((enum tree_code) (orig)->base.code) == ERROR_MARK)
2355 return false;
2356
2357 if (TYPE_MAIN_VARIANT (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2357, __FUNCTION__))->type_common.main_variant)
== TYPE_MAIN_VARIANT (orig)((tree_class_check ((orig), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2357, __FUNCTION__))->type_common.main_variant)
)
2358 return true;
2359
2360 switch (TREE_CODE (type)((enum tree_code) (type)->base.code))
2361 {
2362 case INTEGER_TYPE: case ENUMERAL_TYPE: case BOOLEAN_TYPE:
2363 case POINTER_TYPE: case REFERENCE_TYPE:
2364 case OFFSET_TYPE:
2365 return (INTEGRAL_TYPE_P (orig)(((enum tree_code) (orig)->base.code) == ENUMERAL_TYPE || (
(enum tree_code) (orig)->base.code) == BOOLEAN_TYPE || ((enum
tree_code) (orig)->base.code) == INTEGER_TYPE)
2366 || (POINTER_TYPE_P (orig)(((enum tree_code) (orig)->base.code) == POINTER_TYPE || (
(enum tree_code) (orig)->base.code) == REFERENCE_TYPE)
2367 && TYPE_PRECISION (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2367, __FUNCTION__))->type_common.precision)
<= TYPE_PRECISION (orig)((tree_class_check ((orig), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2367, __FUNCTION__))->type_common.precision)
)
2368 || TREE_CODE (orig)((enum tree_code) (orig)->base.code) == OFFSET_TYPE);
2369
2370 case REAL_TYPE:
2371 case FIXED_POINT_TYPE:
2372 case VOID_TYPE:
2373 return TREE_CODE (type)((enum tree_code) (type)->base.code) == TREE_CODE (orig)((enum tree_code) (orig)->base.code);
2374
2375 case VECTOR_TYPE:
2376 return (VECTOR_TYPE_P (orig)(((enum tree_code) (orig)->base.code) == VECTOR_TYPE)
2377 && known_eq (TYPE_VECTOR_SUBPARTS (type),(!maybe_ne (TYPE_VECTOR_SUBPARTS (type), TYPE_VECTOR_SUBPARTS
(orig)))
2378 TYPE_VECTOR_SUBPARTS (orig))(!maybe_ne (TYPE_VECTOR_SUBPARTS (type), TYPE_VECTOR_SUBPARTS
(orig)))
2379 && fold_convertible_p (TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2379, __FUNCTION__))->typed.type)
, TREE_TYPE (orig)((contains_struct_check ((orig), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2379, __FUNCTION__))->typed.type)
));
2380
2381 default:
2382 return false;
2383 }
2384}
2385
2386/* Convert expression ARG to type TYPE. Used by the middle-end for
2387 simple conversions in preference to calling the front-end's convert. */
2388
2389tree
2390fold_convert_loc (location_t loc, tree type, tree arg)
2391{
2392 tree orig = TREE_TYPE (arg)((contains_struct_check ((arg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2392, __FUNCTION__))->typed.type)
;
2393 tree tem;
2394
2395 if (type == orig)
2396 return arg;
2397
2398 if (TREE_CODE (arg)((enum tree_code) (arg)->base.code) == ERROR_MARK
2399 || TREE_CODE (type)((enum tree_code) (type)->base.code) == ERROR_MARK
2400 || TREE_CODE (orig)((enum tree_code) (orig)->base.code) == ERROR_MARK)
2401 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2402
2403 switch (TREE_CODE (type)((enum tree_code) (type)->base.code))
2404 {
2405 case POINTER_TYPE:
2406 case REFERENCE_TYPE:
2407 /* Handle conversions between pointers to different address spaces. */
2408 if (POINTER_TYPE_P (orig)(((enum tree_code) (orig)->base.code) == POINTER_TYPE || (
(enum tree_code) (orig)->base.code) == REFERENCE_TYPE)
2409 && (TYPE_ADDR_SPACE (TREE_TYPE (type))((tree_class_check ((((contains_struct_check ((type), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2409, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2409, __FUNCTION__))->base.u.bits.address_space)
2410 != TYPE_ADDR_SPACE (TREE_TYPE (orig))((tree_class_check ((((contains_struct_check ((orig), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2410, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2410, __FUNCTION__))->base.u.bits.address_space)
))
2411 return fold_build1_loc (loc, ADDR_SPACE_CONVERT_EXPR, type, arg);
2412 /* fall through */
2413
2414 case INTEGER_TYPE: case ENUMERAL_TYPE: case BOOLEAN_TYPE:
2415 case OFFSET_TYPE:
2416 if (TREE_CODE (arg)((enum tree_code) (arg)->base.code) == INTEGER_CST)
2417 {
2418 tem = fold_convert_const (NOP_EXPR, type, arg);
2419 if (tem != NULL_TREE(tree) __null)
2420 return tem;
2421 }
2422 if (INTEGRAL_TYPE_P (orig)(((enum tree_code) (orig)->base.code) == ENUMERAL_TYPE || (
(enum tree_code) (orig)->base.code) == BOOLEAN_TYPE || ((enum
tree_code) (orig)->base.code) == INTEGER_TYPE)
|| POINTER_TYPE_P (orig)(((enum tree_code) (orig)->base.code) == POINTER_TYPE || (
(enum tree_code) (orig)->base.code) == REFERENCE_TYPE)
2423 || TREE_CODE (orig)((enum tree_code) (orig)->base.code) == OFFSET_TYPE)
2424 return fold_build1_loc (loc, NOP_EXPR, type, arg);
2425 if (TREE_CODE (orig)((enum tree_code) (orig)->base.code) == COMPLEX_TYPE)
2426 return fold_convert_loc (loc, type,
2427 fold_build1_loc (loc, REALPART_EXPR,
2428 TREE_TYPE (orig)((contains_struct_check ((orig), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2428, __FUNCTION__))->typed.type)
, arg));
2429 gcc_assert (TREE_CODE (orig) == VECTOR_TYPE((void)(!(((enum tree_code) (orig)->base.code) == VECTOR_TYPE
&& tree_int_cst_equal (((tree_class_check ((type), (
tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2430, __FUNCTION__))->type_common.size), ((tree_class_check
((orig), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2430, __FUNCTION__))->type_common.size))) ? fancy_abort (
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2430, __FUNCTION__), 0 : 0))
2430 && tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (orig)))((void)(!(((enum tree_code) (orig)->base.code) == VECTOR_TYPE
&& tree_int_cst_equal (((tree_class_check ((type), (
tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2430, __FUNCTION__))->type_common.size), ((tree_class_check
((orig), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2430, __FUNCTION__))->type_common.size))) ? fancy_abort (
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2430, __FUNCTION__), 0 : 0))
;
2431 return fold_build1_loc (loc, VIEW_CONVERT_EXPR, type, arg);
2432
2433 case REAL_TYPE:
2434 if (TREE_CODE (arg)((enum tree_code) (arg)->base.code) == INTEGER_CST)
2435 {
2436 tem = fold_convert_const (FLOAT_EXPR, type, arg);
2437 if (tem != NULL_TREE(tree) __null)
2438 return tem;
2439 }
2440 else if (TREE_CODE (arg)((enum tree_code) (arg)->base.code) == REAL_CST)
2441 {
2442 tem = fold_convert_const (NOP_EXPR, type, arg);
2443 if (tem != NULL_TREE(tree) __null)
2444 return tem;
2445 }
2446 else if (TREE_CODE (arg)((enum tree_code) (arg)->base.code) == FIXED_CST)
2447 {
2448 tem = fold_convert_const (FIXED_CONVERT_EXPR, type, arg);
2449 if (tem != NULL_TREE(tree) __null)
2450 return tem;
2451 }
2452
2453 switch (TREE_CODE (orig)((enum tree_code) (orig)->base.code))
2454 {
2455 case INTEGER_TYPE:
2456 case BOOLEAN_TYPE: case ENUMERAL_TYPE:
2457 case POINTER_TYPE: case REFERENCE_TYPE:
2458 return fold_build1_loc (loc, FLOAT_EXPR, type, arg);
2459
2460 case REAL_TYPE:
2461 return fold_build1_loc (loc, NOP_EXPR, type, arg);
2462
2463 case FIXED_POINT_TYPE:
2464 return fold_build1_loc (loc, FIXED_CONVERT_EXPR, type, arg);
2465
2466 case COMPLEX_TYPE:
2467 tem = fold_build1_loc (loc, REALPART_EXPR, TREE_TYPE (orig)((contains_struct_check ((orig), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2467, __FUNCTION__))->typed.type)
, arg);
2468 return fold_convert_loc (loc, type, tem);
2469
2470 default:
2471 gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2471, __FUNCTION__))
;
2472 }
2473
2474 case FIXED_POINT_TYPE:
2475 if (TREE_CODE (arg)((enum tree_code) (arg)->base.code) == FIXED_CST || TREE_CODE (arg)((enum tree_code) (arg)->base.code) == INTEGER_CST
2476 || TREE_CODE (arg)((enum tree_code) (arg)->base.code) == REAL_CST)
2477 {
2478 tem = fold_convert_const (FIXED_CONVERT_EXPR, type, arg);
2479 if (tem != NULL_TREE(tree) __null)
2480 goto fold_convert_exit;
2481 }
2482
2483 switch (TREE_CODE (orig)((enum tree_code) (orig)->base.code))
2484 {
2485 case FIXED_POINT_TYPE:
2486 case INTEGER_TYPE:
2487 case ENUMERAL_TYPE:
2488 case BOOLEAN_TYPE:
2489 case REAL_TYPE:
2490 return fold_build1_loc (loc, FIXED_CONVERT_EXPR, type, arg);
2491
2492 case COMPLEX_TYPE:
2493 tem = fold_build1_loc (loc, REALPART_EXPR, TREE_TYPE (orig)((contains_struct_check ((orig), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2493, __FUNCTION__))->typed.type)
, arg);
2494 return fold_convert_loc (loc, type, tem);
2495
2496 default:
2497 gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2497, __FUNCTION__))
;
2498 }
2499
2500 case COMPLEX_TYPE:
2501 switch (TREE_CODE (orig)((enum tree_code) (orig)->base.code))
2502 {
2503 case INTEGER_TYPE:
2504 case BOOLEAN_TYPE: case ENUMERAL_TYPE:
2505 case POINTER_TYPE: case REFERENCE_TYPE:
2506 case REAL_TYPE:
2507 case FIXED_POINT_TYPE:
2508 return fold_build2_loc (loc, COMPLEX_EXPR, type,
2509 fold_convert_loc (loc, TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2509, __FUNCTION__))->typed.type)
, arg),
2510 fold_convert_loc (loc, TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2510, __FUNCTION__))->typed.type)
,
2511 integer_zero_nodeglobal_trees[TI_INTEGER_ZERO]));
2512 case COMPLEX_TYPE:
2513 {
2514 tree rpart, ipart;
2515
2516 if (TREE_CODE (arg)((enum tree_code) (arg)->base.code) == COMPLEX_EXPR)
2517 {
2518 rpart = fold_convert_loc (loc, TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2518, __FUNCTION__))->typed.type)
,
2519 TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2519, __FUNCTION__)))))
);
2520 ipart = fold_convert_loc (loc, TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2520, __FUNCTION__))->typed.type)
,
2521 TREE_OPERAND (arg, 1)(*((const_cast<tree*> (tree_operand_check ((arg), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2521, __FUNCTION__)))))
);
2522 return fold_build2_loc (loc, COMPLEX_EXPR, type, rpart, ipart);
2523 }
2524
2525 arg = save_expr (arg);
2526 rpart = fold_build1_loc (loc, REALPART_EXPR, TREE_TYPE (orig)((contains_struct_check ((orig), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2526, __FUNCTION__))->typed.type)
, arg);
2527 ipart = fold_build1_loc (loc, IMAGPART_EXPR, TREE_TYPE (orig)((contains_struct_check ((orig), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2527, __FUNCTION__))->typed.type)
, arg);
2528 rpart = fold_convert_loc (loc, TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2528, __FUNCTION__))->typed.type)
, rpart);
2529 ipart = fold_convert_loc (loc, TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2529, __FUNCTION__))->typed.type)
, ipart);
2530 return fold_build2_loc (loc, COMPLEX_EXPR, type, rpart, ipart);
2531 }
2532
2533 default:
2534 gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2534, __FUNCTION__))
;
2535 }
2536
2537 case VECTOR_TYPE:
2538 if (integer_zerop (arg))
2539 return build_zero_vector (type);
2540 gcc_assert (tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (orig)))((void)(!(tree_int_cst_equal (((tree_class_check ((type), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2540, __FUNCTION__))->type_common.size), ((tree_class_check
((orig), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2540, __FUNCTION__))->type_common.size))) ? fancy_abort (
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2540, __FUNCTION__), 0 : 0))
;
2541 gcc_assert (INTEGRAL_TYPE_P (orig) || POINTER_TYPE_P (orig)((void)(!((((enum tree_code) (orig)->base.code) == ENUMERAL_TYPE
|| ((enum tree_code) (orig)->base.code) == BOOLEAN_TYPE ||
((enum tree_code) (orig)->base.code) == INTEGER_TYPE) || (
((enum tree_code) (orig)->base.code) == POINTER_TYPE || ((
enum tree_code) (orig)->base.code) == REFERENCE_TYPE) || (
(enum tree_code) (orig)->base.code) == VECTOR_TYPE) ? fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2542, __FUNCTION__), 0 : 0))
2542 || TREE_CODE (orig) == VECTOR_TYPE)((void)(!((((enum tree_code) (orig)->base.code) == ENUMERAL_TYPE
|| ((enum tree_code) (orig)->base.code) == BOOLEAN_TYPE ||
((enum tree_code) (orig)->base.code) == INTEGER_TYPE) || (
((enum tree_code) (orig)->base.code) == POINTER_TYPE || ((
enum tree_code) (orig)->base.code) == REFERENCE_TYPE) || (
(enum tree_code) (orig)->base.code) == VECTOR_TYPE) ? fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2542, __FUNCTION__), 0 : 0))
;
2543 return fold_build1_loc (loc, VIEW_CONVERT_EXPR, type, arg);
2544
2545 case VOID_TYPE:
2546 tem = fold_ignored_result (arg);
2547 return fold_build1_loc (loc, NOP_EXPR, type, tem);
2548
2549 default:
2550 if (TYPE_MAIN_VARIANT (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2550, __FUNCTION__))->type_common.main_variant)
== TYPE_MAIN_VARIANT (orig)((tree_class_check ((orig), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2550, __FUNCTION__))->type_common.main_variant)
)
2551 return fold_build1_loc (loc, NOP_EXPR, type, arg);
2552 gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2552, __FUNCTION__))
;
2553 }
2554 fold_convert_exit:
2555 protected_set_expr_location_unshare (tem, loc);
2556 return tem;
2557}
2558
2559/* Return false if expr can be assumed not to be an lvalue, true
2560 otherwise. */
2561
2562static bool
2563maybe_lvalue_p (const_tree x)
2564{
2565 /* We only need to wrap lvalue tree codes. */
2566 switch (TREE_CODE (x)((enum tree_code) (x)->base.code))
2567 {
2568 case VAR_DECL:
2569 case PARM_DECL:
2570 case RESULT_DECL:
2571 case LABEL_DECL:
2572 case FUNCTION_DECL:
2573 case SSA_NAME:
2574
2575 case COMPONENT_REF:
2576 case MEM_REF:
2577 case INDIRECT_REF:
2578 case ARRAY_REF:
2579 case ARRAY_RANGE_REF:
2580 case BIT_FIELD_REF:
2581 case OBJ_TYPE_REF:
2582
2583 case REALPART_EXPR:
2584 case IMAGPART_EXPR:
2585 case PREINCREMENT_EXPR:
2586 case PREDECREMENT_EXPR:
2587 case SAVE_EXPR:
2588 case TRY_CATCH_EXPR:
2589 case WITH_CLEANUP_EXPR:
2590 case COMPOUND_EXPR:
2591 case MODIFY_EXPR:
2592 case TARGET_EXPR:
2593 case COND_EXPR:
2594 case BIND_EXPR:
2595 case VIEW_CONVERT_EXPR:
2596 break;
2597
2598 default:
2599 /* Assume the worst for front-end tree codes. */
2600 if ((int)TREE_CODE (x)((enum tree_code) (x)->base.code) >= NUM_TREE_CODES((int) LAST_AND_UNUSED_TREE_CODE))
2601 break;
2602 return false;
2603 }
2604
2605 return true;
2606}
2607
2608/* Return an expr equal to X but certainly not valid as an lvalue. */
2609
2610tree
2611non_lvalue_loc (location_t loc, tree x)
2612{
2613 /* While we are in GIMPLE, NON_LVALUE_EXPR doesn't mean anything to
2614 us. */
2615 if (in_gimple_form)
2616 return x;
2617
2618 if (! maybe_lvalue_p (x))
2619 return x;
2620 return build1_loc (loc, NON_LVALUE_EXPR, TREE_TYPE (x)((contains_struct_check ((x), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2620, __FUNCTION__))->typed.type)
, x);
2621}
2622
2623/* When pedantic, return an expr equal to X but certainly not valid as a
2624 pedantic lvalue. Otherwise, return X. */
2625
2626static tree
2627pedantic_non_lvalue_loc (location_t loc, tree x)
2628{
2629 return protected_set_expr_location_unshare (x, loc);
2630}
2631
2632/* Given a tree comparison code, return the code that is the logical inverse.
2633 It is generally not safe to do this for floating-point comparisons, except
2634 for EQ_EXPR, NE_EXPR, ORDERED_EXPR and UNORDERED_EXPR, so we return
2635 ERROR_MARK in this case. */
2636
2637enum tree_code
2638invert_tree_comparison (enum tree_code code, bool honor_nans)
2639{
2640 if (honor_nans && flag_trapping_mathglobal_options.x_flag_trapping_math && code != EQ_EXPR && code != NE_EXPR
2641 && code != ORDERED_EXPR && code != UNORDERED_EXPR)
2642 return ERROR_MARK;
2643
2644 switch (code)
2645 {
2646 case EQ_EXPR:
2647 return NE_EXPR;
2648 case NE_EXPR:
2649 return EQ_EXPR;
2650 case GT_EXPR:
2651 return honor_nans ? UNLE_EXPR : LE_EXPR;
2652 case GE_EXPR:
2653 return honor_nans ? UNLT_EXPR : LT_EXPR;
2654 case LT_EXPR:
2655 return honor_nans ? UNGE_EXPR : GE_EXPR;
2656 case LE_EXPR:
2657 return honor_nans ? UNGT_EXPR : GT_EXPR;
2658 case LTGT_EXPR:
2659 return UNEQ_EXPR;
2660 case UNEQ_EXPR:
2661 return LTGT_EXPR;
2662 case UNGT_EXPR:
2663 return LE_EXPR;
2664 case UNGE_EXPR:
2665 return LT_EXPR;
2666 case UNLT_EXPR:
2667 return GE_EXPR;
2668 case UNLE_EXPR:
2669 return GT_EXPR;
2670 case ORDERED_EXPR:
2671 return UNORDERED_EXPR;
2672 case UNORDERED_EXPR:
2673 return ORDERED_EXPR;
2674 default:
2675 gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2675, __FUNCTION__))
;
2676 }
2677}
2678
2679/* Similar, but return the comparison that results if the operands are
2680 swapped. This is safe for floating-point. */
2681
2682enum tree_code
2683swap_tree_comparison (enum tree_code code)
2684{
2685 switch (code)
2686 {
2687 case EQ_EXPR:
2688 case NE_EXPR:
2689 case ORDERED_EXPR:
2690 case UNORDERED_EXPR:
2691 case LTGT_EXPR:
2692 case UNEQ_EXPR:
2693 return code;
2694 case GT_EXPR:
2695 return LT_EXPR;
2696 case GE_EXPR:
2697 return LE_EXPR;
2698 case LT_EXPR:
2699 return GT_EXPR;
2700 case LE_EXPR:
2701 return GE_EXPR;
2702 case UNGT_EXPR:
2703 return UNLT_EXPR;
2704 case UNGE_EXPR:
2705 return UNLE_EXPR;
2706 case UNLT_EXPR:
2707 return UNGT_EXPR;
2708 case UNLE_EXPR:
2709 return UNGE_EXPR;
2710 default:
2711 gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2711, __FUNCTION__))
;
2712 }
2713}
2714
2715
2716/* Convert a comparison tree code from an enum tree_code representation
2717 into a compcode bit-based encoding. This function is the inverse of
2718 compcode_to_comparison. */
2719
2720static enum comparison_code
2721comparison_to_compcode (enum tree_code code)
2722{
2723 switch (code)
2724 {
2725 case LT_EXPR:
2726 return COMPCODE_LT;
2727 case EQ_EXPR:
2728 return COMPCODE_EQ;
2729 case LE_EXPR:
2730 return COMPCODE_LE;
2731 case GT_EXPR:
2732 return COMPCODE_GT;
2733 case NE_EXPR:
2734 return COMPCODE_NE;
2735 case GE_EXPR:
2736 return COMPCODE_GE;
2737 case ORDERED_EXPR:
2738 return COMPCODE_ORD;
2739 case UNORDERED_EXPR:
2740 return COMPCODE_UNORD;
2741 case UNLT_EXPR:
2742 return COMPCODE_UNLT;
2743 case UNEQ_EXPR:
2744 return COMPCODE_UNEQ;
2745 case UNLE_EXPR:
2746 return COMPCODE_UNLE;
2747 case UNGT_EXPR:
2748 return COMPCODE_UNGT;
2749 case LTGT_EXPR:
2750 return COMPCODE_LTGT;
2751 case UNGE_EXPR:
2752 return COMPCODE_UNGE;
2753 default:
2754 gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2754, __FUNCTION__))
;
2755 }
2756}
2757
2758/* Convert a compcode bit-based encoding of a comparison operator back
2759 to GCC's enum tree_code representation. This function is the
2760 inverse of comparison_to_compcode. */
2761
2762static enum tree_code
2763compcode_to_comparison (enum comparison_code code)
2764{
2765 switch (code)
2766 {
2767 case COMPCODE_LT:
2768 return LT_EXPR;
2769 case COMPCODE_EQ:
2770 return EQ_EXPR;
2771 case COMPCODE_LE:
2772 return LE_EXPR;
2773 case COMPCODE_GT:
2774 return GT_EXPR;
2775 case COMPCODE_NE:
2776 return NE_EXPR;
2777 case COMPCODE_GE:
2778 return GE_EXPR;
2779 case COMPCODE_ORD:
2780 return ORDERED_EXPR;
2781 case COMPCODE_UNORD:
2782 return UNORDERED_EXPR;
2783 case COMPCODE_UNLT:
2784 return UNLT_EXPR;
2785 case COMPCODE_UNEQ:
2786 return UNEQ_EXPR;
2787 case COMPCODE_UNLE:
2788 return UNLE_EXPR;
2789 case COMPCODE_UNGT:
2790 return UNGT_EXPR;
2791 case COMPCODE_LTGT:
2792 return LTGT_EXPR;
2793 case COMPCODE_UNGE:
2794 return UNGE_EXPR;
2795 default:
2796 gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2796, __FUNCTION__))
;
2797 }
2798}
2799
2800/* Return true if COND1 tests the opposite condition of COND2. */
2801
2802bool
2803inverse_conditions_p (const_tree cond1, const_tree cond2)
2804{
2805 return (COMPARISON_CLASS_P (cond1)(tree_code_type[(int) (((enum tree_code) (cond1)->base.code
))] == tcc_comparison)
2806 && COMPARISON_CLASS_P (cond2)(tree_code_type[(int) (((enum tree_code) (cond2)->base.code
))] == tcc_comparison)
2807 && (invert_tree_comparison
2808 (TREE_CODE (cond1)((enum tree_code) (cond1)->base.code),
2809 HONOR_NANS (TREE_OPERAND (cond1, 0)(*((const_cast<tree*> (tree_operand_check ((cond1), (0)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2809, __FUNCTION__)))))
)) == TREE_CODE (cond2)((enum tree_code) (cond2)->base.code))
2810 && operand_equal_p (TREE_OPERAND (cond1, 0)(*((const_cast<tree*> (tree_operand_check ((cond1), (0)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2810, __FUNCTION__)))))
,
2811 TREE_OPERAND (cond2, 0)(*((const_cast<tree*> (tree_operand_check ((cond2), (0)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2811, __FUNCTION__)))))
, 0)
2812 && operand_equal_p (TREE_OPERAND (cond1, 1)(*((const_cast<tree*> (tree_operand_check ((cond1), (1)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2812, __FUNCTION__)))))
,
2813 TREE_OPERAND (cond2, 1)(*((const_cast<tree*> (tree_operand_check ((cond2), (1)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2813, __FUNCTION__)))))
, 0));
2814}
2815
2816/* Return a tree for the comparison which is the combination of
2817 doing the AND or OR (depending on CODE) of the two operations LCODE
2818 and RCODE on the identical operands LL_ARG and LR_ARG. Take into account
2819 the possibility of trapping if the mode has NaNs, and return NULL_TREE
2820 if this makes the transformation invalid. */
2821
2822tree
2823combine_comparisons (location_t loc,
2824 enum tree_code code, enum tree_code lcode,
2825 enum tree_code rcode, tree truth_type,
2826 tree ll_arg, tree lr_arg)
2827{
2828 bool honor_nans = HONOR_NANS (ll_arg);
2829 enum comparison_code lcompcode = comparison_to_compcode (lcode);
2830 enum comparison_code rcompcode = comparison_to_compcode (rcode);
2831 int compcode;
2832
2833 switch (code)
2834 {
2835 case TRUTH_AND_EXPR: case TRUTH_ANDIF_EXPR:
2836 compcode = lcompcode & rcompcode;
2837 break;
2838
2839 case TRUTH_OR_EXPR: case TRUTH_ORIF_EXPR:
2840 compcode = lcompcode | rcompcode;
2841 break;
2842
2843 default:
2844 return NULL_TREE(tree) __null;
2845 }
2846
2847 if (!honor_nans)
2848 {
2849 /* Eliminate unordered comparisons, as well as LTGT and ORD
2850 which are not used unless the mode has NaNs. */
2851 compcode &= ~COMPCODE_UNORD;
2852 if (compcode == COMPCODE_LTGT)
2853 compcode = COMPCODE_NE;
2854 else if (compcode == COMPCODE_ORD)
2855 compcode = COMPCODE_TRUE;
2856 }
2857 else if (flag_trapping_mathglobal_options.x_flag_trapping_math)
2858 {
2859 /* Check that the original operation and the optimized ones will trap
2860 under the same condition. */
2861 bool ltrap = (lcompcode & COMPCODE_UNORD) == 0
2862 && (lcompcode != COMPCODE_EQ)
2863 && (lcompcode != COMPCODE_ORD);
2864 bool rtrap = (rcompcode & COMPCODE_UNORD) == 0
2865 && (rcompcode != COMPCODE_EQ)
2866 && (rcompcode != COMPCODE_ORD);
2867 bool trap = (compcode & COMPCODE_UNORD) == 0
2868 && (compcode != COMPCODE_EQ)
2869 && (compcode != COMPCODE_ORD);
2870
2871 /* In a short-circuited boolean expression the LHS might be
2872 such that the RHS, if evaluated, will never trap. For
2873 example, in ORD (x, y) && (x < y), we evaluate the RHS only
2874 if neither x nor y is NaN. (This is a mixed blessing: for
2875 example, the expression above will never trap, hence
2876 optimizing it to x < y would be invalid). */
2877 if ((code == TRUTH_ORIF_EXPR && (lcompcode & COMPCODE_UNORD))
2878 || (code == TRUTH_ANDIF_EXPR && !(lcompcode & COMPCODE_UNORD)))
2879 rtrap = false;
2880
2881 /* If the comparison was short-circuited, and only the RHS
2882 trapped, we may now generate a spurious trap. */
2883 if (rtrap && !ltrap
2884 && (code == TRUTH_ANDIF_EXPR || code == TRUTH_ORIF_EXPR))
2885 return NULL_TREE(tree) __null;
2886
2887 /* If we changed the conditions that cause a trap, we lose. */
2888 if ((ltrap || rtrap) != trap)
2889 return NULL_TREE(tree) __null;
2890 }
2891
2892 if (compcode == COMPCODE_TRUE)
2893 return constant_boolean_node (true, truth_type);
2894 else if (compcode == COMPCODE_FALSE)
2895 return constant_boolean_node (false, truth_type);
2896 else
2897 {
2898 enum tree_code tcode;
2899
2900 tcode = compcode_to_comparison ((enum comparison_code) compcode);
2901 return fold_build2_loc (loc, tcode, truth_type, ll_arg, lr_arg);
2902 }
2903}
2904
2905/* Return nonzero if two operands (typically of the same tree node)
2906 are necessarily equal. FLAGS modifies behavior as follows:
2907
2908 If OEP_ONLY_CONST is set, only return nonzero for constants.
2909 This function tests whether the operands are indistinguishable;
2910 it does not test whether they are equal using C's == operation.
2911 The distinction is important for IEEE floating point, because
2912 (1) -0.0 and 0.0 are distinguishable, but -0.0==0.0, and
2913 (2) two NaNs may be indistinguishable, but NaN!=NaN.
2914
2915 If OEP_ONLY_CONST is unset, a VAR_DECL is considered equal to itself
2916 even though it may hold multiple values during a function.
2917 This is because a GCC tree node guarantees that nothing else is
2918 executed between the evaluation of its "operands" (which may often
2919 be evaluated in arbitrary order). Hence if the operands themselves
2920 don't side-effect, the VAR_DECLs, PARM_DECLs etc... must hold the
2921 same value in each operand/subexpression. Hence leaving OEP_ONLY_CONST
2922 unset means assuming isochronic (or instantaneous) tree equivalence.
2923 Unless comparing arbitrary expression trees, such as from different
2924 statements, this flag can usually be left unset.
2925
2926 If OEP_PURE_SAME is set, then pure functions with identical arguments
2927 are considered the same. It is used when the caller has other ways
2928 to ensure that global memory is unchanged in between.
2929
2930 If OEP_ADDRESS_OF is set, we are actually comparing addresses of objects,
2931 not values of expressions.
2932
2933 If OEP_LEXICOGRAPHIC is set, then also handle expressions with side-effects
2934 such as MODIFY_EXPR, RETURN_EXPR, as well as STATEMENT_LISTs.
2935
2936 If OEP_BITWISE is set, then require the values to be bitwise identical
2937 rather than simply numerically equal. Do not take advantage of things
2938 like math-related flags or undefined behavior; only return true for
2939 values that are provably bitwise identical in all circumstances.
2940
2941 Unless OEP_MATCH_SIDE_EFFECTS is set, the function returns false on
2942 any operand with side effect. This is unnecesarily conservative in the
2943 case we know that arg0 and arg1 are in disjoint code paths (such as in
2944 ?: operator). In addition OEP_MATCH_SIDE_EFFECTS is used when comparing
2945 addresses with TREE_CONSTANT flag set so we know that &var == &var
2946 even if var is volatile. */
2947
2948bool
2949operand_compare::operand_equal_p (const_tree arg0, const_tree arg1,
2950 unsigned int flags)
2951{
2952 bool r;
2953 if (verify_hash_value (arg0, arg1, flags, &r))
2954 return r;
2955
2956 STRIP_ANY_LOCATION_WRAPPER (arg0)(arg0) = tree_strip_any_location_wrapper ((const_cast<union
tree_node *> (((arg0)))))
;
2957 STRIP_ANY_LOCATION_WRAPPER (arg1)(arg1) = tree_strip_any_location_wrapper ((const_cast<union
tree_node *> (((arg1)))))
;
2958
2959 /* If either is ERROR_MARK, they aren't equal. */
2960 if (TREE_CODE (arg0)((enum tree_code) (arg0)->base.code) == ERROR_MARK || TREE_CODE (arg1)((enum tree_code) (arg1)->base.code) == ERROR_MARK
2961 || TREE_TYPE (arg0)((contains_struct_check ((arg0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2961, __FUNCTION__))->typed.type)
== error_mark_nodeglobal_trees[TI_ERROR_MARK]
2962 || TREE_TYPE (arg1)((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2962, __FUNCTION__))->typed.type)
== error_mark_nodeglobal_trees[TI_ERROR_MARK])
2963 return false;
2964
2965 /* Similar, if either does not have a type (like a template id),
2966 they aren't equal. */
2967 if (!TREE_TYPE (arg0)((contains_struct_check ((arg0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2967, __FUNCTION__))->typed.type)
|| !TREE_TYPE (arg1)((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2967, __FUNCTION__))->typed.type)
)
2968 return false;
2969
2970 /* Bitwise identity makes no sense if the values have different layouts. */
2971 if ((flags & OEP_BITWISE)
2972 && !tree_nop_conversion_p (TREE_TYPE (arg0)((contains_struct_check ((arg0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2972, __FUNCTION__))->typed.type)
, TREE_TYPE (arg1)((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2972, __FUNCTION__))->typed.type)
))
2973 return false;
2974
2975 /* We cannot consider pointers to different address space equal. */
2976 if (POINTER_TYPE_P (TREE_TYPE (arg0))(((enum tree_code) (((contains_struct_check ((arg0), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2976, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE
|| ((enum tree_code) (((contains_struct_check ((arg0), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2976, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
)
2977 && POINTER_TYPE_P (TREE_TYPE (arg1))(((enum tree_code) (((contains_struct_check ((arg1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2977, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE
|| ((enum tree_code) (((contains_struct_check ((arg1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2977, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
)
2978 && (TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (arg0)))((tree_class_check ((((contains_struct_check ((((contains_struct_check
((arg0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2978, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2978, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2978, __FUNCTION__))->base.u.bits.address_space)
2979 != TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (arg1)))((tree_class_check ((((contains_struct_check ((((contains_struct_check
((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2979, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2979, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2979, __FUNCTION__))->base.u.bits.address_space)
))
2980 return false;
2981
2982 /* Check equality of integer constants before bailing out due to
2983 precision differences. */
2984 if (TREE_CODE (arg0)((enum tree_code) (arg0)->base.code) == INTEGER_CST && TREE_CODE (arg1)((enum tree_code) (arg1)->base.code) == INTEGER_CST)
2985 {
2986 /* Address of INTEGER_CST is not defined; check that we did not forget
2987 to drop the OEP_ADDRESS_OF flags. */
2988 gcc_checking_assert (!(flags & OEP_ADDRESS_OF))((void)(!(!(flags & OEP_ADDRESS_OF)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2988, __FUNCTION__), 0 : 0))
;
2989 return tree_int_cst_equal (arg0, arg1);
2990 }
2991
2992 if (!(flags & OEP_ADDRESS_OF))
2993 {
2994 /* If both types don't have the same signedness, then we can't consider
2995 them equal. We must check this before the STRIP_NOPS calls
2996 because they may change the signedness of the arguments. As pointers
2997 strictly don't have a signedness, require either two pointers or
2998 two non-pointers as well. */
2999 if (TYPE_UNSIGNED (TREE_TYPE (arg0))((tree_class_check ((((contains_struct_check ((arg0), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2999, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2999, __FUNCTION__))->base.u.bits.unsigned_flag)
!= TYPE_UNSIGNED (TREE_TYPE (arg1))((tree_class_check ((((contains_struct_check ((arg1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2999, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 2999, __FUNCTION__))->base.u.bits.unsigned_flag)
3000 || POINTER_TYPE_P (TREE_TYPE (arg0))(((enum tree_code) (((contains_struct_check ((arg0), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3000, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE
|| ((enum tree_code) (((contains_struct_check ((arg0), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3000, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
)
3001 != POINTER_TYPE_P (TREE_TYPE (arg1))(((enum tree_code) (((contains_struct_check ((arg1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3001, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE
|| ((enum tree_code) (((contains_struct_check ((arg1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3001, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
)
)
3002 return false;
3003
3004 /* If both types don't have the same precision, then it is not safe
3005 to strip NOPs. */
3006 if (element_precision (TREE_TYPE (arg0)((contains_struct_check ((arg0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3006, __FUNCTION__))->typed.type)
)
3007 != element_precision (TREE_TYPE (arg1)((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3007, __FUNCTION__))->typed.type)
))
3008 return false;
3009
3010 STRIP_NOPS (arg0)(arg0) = tree_strip_nop_conversions ((const_cast<union tree_node
*> (((arg0)))))
;
3011 STRIP_NOPS (arg1)(arg1) = tree_strip_nop_conversions ((const_cast<union tree_node
*> (((arg1)))))
;
3012 }
3013#if 0
3014 /* FIXME: Fortran FE currently produce ADDR_EXPR of NOP_EXPR. Enable the
3015 sanity check once the issue is solved. */
3016 else
3017 /* Addresses of conversions and SSA_NAMEs (and many other things)
3018 are not defined. Check that we did not forget to drop the
3019 OEP_ADDRESS_OF/OEP_CONSTANT_ADDRESS_OF flags. */
3020 gcc_checking_assert (!CONVERT_EXPR_P (arg0) && !CONVERT_EXPR_P (arg1)((void)(!(!((((enum tree_code) (arg0)->base.code)) == NOP_EXPR
|| (((enum tree_code) (arg0)->base.code)) == CONVERT_EXPR
) && !((((enum tree_code) (arg1)->base.code)) == NOP_EXPR
|| (((enum tree_code) (arg1)->base.code)) == CONVERT_EXPR
) && ((enum tree_code) (arg0)->base.code) != SSA_NAME
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3021, __FUNCTION__), 0 : 0))
3021 && TREE_CODE (arg0) != SSA_NAME)((void)(!(!((((enum tree_code) (arg0)->base.code)) == NOP_EXPR
|| (((enum tree_code) (arg0)->base.code)) == CONVERT_EXPR
) && !((((enum tree_code) (arg1)->base.code)) == NOP_EXPR
|| (((enum tree_code) (arg1)->base.code)) == CONVERT_EXPR
) && ((enum tree_code) (arg0)->base.code) != SSA_NAME
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3021, __FUNCTION__), 0 : 0))
;
3022#endif
3023
3024 /* In case both args are comparisons but with different comparison
3025 code, try to swap the comparison operands of one arg to produce
3026 a match and compare that variant. */
3027 if (TREE_CODE (arg0)((enum tree_code) (arg0)->base.code) != TREE_CODE (arg1)((enum tree_code) (arg1)->base.code)
3028 && COMPARISON_CLASS_P (arg0)(tree_code_type[(int) (((enum tree_code) (arg0)->base.code
))] == tcc_comparison)
3029 && COMPARISON_CLASS_P (arg1)(tree_code_type[(int) (((enum tree_code) (arg1)->base.code
))] == tcc_comparison)
)
3030 {
3031 enum tree_code swap_code = swap_tree_comparison (TREE_CODE (arg1)((enum tree_code) (arg1)->base.code));
3032
3033 if (TREE_CODE (arg0)((enum tree_code) (arg0)->base.code) == swap_code)
3034 return operand_equal_p (TREE_OPERAND (arg0, 0)(*((const_cast<tree*> (tree_operand_check ((arg0), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3034, __FUNCTION__)))))
,
3035 TREE_OPERAND (arg1, 1)(*((const_cast<tree*> (tree_operand_check ((arg1), (1),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3035, __FUNCTION__)))))
, flags)
3036 && operand_equal_p (TREE_OPERAND (arg0, 1)(*((const_cast<tree*> (tree_operand_check ((arg0), (1),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3036, __FUNCTION__)))))
,
3037 TREE_OPERAND (arg1, 0)(*((const_cast<tree*> (tree_operand_check ((arg1), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3037, __FUNCTION__)))))
, flags);
3038 }
3039
3040 if (TREE_CODE (arg0)((enum tree_code) (arg0)->base.code) != TREE_CODE (arg1)((enum tree_code) (arg1)->base.code))
3041 {
3042 /* NOP_EXPR and CONVERT_EXPR are considered equal. */
3043 if (CONVERT_EXPR_P (arg0)((((enum tree_code) (arg0)->base.code)) == NOP_EXPR || (((
enum tree_code) (arg0)->base.code)) == CONVERT_EXPR)
&& CONVERT_EXPR_P (arg1)((((enum tree_code) (arg1)->base.code)) == NOP_EXPR || (((
enum tree_code) (arg1)->base.code)) == CONVERT_EXPR)
)
3044 ;
3045 else if (flags & OEP_ADDRESS_OF)
3046 {
3047 /* If we are interested in comparing addresses ignore
3048 MEM_REF wrappings of the base that can appear just for
3049 TBAA reasons. */
3050 if (TREE_CODE (arg0)((enum tree_code) (arg0)->base.code) == MEM_REF
3051 && DECL_P (arg1)(tree_code_type[(int) (((enum tree_code) (arg1)->base.code
))] == tcc_declaration)
3052 && TREE_CODE (TREE_OPERAND (arg0, 0))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check
((arg0), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3052, __FUNCTION__))))))->base.code)
== ADDR_EXPR
3053 && TREE_OPERAND (TREE_OPERAND (arg0, 0), 0)(*((const_cast<tree*> (tree_operand_check (((*((const_cast
<tree*> (tree_operand_check ((arg0), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3053, __FUNCTION__)))))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3053, __FUNCTION__)))))
== arg1
3054 && integer_zerop (TREE_OPERAND (arg0, 1)(*((const_cast<tree*> (tree_operand_check ((arg0), (1),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3054, __FUNCTION__)))))
))
3055 return true;
3056 else if (TREE_CODE (arg1)((enum tree_code) (arg1)->base.code) == MEM_REF
3057 && DECL_P (arg0)(tree_code_type[(int) (((enum tree_code) (arg0)->base.code
))] == tcc_declaration)
3058 && TREE_CODE (TREE_OPERAND (arg1, 0))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check
((arg1), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3058, __FUNCTION__))))))->base.code)
== ADDR_EXPR
3059 && TREE_OPERAND (TREE_OPERAND (arg1, 0), 0)(*((const_cast<tree*> (tree_operand_check (((*((const_cast
<tree*> (tree_operand_check ((arg1), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3059, __FUNCTION__)))))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3059, __FUNCTION__)))))
== arg0
3060 && integer_zerop (TREE_OPERAND (arg1, 1)(*((const_cast<tree*> (tree_operand_check ((arg1), (1),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3060, __FUNCTION__)))))
))
3061 return true;
3062 return false;
3063 }
3064 else
3065 return false;
3066 }
3067
3068 /* When not checking adddresses, this is needed for conversions and for
3069 COMPONENT_REF. Might as well play it safe and always test this. */
3070 if (TREE_CODE (TREE_TYPE (arg0))((enum tree_code) (((contains_struct_check ((arg0), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3070, __FUNCTION__))->typed.type))->base.code)
== ERROR_MARK
3071 || TREE_CODE (TREE_TYPE (arg1))((enum tree_code) (((contains_struct_check ((arg1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3071, __FUNCTION__))->typed.type))->base.code)
== ERROR_MARK
3072 || (TYPE_MODE (TREE_TYPE (arg0))((((enum tree_code) ((tree_class_check ((((contains_struct_check
((arg0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3072, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3072, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(((contains_struct_check ((arg0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3072, __FUNCTION__))->typed.type)) : (((contains_struct_check
((arg0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3072, __FUNCTION__))->typed.type))->type_common.mode)
!= TYPE_MODE (TREE_TYPE (arg1))((((enum tree_code) ((tree_class_check ((((contains_struct_check
((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3072, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3072, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3072, __FUNCTION__))->typed.type)) : (((contains_struct_check
((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3072, __FUNCTION__))->typed.type))->type_common.mode)
3073 && !(flags & OEP_ADDRESS_OF)))
3074 return false;
3075
3076 /* If ARG0 and ARG1 are the same SAVE_EXPR, they are necessarily equal.
3077 We don't care about side effects in that case because the SAVE_EXPR
3078 takes care of that for us. In all other cases, two expressions are
3079 equal if they have no side effects. If we have two identical
3080 expressions with side effects that should be treated the same due
3081 to the only side effects being identical SAVE_EXPR's, that will
3082 be detected in the recursive calls below.
3083 If we are taking an invariant address of two identical objects
3084 they are necessarily equal as well. */
3085 if (arg0 == arg1 && ! (flags & OEP_ONLY_CONST)
3086 && (TREE_CODE (arg0)((enum tree_code) (arg0)->base.code) == SAVE_EXPR
3087 || (flags & OEP_MATCH_SIDE_EFFECTS)
3088 || (! TREE_SIDE_EFFECTS (arg0)((non_type_check ((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3088, __FUNCTION__))->base.side_effects_flag)
&& ! TREE_SIDE_EFFECTS (arg1)((non_type_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3088, __FUNCTION__))->base.side_effects_flag)
)))
3089 return true;
3090
3091 /* Next handle constant cases, those for which we can return 1 even
3092 if ONLY_CONST is set. */
3093 if (TREE_CONSTANT (arg0)((non_type_check ((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3093, __FUNCTION__))->base.constant_flag)
&& TREE_CONSTANT (arg1)((non_type_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3093, __FUNCTION__))->base.constant_flag)
)
3094 switch (TREE_CODE (arg0)((enum tree_code) (arg0)->base.code))
3095 {
3096 case INTEGER_CST:
3097 return tree_int_cst_equal (arg0, arg1);
3098
3099 case FIXED_CST:
3100 return FIXED_VALUES_IDENTICAL (TREE_FIXED_CST (arg0),fixed_identical (&((*((tree_check ((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3100, __FUNCTION__, (FIXED_CST)))->fixed_cst.fixed_cst_ptr
))), &((*((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3101, __FUNCTION__, (FIXED_CST)))->fixed_cst.fixed_cst_ptr
))))
3101 TREE_FIXED_CST (arg1))fixed_identical (&((*((tree_check ((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3100, __FUNCTION__, (FIXED_CST)))->fixed_cst.fixed_cst_ptr
))), &((*((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3101, __FUNCTION__, (FIXED_CST)))->fixed_cst.fixed_cst_ptr
))))
;
3102
3103 case REAL_CST:
3104 if (real_identical (&TREE_REAL_CST (arg0)(*((tree_check ((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3104, __FUNCTION__, (REAL_CST)))->real_cst.real_cst_ptr)
)
, &TREE_REAL_CST (arg1)(*((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3104, __FUNCTION__, (REAL_CST)))->real_cst.real_cst_ptr)
)
))
3105 return true;
3106
3107 if (!(flags & OEP_BITWISE) && !HONOR_SIGNED_ZEROS (arg0))
3108 {
3109 /* If we do not distinguish between signed and unsigned zero,
3110 consider them equal. */
3111 if (real_zerop (arg0) && real_zerop (arg1))
3112 return true;
3113 }
3114 return false;
3115
3116 case VECTOR_CST:
3117 {
3118 if (VECTOR_CST_LOG2_NPATTERNS (arg0)((tree_check ((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3118, __FUNCTION__, (VECTOR_CST)))->base.u.vector_cst.log2_npatterns
)
3119 != VECTOR_CST_LOG2_NPATTERNS (arg1)((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3119, __FUNCTION__, (VECTOR_CST)))->base.u.vector_cst.log2_npatterns
)
)
3120 return false;
3121
3122 if (VECTOR_CST_NELTS_PER_PATTERN (arg0)((tree_check ((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3122, __FUNCTION__, (VECTOR_CST)))->base.u.vector_cst.nelts_per_pattern
)
3123 != VECTOR_CST_NELTS_PER_PATTERN (arg1)((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3123, __FUNCTION__, (VECTOR_CST)))->base.u.vector_cst.nelts_per_pattern
)
)
3124 return false;
3125
3126 unsigned int count = vector_cst_encoded_nelts (arg0);
3127 for (unsigned int i = 0; i < count; ++i)
3128 if (!operand_equal_p (VECTOR_CST_ENCODED_ELT (arg0, i)((tree_check ((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3128, __FUNCTION__, (VECTOR_CST)))->vector.elts[i])
,
3129 VECTOR_CST_ENCODED_ELT (arg1, i)((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3129, __FUNCTION__, (VECTOR_CST)))->vector.elts[i])
, flags))
3130 return false;
3131 return true;
3132 }
3133
3134 case COMPLEX_CST:
3135 return (operand_equal_p (TREE_REALPART (arg0)((tree_check ((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3135, __FUNCTION__, (COMPLEX_CST)))->complex.real)
, TREE_REALPART (arg1)((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3135, __FUNCTION__, (COMPLEX_CST)))->complex.real)
,
3136 flags)
3137 && operand_equal_p (TREE_IMAGPART (arg0)((tree_check ((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3137, __FUNCTION__, (COMPLEX_CST)))->complex.imag)
, TREE_IMAGPART (arg1)((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3137, __FUNCTION__, (COMPLEX_CST)))->complex.imag)
,
3138 flags));
3139
3140 case STRING_CST:
3141 return (TREE_STRING_LENGTH (arg0)((tree_check ((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3141, __FUNCTION__, (STRING_CST)))->string.length)
== TREE_STRING_LENGTH (arg1)((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3141, __FUNCTION__, (STRING_CST)))->string.length)
3142 && ! memcmp (TREE_STRING_POINTER (arg0)((const char *)((tree_check ((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3142, __FUNCTION__, (STRING_CST)))->string.str))
,
3143 TREE_STRING_POINTER (arg1)((const char *)((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3143, __FUNCTION__, (STRING_CST)))->string.str))
,
3144 TREE_STRING_LENGTH (arg0)((tree_check ((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3144, __FUNCTION__, (STRING_CST)))->string.length)
));
3145
3146 case ADDR_EXPR:
3147 gcc_checking_assert (!(flags & OEP_ADDRESS_OF))((void)(!(!(flags & OEP_ADDRESS_OF)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3147, __FUNCTION__), 0 : 0))
;
3148 return operand_equal_p (TREE_OPERAND (arg0, 0)(*((const_cast<tree*> (tree_operand_check ((arg0), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3148, __FUNCTION__)))))
, TREE_OPERAND (arg1, 0)(*((const_cast<tree*> (tree_operand_check ((arg1), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3148, __FUNCTION__)))))
,
3149 flags | OEP_ADDRESS_OF
3150 | OEP_MATCH_SIDE_EFFECTS);
3151 case CONSTRUCTOR:
3152 /* In GIMPLE empty constructors are allowed in initializers of
3153 aggregates. */
3154 return !CONSTRUCTOR_NELTS (arg0)(vec_safe_length (((tree_check ((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3154, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
&& !CONSTRUCTOR_NELTS (arg1)(vec_safe_length (((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3154, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
;
3155 default:
3156 break;
3157 }
3158
3159 /* Don't handle more cases for OEP_BITWISE, since we can't guarantee that
3160 two instances of undefined behavior will give identical results. */
3161 if (flags & (OEP_ONLY_CONST | OEP_BITWISE))
3162 return false;
3163
3164/* Define macros to test an operand from arg0 and arg1 for equality and a
3165 variant that allows null and views null as being different from any
3166 non-null value. In the latter case, if either is null, the both
3167 must be; otherwise, do the normal comparison. */
3168#define OP_SAME(N) operand_equal_p (TREE_OPERAND (arg0, N)(*((const_cast<tree*> (tree_operand_check ((arg0), (N),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3168, __FUNCTION__)))))
, \
3169 TREE_OPERAND (arg1, N)(*((const_cast<tree*> (tree_operand_check ((arg1), (N),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3169, __FUNCTION__)))))
, flags)
3170
3171#define OP_SAME_WITH_NULL(N) \
3172 ((!TREE_OPERAND (arg0, N)(*((const_cast<tree*> (tree_operand_check ((arg0), (N),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3172, __FUNCTION__)))))
|| !TREE_OPERAND (arg1, N)(*((const_cast<tree*> (tree_operand_check ((arg1), (N),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3172, __FUNCTION__)))))
) \
3173 ? TREE_OPERAND (arg0, N)(*((const_cast<tree*> (tree_operand_check ((arg0), (N),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3173, __FUNCTION__)))))
== TREE_OPERAND (arg1, N)(*((const_cast<tree*> (tree_operand_check ((arg1), (N),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3173, __FUNCTION__)))))
: OP_SAME (N))
3174
3175 switch (TREE_CODE_CLASS (TREE_CODE (arg0))tree_code_type[(int) (((enum tree_code) (arg0)->base.code)
)]
)
3176 {
3177 case tcc_unary:
3178 /* Two conversions are equal only if signedness and modes match. */
3179 switch (TREE_CODE (arg0)((enum tree_code) (arg0)->base.code))
3180 {
3181 CASE_CONVERTcase NOP_EXPR: case CONVERT_EXPR:
3182 case FIX_TRUNC_EXPR:
3183 if (TYPE_UNSIGNED (TREE_TYPE (arg0))((tree_class_check ((((contains_struct_check ((arg0), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3183, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3183, __FUNCTION__))->base.u.bits.unsigned_flag)
3184 != TYPE_UNSIGNED (TREE_TYPE (arg1))((tree_class_check ((((contains_struct_check ((arg1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3184, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3184, __FUNCTION__))->base.u.bits.unsigned_flag)
)
3185 return false;
3186 break;
3187 default:
3188 break;
3189 }
3190
3191 return OP_SAME (0);
3192
3193
3194 case tcc_comparison:
3195 case tcc_binary:
3196 if (OP_SAME (0) && OP_SAME (1))
3197 return true;
3198
3199 /* For commutative ops, allow the other order. */
3200 return (commutative_tree_code (TREE_CODE (arg0)((enum tree_code) (arg0)->base.code))
3201 && operand_equal_p (TREE_OPERAND (arg0, 0)(*((const_cast<tree*> (tree_operand_check ((arg0), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3201, __FUNCTION__)))))
,
3202 TREE_OPERAND (arg1, 1)(*((const_cast<tree*> (tree_operand_check ((arg1), (1),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3202, __FUNCTION__)))))
, flags)
3203 && operand_equal_p (TREE_OPERAND (arg0, 1)(*((const_cast<tree*> (tree_operand_check ((arg0), (1),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3203, __FUNCTION__)))))
,
3204 TREE_OPERAND (arg1, 0)(*((const_cast<tree*> (tree_operand_check ((arg1), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3204, __FUNCTION__)))))
, flags));
3205
3206 case tcc_reference:
3207 /* If either of the pointer (or reference) expressions we are
3208 dereferencing contain a side effect, these cannot be equal,
3209 but their addresses can be. */
3210 if ((flags & OEP_MATCH_SIDE_EFFECTS) == 0
3211 && (TREE_SIDE_EFFECTS (arg0)((non_type_check ((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3211, __FUNCTION__))->base.side_effects_flag)
3212 || TREE_SIDE_EFFECTS (arg1)((non_type_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3212, __FUNCTION__))->base.side_effects_flag)
))
3213 return false;
3214
3215 switch (TREE_CODE (arg0)((enum tree_code) (arg0)->base.code))
3216 {
3217 case INDIRECT_REF:
3218 if (!(flags & OEP_ADDRESS_OF))
3219 {
3220 if (TYPE_ALIGN (TREE_TYPE (arg0))((tree_class_check ((((contains_struct_check ((arg0), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3220, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3220, __FUNCTION__))->type_common.align ? ((unsigned)1) <<
((((contains_struct_check ((arg0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3220, __FUNCTION__))->typed.type))->type_common.align
- 1) : 0)
3221 != TYPE_ALIGN (TREE_TYPE (arg1))((tree_class_check ((((contains_struct_check ((arg1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3221, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3221, __FUNCTION__))->type_common.align ? ((unsigned)1) <<
((((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3221, __FUNCTION__))->typed.type))->type_common.align
- 1) : 0)
)
3222 return false;
3223 /* Verify that the access types are compatible. */
3224 if (TYPE_MAIN_VARIANT (TREE_TYPE (arg0))((tree_class_check ((((contains_struct_check ((arg0), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3224, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3224, __FUNCTION__))->type_common.main_variant)
3225 != TYPE_MAIN_VARIANT (TREE_TYPE (arg1))((tree_class_check ((((contains_struct_check ((arg1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3225, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3225, __FUNCTION__))->type_common.main_variant)
)
3226 return false;
3227 }
3228 flags &= ~OEP_ADDRESS_OF;
3229 return OP_SAME (0);
3230
3231 case IMAGPART_EXPR:
3232 /* Require the same offset. */
3233 if (!operand_equal_p (TYPE_SIZE (TREE_TYPE (arg0))((tree_class_check ((((contains_struct_check ((arg0), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3233, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3233, __FUNCTION__))->type_common.size)
,
3234 TYPE_SIZE (TREE_TYPE (arg1))((tree_class_check ((((contains_struct_check ((arg1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3234, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3234, __FUNCTION__))->type_common.size)
,
3235 flags & ~OEP_ADDRESS_OF))
3236 return false;
3237
3238 /* Fallthru. */
3239 case REALPART_EXPR:
3240 case VIEW_CONVERT_EXPR:
3241 return OP_SAME (0);
3242
3243 case TARGET_MEM_REF:
3244 case MEM_REF:
3245 if (!(flags & OEP_ADDRESS_OF))
3246 {
3247 /* Require equal access sizes */
3248 if (TYPE_SIZE (TREE_TYPE (arg0))((tree_class_check ((((contains_struct_check ((arg0), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3248, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3248, __FUNCTION__))->type_common.size)
!= TYPE_SIZE (TREE_TYPE (arg1))((tree_class_check ((((contains_struct_check ((arg1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3248, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3248, __FUNCTION__))->type_common.size)
3249 && (!TYPE_SIZE (TREE_TYPE (arg0))((tree_class_check ((((contains_struct_check ((arg0), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3249, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3249, __FUNCTION__))->type_common.size)
3250 || !TYPE_SIZE (TREE_TYPE (arg1))((tree_class_check ((((contains_struct_check ((arg1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3250, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3250, __FUNCTION__))->type_common.size)
3251 || !operand_equal_p (TYPE_SIZE (TREE_TYPE (arg0))((tree_class_check ((((contains_struct_check ((arg0), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3251, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3251, __FUNCTION__))->type_common.size)
,
3252 TYPE_SIZE (TREE_TYPE (arg1))((tree_class_check ((((contains_struct_check ((arg1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3252, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3252, __FUNCTION__))->type_common.size)
,
3253 flags)))
3254 return false;
3255 /* Verify that access happens in similar types. */
3256 if (!types_compatible_p (TREE_TYPE (arg0)((contains_struct_check ((arg0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3256, __FUNCTION__))->typed.type)
, TREE_TYPE (arg1)((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3256, __FUNCTION__))->typed.type)
))
3257 return false;
3258 /* Verify that accesses are TBAA compatible. */
3259 if (!alias_ptr_types_compatible_p
3260 (TREE_TYPE (TREE_OPERAND (arg0, 1))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check
((arg0), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3260, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3260, __FUNCTION__))->typed.type)
,
3261 TREE_TYPE (TREE_OPERAND (arg1, 1))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check
((arg1), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3261, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3261, __FUNCTION__))->typed.type)
)
3262 || (MR_DEPENDENCE_CLIQUE (arg0)((tree_check2 ((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3262, __FUNCTION__, (MEM_REF), (TARGET_MEM_REF)))->base.
u.dependence_info.clique)
3263 != MR_DEPENDENCE_CLIQUE (arg1)((tree_check2 ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3263, __FUNCTION__, (MEM_REF), (TARGET_MEM_REF)))->base.
u.dependence_info.clique)
)
3264 || (MR_DEPENDENCE_BASE (arg0)((tree_check2 ((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3264, __FUNCTION__, (MEM_REF), (TARGET_MEM_REF)))->base.
u.dependence_info.base)
3265 != MR_DEPENDENCE_BASE (arg1)((tree_check2 ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3265, __FUNCTION__, (MEM_REF), (TARGET_MEM_REF)))->base.
u.dependence_info.base)
))
3266 return false;
3267 /* Verify that alignment is compatible. */
3268 if (TYPE_ALIGN (TREE_TYPE (arg0))((tree_class_check ((((contains_struct_check ((arg0), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3268, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3268, __FUNCTION__))->type_common.align ? ((unsigned)1) <<
((((contains_struct_check ((arg0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3268, __FUNCTION__))->typed.type))->type_common.align
- 1) : 0)
3269 != TYPE_ALIGN (TREE_TYPE (arg1))((tree_class_check ((((contains_struct_check ((arg1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3269, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3269, __FUNCTION__))->type_common.align ? ((unsigned)1) <<
((((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3269, __FUNCTION__))->typed.type))->type_common.align
- 1) : 0)
)
3270 return false;
3271 }
3272 flags &= ~OEP_ADDRESS_OF;
3273 return (OP_SAME (0) && OP_SAME (1)
3274 /* TARGET_MEM_REF require equal extra operands. */
3275 && (TREE_CODE (arg0)((enum tree_code) (arg0)->base.code) != TARGET_MEM_REF
3276 || (OP_SAME_WITH_NULL (2)
3277 && OP_SAME_WITH_NULL (3)
3278 && OP_SAME_WITH_NULL (4))));
3279
3280 case ARRAY_REF:
3281 case ARRAY_RANGE_REF:
3282 if (!OP_SAME (0))
3283 return false;
3284 flags &= ~OEP_ADDRESS_OF;
3285 /* Compare the array index by value if it is constant first as we
3286 may have different types but same value here. */
3287 return ((tree_int_cst_equal (TREE_OPERAND (arg0, 1)(*((const_cast<tree*> (tree_operand_check ((arg0), (1),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3287, __FUNCTION__)))))
,
3288 TREE_OPERAND (arg1, 1)(*((const_cast<tree*> (tree_operand_check ((arg1), (1),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3288, __FUNCTION__)))))
)
3289 || OP_SAME (1))
3290 && OP_SAME_WITH_NULL (2)
3291 && OP_SAME_WITH_NULL (3)
3292 /* Compare low bound and element size as with OEP_ADDRESS_OF
3293 we have to account for the offset of the ref. */
3294 && (TREE_TYPE (TREE_OPERAND (arg0, 0))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check
((arg0), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3294, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3294, __FUNCTION__))->typed.type)
3295 == TREE_TYPE (TREE_OPERAND (arg1, 0))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check
((arg1), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3295, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3295, __FUNCTION__))->typed.type)
3296 || (operand_equal_p (array_ref_low_bound
3297 (CONST_CAST_TREE (arg0)(const_cast<union tree_node *> (((arg0))))),
3298 array_ref_low_bound
3299 (CONST_CAST_TREE (arg1)(const_cast<union tree_node *> (((arg1))))), flags)
3300 && operand_equal_p (array_ref_element_size
3301 (CONST_CAST_TREE (arg0)(const_cast<union tree_node *> (((arg0))))),
3302 array_ref_element_size
3303 (CONST_CAST_TREE (arg1)(const_cast<union tree_node *> (((arg1))))),
3304 flags))));
3305
3306 case COMPONENT_REF:
3307 /* Handle operand 2 the same as for ARRAY_REF. Operand 0
3308 may be NULL when we're called to compare MEM_EXPRs. */
3309 if (!OP_SAME_WITH_NULL (0))
3310 return false;
3311 {
3312 bool compare_address = flags & OEP_ADDRESS_OF;
3313
3314 /* Most of time we only need to compare FIELD_DECLs for equality.
3315 However when determining address look into actual offsets.
3316 These may match for unions and unshared record types. */
3317 flags &= ~OEP_ADDRESS_OF;
3318 if (!OP_SAME (1))
3319 {
3320 if (compare_address)
3321 {
3322 if (TREE_OPERAND (arg0, 2)(*((const_cast<tree*> (tree_operand_check ((arg0), (2),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3322, __FUNCTION__)))))
3323 || TREE_OPERAND (arg1, 2)(*((const_cast<tree*> (tree_operand_check ((arg1), (2),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3323, __FUNCTION__)))))
)
3324 return OP_SAME_WITH_NULL (2);
3325 tree field0 = TREE_OPERAND (arg0, 1)(*((const_cast<tree*> (tree_operand_check ((arg0), (1),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3325, __FUNCTION__)))))
;
3326 tree field1 = TREE_OPERAND (arg1, 1)(*((const_cast<tree*> (tree_operand_check ((arg1), (1),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3326, __FUNCTION__)))))
;
3327
3328 if (!operand_equal_p (DECL_FIELD_OFFSET (field0)((tree_check ((field0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3328, __FUNCTION__, (FIELD_DECL)))->field_decl.offset)
,
3329 DECL_FIELD_OFFSET (field1)((tree_check ((field1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3329, __FUNCTION__, (FIELD_DECL)))->field_decl.offset)
, flags)
3330 || !operand_equal_p (DECL_FIELD_BIT_OFFSET (field0)((tree_check ((field0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3330, __FUNCTION__, (FIELD_DECL)))->field_decl.bit_offset
)
,
3331 DECL_FIELD_BIT_OFFSET (field1)((tree_check ((field1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3331, __FUNCTION__, (FIELD_DECL)))->field_decl.bit_offset
)
,
3332 flags))
3333 return false;
3334 }
3335 else
3336 return false;
3337 }
3338 }
3339 return OP_SAME_WITH_NULL (2);
3340
3341 case BIT_FIELD_REF:
3342 if (!OP_SAME (0))
3343 return false;
3344 flags &= ~OEP_ADDRESS_OF;
3345 return OP_SAME (1) && OP_SAME (2);
3346
3347 default:
3348 return false;
3349 }
3350
3351 case tcc_expression:
3352 switch (TREE_CODE (arg0)((enum tree_code) (arg0)->base.code))
3353 {
3354 case ADDR_EXPR:
3355 /* Be sure we pass right ADDRESS_OF flag. */
3356 gcc_checking_assert (!(flags & OEP_ADDRESS_OF))((void)(!(!(flags & OEP_ADDRESS_OF)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3356, __FUNCTION__), 0 : 0))
;
3357 return operand_equal_p (TREE_OPERAND (arg0, 0)(*((const_cast<tree*> (tree_operand_check ((arg0), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3357, __FUNCTION__)))))
,
3358 TREE_OPERAND (arg1, 0)(*((const_cast<tree*> (tree_operand_check ((arg1), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3358, __FUNCTION__)))))
,
3359 flags | OEP_ADDRESS_OF);
3360
3361 case TRUTH_NOT_EXPR:
3362 return OP_SAME (0);
3363
3364 case TRUTH_ANDIF_EXPR:
3365 case TRUTH_ORIF_EXPR:
3366 return OP_SAME (0) && OP_SAME (1);
3367
3368 case WIDEN_MULT_PLUS_EXPR:
3369 case WIDEN_MULT_MINUS_EXPR:
3370 if (!OP_SAME (2))
3371 return false;
3372 /* The multiplcation operands are commutative. */
3373 /* FALLTHRU */
3374
3375 case TRUTH_AND_EXPR:
3376 case TRUTH_OR_EXPR:
3377 case TRUTH_XOR_EXPR:
3378 if (OP_SAME (0) && OP_SAME (1))
3379 return true;
3380
3381 /* Otherwise take into account this is a commutative operation. */
3382 return (operand_equal_p (TREE_OPERAND (arg0, 0)(*((const_cast<tree*> (tree_operand_check ((arg0), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3382, __FUNCTION__)))))
,
3383 TREE_OPERAND (arg1, 1)(*((const_cast<tree*> (tree_operand_check ((arg1), (1),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3383, __FUNCTION__)))))
, flags)
3384 && operand_equal_p (TREE_OPERAND (arg0, 1)(*((const_cast<tree*> (tree_operand_check ((arg0), (1),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3384, __FUNCTION__)))))
,
3385 TREE_OPERAND (arg1, 0)(*((const_cast<tree*> (tree_operand_check ((arg1), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3385, __FUNCTION__)))))
, flags));
3386
3387 case COND_EXPR:
3388 if (! OP_SAME (1) || ! OP_SAME_WITH_NULL (2))
3389 return false;
3390 flags &= ~OEP_ADDRESS_OF;
3391 return OP_SAME (0);
3392
3393 case BIT_INSERT_EXPR:
3394 /* BIT_INSERT_EXPR has an implict operand as the type precision
3395 of op1. Need to check to make sure they are the same. */
3396 if (TREE_CODE (TREE_OPERAND (arg0, 1))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check
((arg0), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3396, __FUNCTION__))))))->base.code)
== INTEGER_CST
3397 && TREE_CODE (TREE_OPERAND (arg1, 1))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check
((arg1), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3397, __FUNCTION__))))))->base.code)
== INTEGER_CST
3398 && TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (arg0, 1)))((tree_class_check ((((contains_struct_check (((*((const_cast
<tree*> (tree_operand_check ((arg0), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3398, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3398, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3398, __FUNCTION__))->type_common.precision)
3399 != TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (arg1, 1)))((tree_class_check ((((contains_struct_check (((*((const_cast
<tree*> (tree_operand_check ((arg1), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3399, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3399, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3399, __FUNCTION__))->type_common.precision)
)
3400 return false;
3401 /* FALLTHRU */
3402
3403 case VEC_COND_EXPR:
3404 case DOT_PROD_EXPR:
3405 return OP_SAME (0) && OP_SAME (1) && OP_SAME (2);
3406
3407 case MODIFY_EXPR:
3408 case INIT_EXPR:
3409 case COMPOUND_EXPR:
3410 case PREDECREMENT_EXPR:
3411 case PREINCREMENT_EXPR:
3412 case POSTDECREMENT_EXPR:
3413 case POSTINCREMENT_EXPR:
3414 if (flags & OEP_LEXICOGRAPHIC)
3415 return OP_SAME (0) && OP_SAME (1);
3416 return false;
3417
3418 case CLEANUP_POINT_EXPR:
3419 case EXPR_STMT:
3420 case SAVE_EXPR:
3421 if (flags & OEP_LEXICOGRAPHIC)
3422 return OP_SAME (0);
3423 return false;
3424
3425 case OBJ_TYPE_REF:
3426 /* Virtual table reference. */
3427 if (!operand_equal_p (OBJ_TYPE_REF_EXPR (arg0)(*((const_cast<tree*> (tree_operand_check (((tree_check
((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3427, __FUNCTION__, (OBJ_TYPE_REF)))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3427, __FUNCTION__)))))
,
3428 OBJ_TYPE_REF_EXPR (arg1)(*((const_cast<tree*> (tree_operand_check (((tree_check
((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3428, __FUNCTION__, (OBJ_TYPE_REF)))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3428, __FUNCTION__)))))
, flags))
3429 return false;
3430 flags &= ~OEP_ADDRESS_OF;
3431 if (tree_to_uhwi (OBJ_TYPE_REF_TOKEN (arg0)(*((const_cast<tree*> (tree_operand_check (((tree_check
((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3431, __FUNCTION__, (OBJ_TYPE_REF)))), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3431, __FUNCTION__)))))
)
3432 != tree_to_uhwi (OBJ_TYPE_REF_TOKEN (arg1)(*((const_cast<tree*> (tree_operand_check (((tree_check
((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3432, __FUNCTION__, (OBJ_TYPE_REF)))), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3432, __FUNCTION__)))))
))
3433 return false;
3434 if (!operand_equal_p (OBJ_TYPE_REF_OBJECT (arg0)(*((const_cast<tree*> (tree_operand_check (((tree_check
((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3434, __FUNCTION__, (OBJ_TYPE_REF)))), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3434, __FUNCTION__)))))
,
3435 OBJ_TYPE_REF_OBJECT (arg1)(*((const_cast<tree*> (tree_operand_check (((tree_check
((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3435, __FUNCTION__, (OBJ_TYPE_REF)))), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3435, __FUNCTION__)))))
, flags))
3436 return false;
3437 if (virtual_method_call_p (arg0))
3438 {
3439 if (!virtual_method_call_p (arg1))
3440 return false;
3441 return types_same_for_odr (obj_type_ref_class (arg0),
3442 obj_type_ref_class (arg1));
3443 }
3444 return false;
3445
3446 default:
3447 return false;
3448 }
3449
3450 case tcc_vl_exp:
3451 switch (TREE_CODE (arg0)((enum tree_code) (arg0)->base.code))
3452 {
3453 case CALL_EXPR:
3454 if ((CALL_EXPR_FN (arg0)(*((const_cast<tree*> (tree_operand_check (((tree_check
((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3454, __FUNCTION__, (CALL_EXPR)))), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3454, __FUNCTION__)))))
== NULL_TREE(tree) __null)
3455 != (CALL_EXPR_FN (arg1)(*((const_cast<tree*> (tree_operand_check (((tree_check
((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3455, __FUNCTION__, (CALL_EXPR)))), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3455, __FUNCTION__)))))
== NULL_TREE(tree) __null))
3456 /* If not both CALL_EXPRs are either internal or normal function
3457 functions, then they are not equal. */
3458 return false;
3459 else if (CALL_EXPR_FN (arg0)(*((const_cast<tree*> (tree_operand_check (((tree_check
((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3459, __FUNCTION__, (CALL_EXPR)))), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3459, __FUNCTION__)))))
== NULL_TREE(tree) __null)
3460 {
3461 /* If the CALL_EXPRs call different internal functions, then they
3462 are not equal. */
3463 if (CALL_EXPR_IFN (arg0)((tree_check ((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3463, __FUNCTION__, (CALL_EXPR)))->base.u.ifn)
!= CALL_EXPR_IFN (arg1)((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3463, __FUNCTION__, (CALL_EXPR)))->base.u.ifn)
)
3464 return false;
3465 }
3466 else
3467 {
3468 /* If the CALL_EXPRs call different functions, then they are not
3469 equal. */
3470 if (! operand_equal_p (CALL_EXPR_FN (arg0)(*((const_cast<tree*> (tree_operand_check (((tree_check
((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3470, __FUNCTION__, (CALL_EXPR)))), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3470, __FUNCTION__)))))
, CALL_EXPR_FN (arg1)(*((const_cast<tree*> (tree_operand_check (((tree_check
((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3470, __FUNCTION__, (CALL_EXPR)))), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3470, __FUNCTION__)))))
,
3471 flags))
3472 return false;
3473 }
3474
3475 /* FIXME: We could skip this test for OEP_MATCH_SIDE_EFFECTS. */
3476 {
3477 unsigned int cef = call_expr_flags (arg0);
3478 if (flags & OEP_PURE_SAME)
3479 cef &= ECF_CONST(1 << 0) | ECF_PURE(1 << 1);
3480 else
3481 cef &= ECF_CONST(1 << 0);
3482 if (!cef && !(flags & OEP_LEXICOGRAPHIC))
3483 return false;
3484 }
3485
3486 /* Now see if all the arguments are the same. */
3487 {
3488 const_call_expr_arg_iterator iter0, iter1;
3489 const_tree a0, a1;
3490 for (a0 = first_const_call_expr_arg (arg0, &iter0),
3491 a1 = first_const_call_expr_arg (arg1, &iter1);
3492 a0 && a1;
3493 a0 = next_const_call_expr_arg (&iter0),
3494 a1 = next_const_call_expr_arg (&iter1))
3495 if (! operand_equal_p (a0, a1, flags))
3496 return false;
3497
3498 /* If we get here and both argument lists are exhausted
3499 then the CALL_EXPRs are equal. */
3500 return ! (a0 || a1);
3501 }
3502 default:
3503 return false;
3504 }
3505
3506 case tcc_declaration:
3507 /* Consider __builtin_sqrt equal to sqrt. */
3508 return (TREE_CODE (arg0)((enum tree_code) (arg0)->base.code) == FUNCTION_DECL
3509 && fndecl_built_in_p (arg0) && fndecl_built_in_p (arg1)
3510 && DECL_BUILT_IN_CLASS (arg0)((built_in_class) (tree_check ((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3510, __FUNCTION__, (FUNCTION_DECL)))->function_decl.built_in_class
)
== DECL_BUILT_IN_CLASS (arg1)((built_in_class) (tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3510, __FUNCTION__, (FUNCTION_DECL)))->function_decl.built_in_class
)
3511 && (DECL_UNCHECKED_FUNCTION_CODE (arg0)((tree_check ((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3511, __FUNCTION__, (FUNCTION_DECL)))->function_decl.function_code
)
3512 == DECL_UNCHECKED_FUNCTION_CODE (arg1)((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3512, __FUNCTION__, (FUNCTION_DECL)))->function_decl.function_code
)
));
3513
3514 case tcc_exceptional:
3515 if (TREE_CODE (arg0)((enum tree_code) (arg0)->base.code) == CONSTRUCTOR)
3516 {
3517 if (CONSTRUCTOR_NO_CLEARING (arg0)((tree_check ((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3517, __FUNCTION__, (CONSTRUCTOR)))->base.public_flag)
!= CONSTRUCTOR_NO_CLEARING (arg1)((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3517, __FUNCTION__, (CONSTRUCTOR)))->base.public_flag)
)
3518 return false;
3519
3520 /* In GIMPLE constructors are used only to build vectors from
3521 elements. Individual elements in the constructor must be
3522 indexed in increasing order and form an initial sequence.
3523
3524 We make no effort to compare constructors in generic.
3525 (see sem_variable::equals in ipa-icf which can do so for
3526 constants). */
3527 if (!VECTOR_TYPE_P (TREE_TYPE (arg0))(((enum tree_code) (((contains_struct_check ((arg0), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3527, __FUNCTION__))->typed.type))->base.code) == VECTOR_TYPE
)
3528 || !VECTOR_TYPE_P (TREE_TYPE (arg1))(((enum tree_code) (((contains_struct_check ((arg1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3528, __FUNCTION__))->typed.type))->base.code) == VECTOR_TYPE
)
)
3529 return false;
3530
3531 /* Be sure that vectors constructed have the same representation.
3532 We only tested element precision and modes to match.
3533 Vectors may be BLKmode and thus also check that the number of
3534 parts match. */
3535 if (maybe_ne (TYPE_VECTOR_SUBPARTS (TREE_TYPE (arg0)((contains_struct_check ((arg0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3535, __FUNCTION__))->typed.type)
),
3536 TYPE_VECTOR_SUBPARTS (TREE_TYPE (arg1)((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3536, __FUNCTION__))->typed.type)
)))
3537 return false;
3538
3539 vec<constructor_elt, va_gc> *v0 = CONSTRUCTOR_ELTS (arg0)((tree_check ((arg0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3539, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
;
3540 vec<constructor_elt, va_gc> *v1 = CONSTRUCTOR_ELTS (arg1)((tree_check ((arg1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3540, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
;
3541 unsigned int len = vec_safe_length (v0);
3542
3543 if (len != vec_safe_length (v1))
3544 return false;
3545
3546 for (unsigned int i = 0; i < len; i++)
3547 {
3548 constructor_elt *c0 = &(*v0)[i];
3549 constructor_elt *c1 = &(*v1)[i];
3550
3551 if (!operand_equal_p (c0->value, c1->value, flags)
3552 /* In GIMPLE the indexes can be either NULL or matching i.
3553 Double check this so we won't get false
3554 positives for GENERIC. */
3555 || (c0->index
3556 && (TREE_CODE (c0->index)((enum tree_code) (c0->index)->base.code) != INTEGER_CST
3557 || compare_tree_int (c0->index, i)))
3558 || (c1->index
3559 && (TREE_CODE (c1->index)((enum tree_code) (c1->index)->base.code) != INTEGER_CST
3560 || compare_tree_int (c1->index, i))))
3561 return false;
3562 }
3563 return true;
3564 }
3565 else if (TREE_CODE (arg0)((enum tree_code) (arg0)->base.code) == STATEMENT_LIST
3566 && (flags & OEP_LEXICOGRAPHIC))
3567 {
3568 /* Compare the STATEMENT_LISTs. */
3569 tree_stmt_iterator tsi1, tsi2;
3570 tree body1 = CONST_CAST_TREE (arg0)(const_cast<union tree_node *> (((arg0))));
3571 tree body2 = CONST_CAST_TREE (arg1)(const_cast<union tree_node *> (((arg1))));
3572 for (tsi1 = tsi_start (body1), tsi2 = tsi_start (body2); ;
3573 tsi_next (&tsi1), tsi_next (&tsi2))
3574 {
3575 /* The lists don't have the same number of statements. */
3576 if (tsi_end_p (tsi1) ^ tsi_end_p (tsi2))
3577 return false;
3578 if (tsi_end_p (tsi1) && tsi_end_p (tsi2))
3579 return true;
3580 if (!operand_equal_p (tsi_stmt (tsi1), tsi_stmt (tsi2),
3581 flags & (OEP_LEXICOGRAPHIC
3582 | OEP_NO_HASH_CHECK)))
3583 return false;
3584 }
3585 }
3586 return false;
3587
3588 case tcc_statement:
3589 switch (TREE_CODE (arg0)((enum tree_code) (arg0)->base.code))
3590 {
3591 case RETURN_EXPR:
3592 if (flags & OEP_LEXICOGRAPHIC)
3593 return OP_SAME_WITH_NULL (0);
3594 return false;
3595 case DEBUG_BEGIN_STMT:
3596 if (flags & OEP_LEXICOGRAPHIC)
3597 return true;
3598 return false;
3599 default:
3600 return false;
3601 }
3602
3603 default:
3604 return false;
3605 }
3606
3607#undef OP_SAME
3608#undef OP_SAME_WITH_NULL
3609}
3610
3611/* Generate a hash value for an expression. This can be used iteratively
3612 by passing a previous result as the HSTATE argument. */
3613
3614void
3615operand_compare::hash_operand (const_tree t, inchash::hash &hstate,
3616 unsigned int flags)
3617{
3618 int i;
3619 enum tree_code code;
3620 enum tree_code_class tclass;
3621
3622 if (t == NULL_TREE(tree) __null || t == error_mark_nodeglobal_trees[TI_ERROR_MARK])
3623 {
3624 hstate.merge_hash (0);
3625 return;
3626 }
3627
3628 STRIP_ANY_LOCATION_WRAPPER (t)(t) = tree_strip_any_location_wrapper ((const_cast<union tree_node
*> (((t)))))
;
3629
3630 if (!(flags & OEP_ADDRESS_OF))
3631 STRIP_NOPS (t)(t) = tree_strip_nop_conversions ((const_cast<union tree_node
*> (((t)))))
;
3632
3633 code = TREE_CODE (t)((enum tree_code) (t)->base.code);
3634
3635 switch (code)
3636 {
3637 /* Alas, constants aren't shared, so we can't rely on pointer
3638 identity. */
3639 case VOID_CST:
3640 hstate.merge_hash (0);
3641 return;
3642 case INTEGER_CST:
3643 gcc_checking_assert (!(flags & OEP_ADDRESS_OF))((void)(!(!(flags & OEP_ADDRESS_OF)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3643, __FUNCTION__), 0 : 0))
;
3644 for (i = 0; i < TREE_INT_CST_EXT_NUNITS (t)((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3644, __FUNCTION__, (INTEGER_CST)))->base.u.int_length.extended
)
; i++)
3645 hstate.add_hwi (TREE_INT_CST_ELT (t, i)(*tree_int_cst_elt_check ((t), (i), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3645, __FUNCTION__))
);
3646 return;
3647 case REAL_CST:
3648 {
3649 unsigned int val2;
3650 if (!HONOR_SIGNED_ZEROS (t) && real_zerop (t))
3651 val2 = rvc_zero;
3652 else
3653 val2 = real_hash (TREE_REAL_CST_PTR (t)((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3653, __FUNCTION__, (REAL_CST)))->real_cst.real_cst_ptr)
);
3654 hstate.merge_hash (val2);
3655 return;
3656 }
3657 case FIXED_CST:
3658 {
3659 unsigned int val2 = fixed_hash (TREE_FIXED_CST_PTR (t)((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3659, __FUNCTION__, (FIXED_CST)))->fixed_cst.fixed_cst_ptr
)
);
3660 hstate.merge_hash (val2);
3661 return;
3662 }
3663 case STRING_CST:
3664 hstate.add ((const void *) TREE_STRING_POINTER (t)((const char *)((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3664, __FUNCTION__, (STRING_CST)))->string.str))
,
3665 TREE_STRING_LENGTH (t)((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3665, __FUNCTION__, (STRING_CST)))->string.length)
);
3666 return;
3667 case COMPLEX_CST:
3668 hash_operand (TREE_REALPART (t)((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3668, __FUNCTION__, (COMPLEX_CST)))->complex.real)
, hstate, flags);
3669 hash_operand (TREE_IMAGPART (t)((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3669, __FUNCTION__, (COMPLEX_CST)))->complex.imag)
, hstate, flags);
3670 return;
3671 case VECTOR_CST:
3672 {
3673 hstate.add_int (VECTOR_CST_NPATTERNS (t)(1U << ((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3673, __FUNCTION__, (VECTOR_CST)))->base.u.vector_cst.log2_npatterns
))
);
3674 hstate.add_int (VECTOR_CST_NELTS_PER_PATTERN (t)((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3674, __FUNCTION__, (VECTOR_CST)))->base.u.vector_cst.nelts_per_pattern
)
);
3675 unsigned int count = vector_cst_encoded_nelts (t);
3676 for (unsigned int i = 0; i < count; ++i)
3677 hash_operand (VECTOR_CST_ENCODED_ELT (t, i)((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3677, __FUNCTION__, (VECTOR_CST)))->vector.elts[i])
, hstate, flags);
3678 return;
3679 }
3680 case SSA_NAME:
3681 /* We can just compare by pointer. */
3682 hstate.add_hwi (SSA_NAME_VERSION (t)(tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3682, __FUNCTION__, (SSA_NAME)))->base.u.version
);
3683 return;
3684 case PLACEHOLDER_EXPR:
3685 /* The node itself doesn't matter. */
3686 return;
3687 case BLOCK:
3688 case OMP_CLAUSE:
3689 /* Ignore. */
3690 return;
3691 case TREE_LIST:
3692 /* A list of expressions, for a CALL_EXPR or as the elements of a
3693 VECTOR_CST. */
3694 for (; t; t = TREE_CHAIN (t)((contains_struct_check ((t), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3694, __FUNCTION__))->common.chain)
)
3695 hash_operand (TREE_VALUE (t)((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3695, __FUNCTION__, (TREE_LIST)))->list.value)
, hstate, flags);
3696 return;
3697 case CONSTRUCTOR:
3698 {
3699 unsigned HOST_WIDE_INTlong idx;
3700 tree field, value;
3701 flags &= ~OEP_ADDRESS_OF;
3702 hstate.add_int (CONSTRUCTOR_NO_CLEARING (t)((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3702, __FUNCTION__, (CONSTRUCTOR)))->base.public_flag)
);
3703 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (t), idx, field, value)for (idx = 0; (idx >= vec_safe_length (((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3703, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
? false : (((void) (value = (*((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3703, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
idx].value)), (field = (*((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3703, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
idx].index), true); (idx)++)
3704 {
3705 /* In GIMPLE the indexes can be either NULL or matching i. */
3706 if (field == NULL_TREE(tree) __null)
3707 field = bitsize_int (idx)size_int_kind (idx, stk_bitsizetype);
3708 hash_operand (field, hstate, flags);
3709 hash_operand (value, hstate, flags);
3710 }
3711 return;
3712 }
3713 case STATEMENT_LIST:
3714 {
3715 tree_stmt_iterator i;
3716 for (i = tsi_start (CONST_CAST_TREE (t)(const_cast<union tree_node *> (((t)))));
3717 !tsi_end_p (i); tsi_next (&i))
3718 hash_operand (tsi_stmt (i), hstate, flags);
3719 return;
3720 }
3721 case TREE_VEC:
3722 for (i = 0; i < TREE_VEC_LENGTH (t)((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3722, __FUNCTION__, (TREE_VEC)))->base.u.length)
; ++i)
3723 hash_operand (TREE_VEC_ELT (t, i)(*((const_cast<tree *> (tree_vec_elt_check ((t), (i), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3723, __FUNCTION__)))))
, hstate, flags);
3724 return;
3725 case IDENTIFIER_NODE:
3726 hstate.add_object (IDENTIFIER_HASH_VALUE (t)((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3726, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.hash_value
)
);
3727 return;
3728 case FUNCTION_DECL:
3729 /* When referring to a built-in FUNCTION_DECL, use the __builtin__ form.
3730 Otherwise nodes that compare equal according to operand_equal_p might
3731 get different hash codes. However, don't do this for machine specific
3732 or front end builtins, since the function code is overloaded in those
3733 cases. */
3734 if (DECL_BUILT_IN_CLASS (t)((built_in_class) (tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3734, __FUNCTION__, (FUNCTION_DECL)))->function_decl.built_in_class
)
== BUILT_IN_NORMAL
3735 && builtin_decl_explicit_p (DECL_FUNCTION_CODE (t)))
3736 {
3737 t = builtin_decl_explicit (DECL_FUNCTION_CODE (t));
3738 code = TREE_CODE (t)((enum tree_code) (t)->base.code);
3739 }
3740 /* FALL THROUGH */
3741 default:
3742 if (POLY_INT_CST_P (t)(1 > 1 && ((enum tree_code) (t)->base.code) == POLY_INT_CST
)
)
3743 {
3744 for (unsigned int i = 0; i < NUM_POLY_INT_COEFFS1; ++i)
3745 hstate.add_wide_int (wi::to_wide (POLY_INT_CST_COEFF (t, i)((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3745, __FUNCTION__, (POLY_INT_CST)))->poly_int_cst.coeffs
[i])
));
3746 return;
3747 }
3748 tclass = TREE_CODE_CLASS (code)tree_code_type[(int) (code)];
3749
3750 if (tclass == tcc_declaration)
3751 {
3752 /* DECL's have a unique ID */
3753 hstate.add_hwi (DECL_UID (t)((contains_struct_check ((t), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3753, __FUNCTION__))->decl_minimal.uid)
);
3754 }
3755 else if (tclass == tcc_comparison && !commutative_tree_code (code))
3756 {
3757 /* For comparisons that can be swapped, use the lower
3758 tree code. */
3759 enum tree_code ccode = swap_tree_comparison (code);
3760 if (code < ccode)
3761 ccode = code;
3762 hstate.add_object (ccode);
3763 hash_operand (TREE_OPERAND (t, ccode != code)(*((const_cast<tree*> (tree_operand_check ((t), (ccode !=
code), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3763, __FUNCTION__)))))
, hstate, flags);
3764 hash_operand (TREE_OPERAND (t, ccode == code)(*((const_cast<tree*> (tree_operand_check ((t), (ccode ==
code), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3764, __FUNCTION__)))))
, hstate, flags);
3765 }
3766 else if (CONVERT_EXPR_CODE_P (code)((code) == NOP_EXPR || (code) == CONVERT_EXPR))
3767 {
3768 /* NOP_EXPR and CONVERT_EXPR are considered equal by
3769 operand_equal_p. */
3770 enum tree_code ccode = NOP_EXPR;
3771 hstate.add_object (ccode);
3772
3773 /* Don't hash the type, that can lead to having nodes which
3774 compare equal according to operand_equal_p, but which
3775 have different hash codes. Make sure to include signedness
3776 in the hash computation. */
3777 hstate.add_int (TYPE_UNSIGNED (TREE_TYPE (t))((tree_class_check ((((contains_struct_check ((t), (TS_TYPED)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3777, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3777, __FUNCTION__))->base.u.bits.unsigned_flag)
);
3778 hash_operand (TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3778, __FUNCTION__)))))
, hstate, flags);
3779 }
3780 /* For OEP_ADDRESS_OF, hash MEM_EXPR[&decl, 0] the same as decl. */
3781 else if (code == MEM_REF
3782 && (flags & OEP_ADDRESS_OF) != 0
3783 && TREE_CODE (TREE_OPERAND (t, 0))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check
((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3783, __FUNCTION__))))))->base.code)
== ADDR_EXPR
3784 && DECL_P (TREE_OPERAND (TREE_OPERAND (t, 0), 0))(tree_code_type[(int) (((enum tree_code) ((*((const_cast<tree
*> (tree_operand_check (((*((const_cast<tree*> (tree_operand_check
((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3784, __FUNCTION__)))))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3784, __FUNCTION__))))))->base.code))] == tcc_declaration
)
3785 && integer_zerop (TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3785, __FUNCTION__)))))
))
3786 hash_operand (TREE_OPERAND (TREE_OPERAND (t, 0), 0)(*((const_cast<tree*> (tree_operand_check (((*((const_cast
<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3786, __FUNCTION__)))))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3786, __FUNCTION__)))))
,
3787 hstate, flags);
3788 /* Don't ICE on FE specific trees, or their arguments etc.
3789 during operand_equal_p hash verification. */
3790 else if (!IS_EXPR_CODE_CLASS (tclass)((tclass) >= tcc_reference && (tclass) <= tcc_expression
)
)
3791 gcc_assert (flags & OEP_HASH_CHECK)((void)(!(flags & OEP_HASH_CHECK) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3791, __FUNCTION__), 0 : 0))
;
3792 else
3793 {
3794 unsigned int sflags = flags;
3795
3796 hstate.add_object (code);
3797
3798 switch (code)
3799 {
3800 case ADDR_EXPR:
3801 gcc_checking_assert (!(flags & OEP_ADDRESS_OF))((void)(!(!(flags & OEP_ADDRESS_OF)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3801, __FUNCTION__), 0 : 0))
;
3802 flags |= OEP_ADDRESS_OF;
3803 sflags = flags;
3804 break;
3805
3806 case INDIRECT_REF:
3807 case MEM_REF:
3808 case TARGET_MEM_REF:
3809 flags &= ~OEP_ADDRESS_OF;
3810 sflags = flags;
3811 break;
3812
3813 case COMPONENT_REF:
3814 if (sflags & OEP_ADDRESS_OF)
3815 {
3816 hash_operand (TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3816, __FUNCTION__)))))
, hstate, flags);
3817 if (TREE_OPERAND (t, 2)(*((const_cast<tree*> (tree_operand_check ((t), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3817, __FUNCTION__)))))
)
3818 hash_operand (TREE_OPERAND (t, 2)(*((const_cast<tree*> (tree_operand_check ((t), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3818, __FUNCTION__)))))
, hstate,
3819 flags & ~OEP_ADDRESS_OF);
3820 else
3821 {
3822 tree field = TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3822, __FUNCTION__)))))
;
3823 hash_operand (DECL_FIELD_OFFSET (field)((tree_check ((field), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3823, __FUNCTION__, (FIELD_DECL)))->field_decl.offset)
,
3824 hstate, flags & ~OEP_ADDRESS_OF);
3825 hash_operand (DECL_FIELD_BIT_OFFSET (field)((tree_check ((field), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3825, __FUNCTION__, (FIELD_DECL)))->field_decl.bit_offset
)
,
3826 hstate, flags & ~OEP_ADDRESS_OF);
3827 }
3828 return;
3829 }
3830 break;
3831 case ARRAY_REF:
3832 case ARRAY_RANGE_REF:
3833 case BIT_FIELD_REF:
3834 sflags &= ~OEP_ADDRESS_OF;
3835 break;
3836
3837 case COND_EXPR:
3838 flags &= ~OEP_ADDRESS_OF;
3839 break;
3840
3841 case WIDEN_MULT_PLUS_EXPR:
3842 case WIDEN_MULT_MINUS_EXPR:
3843 {
3844 /* The multiplication operands are commutative. */
3845 inchash::hash one, two;
3846 hash_operand (TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3846, __FUNCTION__)))))
, one, flags);
3847 hash_operand (TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3847, __FUNCTION__)))))
, two, flags);
3848 hstate.add_commutative (one, two);
3849 hash_operand (TREE_OPERAND (t, 2)(*((const_cast<tree*> (tree_operand_check ((t), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3849, __FUNCTION__)))))
, two, flags);
3850 return;
3851 }
3852
3853 case CALL_EXPR:
3854 if (CALL_EXPR_FN (t)(*((const_cast<tree*> (tree_operand_check (((tree_check
((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3854, __FUNCTION__, (CALL_EXPR)))), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3854, __FUNCTION__)))))
== NULL_TREE(tree) __null)
3855 hstate.add_int (CALL_EXPR_IFN (t)((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3855, __FUNCTION__, (CALL_EXPR)))->base.u.ifn)
);
3856 break;
3857
3858 case TARGET_EXPR:
3859 /* For TARGET_EXPR, just hash on the TARGET_EXPR_SLOT.
3860 Usually different TARGET_EXPRs just should use
3861 different temporaries in their slots. */
3862 hash_operand (TARGET_EXPR_SLOT (t)(*(tree_operand_check_code ((t), (TARGET_EXPR), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3862, __FUNCTION__)))
, hstate, flags);
3863 return;
3864
3865 case OBJ_TYPE_REF:
3866 /* Virtual table reference. */
3867 inchash::add_expr (OBJ_TYPE_REF_EXPR (t)(*((const_cast<tree*> (tree_operand_check (((tree_check
((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3867, __FUNCTION__, (OBJ_TYPE_REF)))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3867, __FUNCTION__)))))
, hstate, flags);
3868 flags &= ~OEP_ADDRESS_OF;
3869 inchash::add_expr (OBJ_TYPE_REF_TOKEN (t)(*((const_cast<tree*> (tree_operand_check (((tree_check
((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3869, __FUNCTION__, (OBJ_TYPE_REF)))), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3869, __FUNCTION__)))))
, hstate, flags);
3870 inchash::add_expr (OBJ_TYPE_REF_OBJECT (t)(*((const_cast<tree*> (tree_operand_check (((tree_check
((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3870, __FUNCTION__, (OBJ_TYPE_REF)))), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3870, __FUNCTION__)))))
, hstate, flags);
3871 if (!virtual_method_call_p (t))
3872 return;
3873 if (tree c = obj_type_ref_class (t))
3874 {
3875 c = TYPE_NAME (TYPE_MAIN_VARIANT (c))((tree_class_check ((((tree_class_check ((c), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3875, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3875, __FUNCTION__))->type_common.name)
;
3876 /* We compute mangled names only when free_lang_data is run.
3877 In that case we can hash precisely. */
3878 if (TREE_CODE (c)((enum tree_code) (c)->base.code) == TYPE_DECL
3879 && DECL_ASSEMBLER_NAME_SET_P (c)(((contains_struct_check ((c), (TS_DECL_WITH_VIS), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3879, __FUNCTION__))->decl_with_vis.assembler_name) != (
tree) __null)
)
3880 hstate.add_object
3881 (IDENTIFIER_HASH_VALUE((tree_check ((decl_assembler_name (c)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3882, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.hash_value
)
3882 (DECL_ASSEMBLER_NAME (c))((tree_check ((decl_assembler_name (c)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3882, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.hash_value
)
);
3883 }
3884 return;
3885 default:
3886 break;
3887 }
3888
3889 /* Don't hash the type, that can lead to having nodes which
3890 compare equal according to operand_equal_p, but which
3891 have different hash codes. */
3892 if (code == NON_LVALUE_EXPR)
3893 {
3894 /* Make sure to include signness in the hash computation. */
3895 hstate.add_int (TYPE_UNSIGNED (TREE_TYPE (t))((tree_class_check ((((contains_struct_check ((t), (TS_TYPED)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3895, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3895, __FUNCTION__))->base.u.bits.unsigned_flag)
);
3896 hash_operand (TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3896, __FUNCTION__)))))
, hstate, flags);
3897 }
3898
3899 else if (commutative_tree_code (code))
3900 {
3901 /* It's a commutative expression. We want to hash it the same
3902 however it appears. We do this by first hashing both operands
3903 and then rehashing based on the order of their independent
3904 hashes. */
3905 inchash::hash one, two;
3906 hash_operand (TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3906, __FUNCTION__)))))
, one, flags);
3907 hash_operand (TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3907, __FUNCTION__)))))
, two, flags);
3908 hstate.add_commutative (one, two);
3909 }
3910 else
3911 for (i = TREE_OPERAND_LENGTH (t)tree_operand_length (t) - 1; i >= 0; --i)
3912 hash_operand (TREE_OPERAND (t, i)(*((const_cast<tree*> (tree_operand_check ((t), (i), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3912, __FUNCTION__)))))
, hstate,
3913 i == 0 ? flags : sflags);
3914 }
3915 return;
3916 }
3917}
3918
3919bool
3920operand_compare::verify_hash_value (const_tree arg0, const_tree arg1,
3921 unsigned int flags, bool *ret)
3922{
3923 /* When checking, verify at the outermost operand_equal_p call that
3924 if operand_equal_p returns non-zero then ARG0 and ARG1 has the same
3925 hash value. */
3926 if (flag_checkingglobal_options.x_flag_checking && !(flags & OEP_NO_HASH_CHECK))
3927 {
3928 if (operand_equal_p (arg0, arg1, flags | OEP_NO_HASH_CHECK))
3929 {
3930 if (arg0 != arg1)
3931 {
3932 inchash::hash hstate0 (0), hstate1 (0);
3933 hash_operand (arg0, hstate0, flags | OEP_HASH_CHECK);
3934 hash_operand (arg1, hstate1, flags | OEP_HASH_CHECK);
3935 hashval_t h0 = hstate0.end ();
3936 hashval_t h1 = hstate1.end ();
3937 gcc_assert (h0 == h1)((void)(!(h0 == h1) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3937, __FUNCTION__), 0 : 0))
;
3938 }
3939 *ret = true;
3940 }
3941 else
3942 *ret = false;
3943
3944 return true;
3945 }
3946
3947 return false;
3948}
3949
3950
3951static operand_compare default_compare_instance;
3952
3953/* Conveinece wrapper around operand_compare class because usually we do
3954 not need to play with the valueizer. */
3955
3956bool
3957operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags)
3958{
3959 return default_compare_instance.operand_equal_p (arg0, arg1, flags);
3960}
3961
3962namespace inchash
3963{
3964
3965/* Generate a hash value for an expression. This can be used iteratively
3966 by passing a previous result as the HSTATE argument.
3967
3968 This function is intended to produce the same hash for expressions which
3969 would compare equal using operand_equal_p. */
3970void
3971add_expr (const_tree t, inchash::hash &hstate, unsigned int flags)
3972{
3973 default_compare_instance.hash_operand (t, hstate, flags);
3974}
3975
3976}
3977
3978/* Similar to operand_equal_p, but see if ARG0 might be a variant of ARG1
3979 with a different signedness or a narrower precision. */
3980
3981static bool
3982operand_equal_for_comparison_p (tree arg0, tree arg1)
3983{
3984 if (operand_equal_p (arg0, arg1, 0))
3985 return true;
3986
3987 if (! INTEGRAL_TYPE_P (TREE_TYPE (arg0))(((enum tree_code) (((contains_struct_check ((arg0), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3987, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE
|| ((enum tree_code) (((contains_struct_check ((arg0), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3987, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (((contains_struct_check ((arg0), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3987, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE
)
3988 || ! INTEGRAL_TYPE_P (TREE_TYPE (arg1))(((enum tree_code) (((contains_struct_check ((arg1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3988, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE
|| ((enum tree_code) (((contains_struct_check ((arg1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3988, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (((contains_struct_check ((arg1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 3988, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE
)
)
3989 return false;
3990
3991 /* Discard any conversions that don't change the modes of ARG0 and ARG1
3992 and see if the inner values are the same. This removes any
3993 signedness comparison, which doesn't matter here. */
3994 tree op0 = arg0;
3995 tree op1 = arg1;
3996 STRIP_NOPS (op0)(op0) = tree_strip_nop_conversions ((const_cast<union tree_node
*> (((op0)))))
;
3997 STRIP_NOPS (op1)(op1) = tree_strip_nop_conversions ((const_cast<union tree_node
*> (((op1)))))
;
3998 if (operand_equal_p (op0, op1, 0))
3999 return true;
4000
4001 /* Discard a single widening conversion from ARG1 and see if the inner
4002 value is the same as ARG0. */
4003 if (CONVERT_EXPR_P (arg1)((((enum tree_code) (arg1)->base.code)) == NOP_EXPR || (((
enum tree_code) (arg1)->base.code)) == CONVERT_EXPR)
4004 && INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (arg1, 0)))(((enum tree_code) (((contains_struct_check (((*((const_cast<
tree*> (tree_operand_check ((arg1), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4004, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4004, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE
|| ((enum tree_code) (((contains_struct_check (((*((const_cast
<tree*> (tree_operand_check ((arg1), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4004, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4004, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (((contains_struct_check (((*((const_cast
<tree*> (tree_operand_check ((arg1), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4004, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4004, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE
)
4005 && TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (arg1, 0)))((tree_class_check ((((contains_struct_check (((*((const_cast
<tree*> (tree_operand_check ((arg1), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4005, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4005, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4005, __FUNCTION__))->type_common.precision)
4006 < TYPE_PRECISION (TREE_TYPE (arg1))((tree_class_check ((((contains_struct_check ((arg1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4006, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4006, __FUNCTION__))->type_common.precision)
4007 && operand_equal_p (arg0, TREE_OPERAND (arg1, 0)(*((const_cast<tree*> (tree_operand_check ((arg1), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4007, __FUNCTION__)))))
, 0))
4008 return true;
4009
4010 return false;
4011}
4012
4013/* See if ARG is an expression that is either a comparison or is performing
4014 arithmetic on comparisons. The comparisons must only be comparing
4015 two different values, which will be stored in *CVAL1 and *CVAL2; if
4016 they are nonzero it means that some operands have already been found.
4017 No variables may be used anywhere else in the expression except in the
4018 comparisons.
4019
4020 If this is true, return 1. Otherwise, return zero. */
4021
4022static bool
4023twoval_comparison_p (tree arg, tree *cval1, tree *cval2)
4024{
4025 enum tree_code code = TREE_CODE (arg)((enum tree_code) (arg)->base.code);
4026 enum tree_code_class tclass = TREE_CODE_CLASS (code)tree_code_type[(int) (code)];
4027
4028 /* We can handle some of the tcc_expression cases here. */
4029 if (tclass == tcc_expression && code == TRUTH_NOT_EXPR)
4030 tclass = tcc_unary;
4031 else if (tclass == tcc_expression
4032 && (code == TRUTH_ANDIF_EXPR || code == TRUTH_ORIF_EXPR
4033 || code == COMPOUND_EXPR))
4034 tclass = tcc_binary;
4035
4036 switch (tclass)
4037 {
4038 case tcc_unary:
4039 return twoval_comparison_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/fold-const.c"
, 4039, __FUNCTION__)))))
, cval1, cval2);
4040
4041 case tcc_binary:
4042 return (twoval_comparison_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/fold-const.c"
, 4042, __FUNCTION__)))))
, cval1, cval2)
4043 && twoval_comparison_p (TREE_OPERAND (arg, 1)(*((const_cast<tree*> (tree_operand_check ((arg), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4043, __FUNCTION__)))))
, cval1, cval2));
4044
4045 case tcc_constant:
4046 return true;
4047
4048 case tcc_expression:
4049 if (code == COND_EXPR)
4050 return (twoval_comparison_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/fold-const.c"
, 4050, __FUNCTION__)))))
, cval1, cval2)
4051 && twoval_comparison_p (TREE_OPERAND (arg, 1)(*((const_cast<tree*> (tree_operand_check ((arg), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4051, __FUNCTION__)))))
, cval1, cval2)
4052 && twoval_comparison_p (TREE_OPERAND (arg, 2)(*((const_cast<tree*> (tree_operand_check ((arg), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4052, __FUNCTION__)))))
, cval1, cval2));
4053 return false;
4054
4055 case tcc_comparison:
4056 /* First see if we can handle the first operand, then the second. For
4057 the second operand, we know *CVAL1 can't be zero. It must be that
4058 one side of the comparison is each of the values; test for the
4059 case where this isn't true by failing if the two operands
4060 are the same. */
4061
4062 if (operand_equal_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/fold-const.c"
, 4062, __FUNCTION__)))))
,
4063 TREE_OPERAND (arg, 1)(*((const_cast<tree*> (tree_operand_check ((arg), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4063, __FUNCTION__)))))
, 0))
4064 return false;
4065
4066 if (*cval1 == 0)
4067 *cval1 = TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4067, __FUNCTION__)))))
;
4068 else if (operand_equal_p (*cval1, TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4068, __FUNCTION__)))))
, 0))
4069 ;
4070 else if (*cval2 == 0)
4071 *cval2 = TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4071, __FUNCTION__)))))
;
4072 else if (operand_equal_p (*cval2, TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4072, __FUNCTION__)))))
, 0))
4073 ;
4074 else
4075 return false;
4076
4077 if (operand_equal_p (*cval1, TREE_OPERAND (arg, 1)(*((const_cast<tree*> (tree_operand_check ((arg), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4077, __FUNCTION__)))))
, 0))
4078 ;
4079 else if (*cval2 == 0)
4080 *cval2 = TREE_OPERAND (arg, 1)(*((const_cast<tree*> (tree_operand_check ((arg), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4080, __FUNCTION__)))))
;
4081 else if (operand_equal_p (*cval2, TREE_OPERAND (arg, 1)(*((const_cast<tree*> (tree_operand_check ((arg), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4081, __FUNCTION__)))))
, 0))
4082 ;
4083 else
4084 return false;
4085
4086 return true;
4087
4088 default:
4089 return false;
4090 }
4091}
4092
4093/* ARG is a tree that is known to contain just arithmetic operations and
4094 comparisons. Evaluate the operations in the tree substituting NEW0 for
4095 any occurrence of OLD0 as an operand of a comparison and likewise for
4096 NEW1 and OLD1. */
4097
4098static tree
4099eval_subst (location_t loc, tree arg, tree old0, tree new0,
4100 tree old1, tree new1)
4101{
4102 tree type = TREE_TYPE (arg)((contains_struct_check ((arg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4102, __FUNCTION__))->typed.type)
;
4103 enum tree_code code = TREE_CODE (arg)((enum tree_code) (arg)->base.code);
4104 enum tree_code_class tclass = TREE_CODE_CLASS (code)tree_code_type[(int) (code)];
4105
4106 /* We can handle some of the tcc_expression cases here. */
4107 if (tclass == tcc_expression && code == TRUTH_NOT_EXPR)
4108 tclass = tcc_unary;
4109 else if (tclass == tcc_expression
4110 && (code == TRUTH_ANDIF_EXPR || code == TRUTH_ORIF_EXPR))
4111 tclass = tcc_binary;
4112
4113 switch (tclass)
4114 {
4115 case tcc_unary:
4116 return fold_build1_loc (loc, code, type,
4117 eval_subst (loc, TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4117, __FUNCTION__)))))
,
4118 old0, new0, old1, new1));
4119
4120 case tcc_binary:
4121 return fold_build2_loc (loc, code, type,
4122 eval_subst (loc, TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4122, __FUNCTION__)))))
,
4123 old0, new0, old1, new1),
4124 eval_subst (loc, TREE_OPERAND (arg, 1)(*((const_cast<tree*> (tree_operand_check ((arg), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4124, __FUNCTION__)))))
,
4125 old0, new0, old1, new1));
4126
4127 case tcc_expression:
4128 switch (code)
4129 {
4130 case SAVE_EXPR:
4131 return eval_subst (loc, TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4131, __FUNCTION__)))))
, old0, new0,
4132 old1, new1);
4133
4134 case COMPOUND_EXPR:
4135 return eval_subst (loc, TREE_OPERAND (arg, 1)(*((const_cast<tree*> (tree_operand_check ((arg), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4135, __FUNCTION__)))))
, old0, new0,
4136 old1, new1);
4137
4138 case COND_EXPR:
4139 return fold_build3_loc (loc, code, type,
4140 eval_subst (loc, TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4140, __FUNCTION__)))))
,
4141 old0, new0, old1, new1),
4142 eval_subst (loc, TREE_OPERAND (arg, 1)(*((const_cast<tree*> (tree_operand_check ((arg), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4142, __FUNCTION__)))))
,
4143 old0, new0, old1, new1),
4144 eval_subst (loc, TREE_OPERAND (arg, 2)(*((const_cast<tree*> (tree_operand_check ((arg), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4144, __FUNCTION__)))))
,
4145 old0, new0, old1, new1));
4146 default:
4147 break;
4148 }
4149 /* Fall through - ??? */
4150
4151 case tcc_comparison:
4152 {
4153 tree arg0 = TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4153, __FUNCTION__)))))
;
4154 tree arg1 = TREE_OPERAND (arg, 1)(*((const_cast<tree*> (tree_operand_check ((arg), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4154, __FUNCTION__)))))
;
4155
4156 /* We need to check both for exact equality and tree equality. The
4157 former will be true if the operand has a side-effect. In that
4158 case, we know the operand occurred exactly once. */
4159
4160 if (arg0 == old0 || operand_equal_p (arg0, old0, 0))
4161 arg0 = new0;
4162 else if (arg0 == old1 || operand_equal_p (arg0, old1, 0))
4163 arg0 = new1;
4164
4165 if (arg1 == old0 || operand_equal_p (arg1, old0, 0))
4166 arg1 = new0;
4167 else if (arg1 == old1 || operand_equal_p (arg1, old1, 0))
4168 arg1 = new1;
4169
4170 return fold_build2_loc (loc, code, type, arg0, arg1);
4171 }
4172
4173 default:
4174 return arg;
4175 }
4176}
4177
4178/* Return a tree for the case when the result of an expression is RESULT
4179 converted to TYPE and OMITTED was previously an operand of the expression
4180 but is now not needed (e.g., we folded OMITTED * 0).
4181
4182 If OMITTED has side effects, we must evaluate it. Otherwise, just do
4183 the conversion of RESULT to TYPE. */
4184
4185tree
4186omit_one_operand_loc (location_t loc, tree type, tree result, tree omitted)
4187{
4188 tree t = fold_convert_loc (loc, type, result);
4189
4190 /* If the resulting operand is an empty statement, just return the omitted
4191 statement casted to void. */
4192 if (IS_EMPTY_STMT (t)(((enum tree_code) (t)->base.code) == NOP_EXPR && (
((enum tree_code) (((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4192, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE
) && integer_zerop ((*((const_cast<tree*> (tree_operand_check
((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4192, __FUNCTION__)))))))
&& TREE_SIDE_EFFECTS (omitted)((non_type_check ((omitted), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4192, __FUNCTION__))->base.side_effects_flag)
)
4193 return build1_loc (loc, NOP_EXPR, void_type_nodeglobal_trees[TI_VOID_TYPE],
4194 fold_ignored_result (omitted));
4195
4196 if (TREE_SIDE_EFFECTS (omitted)((non_type_check ((omitted), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4196, __FUNCTION__))->base.side_effects_flag)
)
4197 return build2_loc (loc, COMPOUND_EXPR, type,
4198 fold_ignored_result (omitted), t);
4199
4200 return non_lvalue_loc (loc, t);
4201}
4202
4203/* Return a tree for the case when the result of an expression is RESULT
4204 converted to TYPE and OMITTED1 and OMITTED2 were previously operands
4205 of the expression but are now not needed.
4206
4207 If OMITTED1 or OMITTED2 has side effects, they must be evaluated.
4208 If both OMITTED1 and OMITTED2 have side effects, OMITTED1 is
4209 evaluated before OMITTED2. Otherwise, if neither has side effects,
4210 just do the conversion of RESULT to TYPE. */
4211
4212tree
4213omit_two_operands_loc (location_t loc, tree type, tree result,
4214 tree omitted1, tree omitted2)
4215{
4216 tree t = fold_convert_loc (loc, type, result);
4217
4218 if (TREE_SIDE_EFFECTS (omitted2)((non_type_check ((omitted2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4218, __FUNCTION__))->base.side_effects_flag)
)
4219 t = build2_loc (loc, COMPOUND_EXPR, type, omitted2, t);
4220 if (TREE_SIDE_EFFECTS (omitted1)((non_type_check ((omitted1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4220, __FUNCTION__))->base.side_effects_flag)
)
4221 t = build2_loc (loc, COMPOUND_EXPR, type, omitted1, t);
4222
4223 return TREE_CODE (t)((enum tree_code) (t)->base.code) != COMPOUND_EXPR ? non_lvalue_loc (loc, t) : t;
4224}
4225
4226
4227/* Return a simplified tree node for the truth-negation of ARG. This
4228 never alters ARG itself. We assume that ARG is an operation that
4229 returns a truth value (0 or 1).
4230
4231 FIXME: one would think we would fold the result, but it causes
4232 problems with the dominator optimizer. */
4233
4234static tree
4235fold_truth_not_expr (location_t loc, tree arg)
4236{
4237 tree type = TREE_TYPE (arg)((contains_struct_check ((arg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4237, __FUNCTION__))->typed.type)
;
4238 enum tree_code code = TREE_CODE (arg)((enum tree_code) (arg)->base.code);
4239 location_t loc1, loc2;
4240
4241 /* If this is a comparison, we can simply invert it, except for
4242 floating-point non-equality comparisons, in which case we just
4243 enclose a TRUTH_NOT_EXPR around what we have. */
4244
4245 if (TREE_CODE_CLASS (code)tree_code_type[(int) (code)] == tcc_comparison)
4246 {
4247 tree op_type = TREE_TYPE (TREE_OPERAND (arg, 0))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check
((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4247, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4247, __FUNCTION__))->typed.type)
;
4248 if (FLOAT_TYPE_P (op_type)((((enum tree_code) (op_type)->base.code) == REAL_TYPE) ||
((((enum tree_code) (op_type)->base.code) == COMPLEX_TYPE
|| (((enum tree_code) (op_type)->base.code) == VECTOR_TYPE
)) && (((enum tree_code) (((contains_struct_check ((op_type
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4248, __FUNCTION__))->typed.type))->base.code) == REAL_TYPE
)))
4249 && flag_trapping_mathglobal_options.x_flag_trapping_math
4250 && code != ORDERED_EXPR && code != UNORDERED_EXPR
4251 && code != NE_EXPR && code != EQ_EXPR)
4252 return NULL_TREE(tree) __null;
4253
4254 code = invert_tree_comparison (code, HONOR_NANS (op_type));
4255 if (code == ERROR_MARK)
4256 return NULL_TREE(tree) __null;
4257
4258 tree ret = build2_loc (loc, code, type, TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4258, __FUNCTION__)))))
,
4259 TREE_OPERAND (arg, 1)(*((const_cast<tree*> (tree_operand_check ((arg), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4259, __FUNCTION__)))))
);
4260 if (TREE_NO_WARNING (arg)((arg)->base.nowarning_flag))
4261 TREE_NO_WARNING (ret)((ret)->base.nowarning_flag) = 1;
4262 return ret;
4263 }
4264
4265 switch (code)
4266 {
4267 case INTEGER_CST:
4268 return constant_boolean_node (integer_zerop (arg), type);
4269
4270 case TRUTH_AND_EXPR:
4271 loc1 = expr_location_or (TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4271, __FUNCTION__)))))
, loc);
4272 loc2 = expr_location_or (TREE_OPERAND (arg, 1)(*((const_cast<tree*> (tree_operand_check ((arg), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4272, __FUNCTION__)))))
, loc);
4273 return build2_loc (loc, TRUTH_OR_EXPR, type,
4274 invert_truthvalue_loc (loc1, TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4274, __FUNCTION__)))))
),
4275 invert_truthvalue_loc (loc2, TREE_OPERAND (arg, 1)(*((const_cast<tree*> (tree_operand_check ((arg), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4275, __FUNCTION__)))))
));
4276
4277 case TRUTH_OR_EXPR:
4278 loc1 = expr_location_or (TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4278, __FUNCTION__)))))
, loc);
4279 loc2 = expr_location_or (TREE_OPERAND (arg, 1)(*((const_cast<tree*> (tree_operand_check ((arg), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4279, __FUNCTION__)))))
, loc);
4280 return build2_loc (loc, TRUTH_AND_EXPR, type,
4281 invert_truthvalue_loc (loc1, TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4281, __FUNCTION__)))))
),
4282 invert_truthvalue_loc (loc2, TREE_OPERAND (arg, 1)(*((const_cast<tree*> (tree_operand_check ((arg), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4282, __FUNCTION__)))))
));
4283
4284 case TRUTH_XOR_EXPR:
4285 /* Here we can invert either operand. We invert the first operand
4286 unless the second operand is a TRUTH_NOT_EXPR in which case our
4287 result is the XOR of the first operand with the inside of the
4288 negation of the second operand. */
4289
4290 if (TREE_CODE (TREE_OPERAND (arg, 1))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check
((arg), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4290, __FUNCTION__))))))->base.code)
== TRUTH_NOT_EXPR)
4291 return build2_loc (loc, TRUTH_XOR_EXPR, type, TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4291, __FUNCTION__)))))
,
4292 TREE_OPERAND (TREE_OPERAND (arg, 1), 0)(*((const_cast<tree*> (tree_operand_check (((*((const_cast
<tree*> (tree_operand_check ((arg), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4292, __FUNCTION__)))))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4292, __FUNCTION__)))))
);
4293 else
4294 return build2_loc (loc, TRUTH_XOR_EXPR, type,
4295 invert_truthvalue_loc (loc, TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4295, __FUNCTION__)))))
),
4296 TREE_OPERAND (arg, 1)(*((const_cast<tree*> (tree_operand_check ((arg), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4296, __FUNCTION__)))))
);
4297
4298 case TRUTH_ANDIF_EXPR:
4299 loc1 = expr_location_or (TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4299, __FUNCTION__)))))
, loc);
4300 loc2 = expr_location_or (TREE_OPERAND (arg, 1)(*((const_cast<tree*> (tree_operand_check ((arg), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4300, __FUNCTION__)))))
, loc);
4301 return build2_loc (loc, TRUTH_ORIF_EXPR, type,
4302 invert_truthvalue_loc (loc1, TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4302, __FUNCTION__)))))
),
4303 invert_truthvalue_loc (loc2, TREE_OPERAND (arg, 1)(*((const_cast<tree*> (tree_operand_check ((arg), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4303, __FUNCTION__)))))
));
4304
4305 case TRUTH_ORIF_EXPR:
4306 loc1 = expr_location_or (TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4306, __FUNCTION__)))))
, loc);
4307 loc2 = expr_location_or (TREE_OPERAND (arg, 1)(*((const_cast<tree*> (tree_operand_check ((arg), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4307, __FUNCTION__)))))
, loc);
4308 return build2_loc (loc, TRUTH_ANDIF_EXPR, type,
4309 invert_truthvalue_loc (loc1, TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4309, __FUNCTION__)))))
),
4310 invert_truthvalue_loc (loc2, TREE_OPERAND (arg, 1)(*((const_cast<tree*> (tree_operand_check ((arg), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4310, __FUNCTION__)))))
));
4311
4312 case TRUTH_NOT_EXPR:
4313 return TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4313, __FUNCTION__)))))
;
4314
4315 case COND_EXPR:
4316 {
4317 tree arg1 = TREE_OPERAND (arg, 1)(*((const_cast<tree*> (tree_operand_check ((arg), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4317, __FUNCTION__)))))
;
4318 tree arg2 = TREE_OPERAND (arg, 2)(*((const_cast<tree*> (tree_operand_check ((arg), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4318, __FUNCTION__)))))
;
4319
4320 loc1 = expr_location_or (TREE_OPERAND (arg, 1)(*((const_cast<tree*> (tree_operand_check ((arg), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4320, __FUNCTION__)))))
, loc);
4321 loc2 = expr_location_or (TREE_OPERAND (arg, 2)(*((const_cast<tree*> (tree_operand_check ((arg), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4321, __FUNCTION__)))))
, loc);
4322
4323 /* A COND_EXPR may have a throw as one operand, which
4324 then has void type. Just leave void operands
4325 as they are. */
4326 return build3_loc (loc, COND_EXPR, type, TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4326, __FUNCTION__)))))
,
4327 VOID_TYPE_P (TREE_TYPE (arg1))(((enum tree_code) (((contains_struct_check ((arg1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4327, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE
)
4328 ? arg1 : invert_truthvalue_loc (loc1, arg1),
4329 VOID_TYPE_P (TREE_TYPE (arg2))(((enum tree_code) (((contains_struct_check ((arg2), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4329, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE
)
4330 ? arg2 : invert_truthvalue_loc (loc2, arg2));
4331 }
4332
4333 case COMPOUND_EXPR:
4334 loc1 = expr_location_or (TREE_OPERAND (arg, 1)(*((const_cast<tree*> (tree_operand_check ((arg), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4334, __FUNCTION__)))))
, loc);
4335 return build2_loc (loc, COMPOUND_EXPR, type,
4336 TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4336, __FUNCTION__)))))
,
4337 invert_truthvalue_loc (loc1, TREE_OPERAND (arg, 1)(*((const_cast<tree*> (tree_operand_check ((arg), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4337, __FUNCTION__)))))
));
4338
4339 case NON_LVALUE_EXPR:
4340 loc1 = expr_location_or (TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4340, __FUNCTION__)))))
, loc);
4341 return invert_truthvalue_loc (loc1, TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4341, __FUNCTION__)))))
);
4342
4343 CASE_CONVERTcase NOP_EXPR: case CONVERT_EXPR:
4344 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/fold-const.c"
, 4344, __FUNCTION__))->typed.type))->base.code)
== BOOLEAN_TYPE)
4345 return build1_loc (loc, TRUTH_NOT_EXPR, type, arg);
4346
4347 /* fall through */
4348
4349 case FLOAT_EXPR:
4350 loc1 = expr_location_or (TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4350, __FUNCTION__)))))
, loc);
4351 return build1_loc (loc, TREE_CODE (arg)((enum tree_code) (arg)->base.code), type,
4352 invert_truthvalue_loc (loc1, TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4352, __FUNCTION__)))))
));
4353
4354 case BIT_AND_EXPR:
4355 if (!integer_onep (TREE_OPERAND (arg, 1)(*((const_cast<tree*> (tree_operand_check ((arg), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4355, __FUNCTION__)))))
))
4356 return NULL_TREE(tree) __null;
4357 return build2_loc (loc, EQ_EXPR, type, arg, build_int_cst (type, 0));
4358
4359 case SAVE_EXPR:
4360 return build1_loc (loc, TRUTH_NOT_EXPR, type, arg);
4361
4362 case CLEANUP_POINT_EXPR:
4363 loc1 = expr_location_or (TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4363, __FUNCTION__)))))
, loc);
4364 return build1_loc (loc, CLEANUP_POINT_EXPR, type,
4365 invert_truthvalue_loc (loc1, TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4365, __FUNCTION__)))))
));
4366
4367 default:
4368 return NULL_TREE(tree) __null;
4369 }
4370}
4371
4372/* Fold the truth-negation of ARG. This never alters ARG itself. We
4373 assume that ARG is an operation that returns a truth value (0 or 1
4374 for scalars, 0 or -1 for vectors). Return the folded expression if
4375 folding is successful. Otherwise, return NULL_TREE. */
4376
4377static tree
4378fold_invert_truthvalue (location_t loc, tree arg)
4379{
4380 tree type = TREE_TYPE (arg)((contains_struct_check ((arg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4380, __FUNCTION__))->typed.type)
;
4381 return fold_unary_loc (loc, VECTOR_TYPE_P (type)(((enum tree_code) (type)->base.code) == VECTOR_TYPE)
4382 ? BIT_NOT_EXPR
4383 : TRUTH_NOT_EXPR,
4384 type, arg);
4385}
4386
4387/* Return a simplified tree node for the truth-negation of ARG. This
4388 never alters ARG itself. We assume that ARG is an operation that
4389 returns a truth value (0 or 1 for scalars, 0 or -1 for vectors). */
4390
4391tree
4392invert_truthvalue_loc (location_t loc, tree arg)
4393{
4394 if (TREE_CODE (arg)((enum tree_code) (arg)->base.code) == ERROR_MARK)
4395 return arg;
4396
4397 tree type = TREE_TYPE (arg)((contains_struct_check ((arg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4397, __FUNCTION__))->typed.type)
;
4398 return fold_build1_loc (loc, VECTOR_TYPE_P (type)(((enum tree_code) (type)->base.code) == VECTOR_TYPE)
4399 ? BIT_NOT_EXPR
4400 : TRUTH_NOT_EXPR,
4401 type, arg);
4402}
4403
4404/* Return a BIT_FIELD_REF of type TYPE to refer to BITSIZE bits of INNER
4405 starting at BITPOS. The field is unsigned if UNSIGNEDP is nonzero
4406 and uses reverse storage order if REVERSEP is nonzero. ORIG_INNER
4407 is the original memory reference used to preserve the alias set of
4408 the access. */
4409
4410static tree
4411make_bit_field_ref (location_t loc, tree inner, tree orig_inner, tree type,
4412 HOST_WIDE_INTlong bitsize, poly_int64 bitpos,
4413 int unsignedp, int reversep)
4414{
4415 tree result, bftype;
4416
4417 /* Attempt not to lose the access path if possible. */
4418 if (TREE_CODE (orig_inner)((enum tree_code) (orig_inner)->base.code) == COMPONENT_REF)
4419 {
4420 tree ninner = TREE_OPERAND (orig_inner, 0)(*((const_cast<tree*> (tree_operand_check ((orig_inner)
, (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4420, __FUNCTION__)))))
;
4421 machine_mode nmode;
4422 poly_int64 nbitsize, nbitpos;
4423 tree noffset;
4424 int nunsignedp, nreversep, nvolatilep = 0;
4425 tree base = get_inner_reference (ninner, &nbitsize, &nbitpos,
4426 &noffset, &nmode, &nunsignedp,
4427 &nreversep, &nvolatilep);
4428 if (base == inner
4429 && noffset == NULL_TREE(tree) __null
4430 && known_subrange_p (bitpos, bitsize, nbitpos, nbitsize)
4431 && !reversep
4432 && !nreversep
4433 && !nvolatilep)
4434 {
4435 inner = ninner;
4436 bitpos -= nbitpos;
4437 }
4438 }
4439
4440 alias_set_type iset = get_alias_set (orig_inner);
4441 if (iset == 0 && get_alias_set (inner) != iset)
4442 inner = fold_build2 (MEM_REF, TREE_TYPE (inner),fold_build2_loc (((location_t) 0), MEM_REF, ((contains_struct_check
((inner), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4442, __FUNCTION__))->typed.type), build_fold_addr_expr_loc
(((location_t) 0), (inner)), build_int_cst (global_trees[TI_PTR_TYPE
], 0) )
4443 build_fold_addr_expr (inner),fold_build2_loc (((location_t) 0), MEM_REF, ((contains_struct_check
((inner), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4442, __FUNCTION__))->typed.type), build_fold_addr_expr_loc
(((location_t) 0), (inner)), build_int_cst (global_trees[TI_PTR_TYPE
], 0) )
4444 build_int_cst (ptr_type_node, 0))fold_build2_loc (((location_t) 0), MEM_REF, ((contains_struct_check
((inner), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4442, __FUNCTION__))->typed.type), build_fold_addr_expr_loc
(((location_t) 0), (inner)), build_int_cst (global_trees[TI_PTR_TYPE
], 0) )
;
4445
4446 if (known_eq (bitpos, 0)(!maybe_ne (bitpos, 0)) && !reversep)
4447 {
4448 tree size = TYPE_SIZE (TREE_TYPE (inner))((tree_class_check ((((contains_struct_check ((inner), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4448, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4448, __FUNCTION__))->type_common.size)
;
4449 if ((INTEGRAL_TYPE_P (TREE_TYPE (inner))(((enum tree_code) (((contains_struct_check ((inner), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4449, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE
|| ((enum tree_code) (((contains_struct_check ((inner), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4449, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (((contains_struct_check ((inner), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4449, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE
)
4450 || POINTER_TYPE_P (TREE_TYPE (inner))(((enum tree_code) (((contains_struct_check ((inner), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4450, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE
|| ((enum tree_code) (((contains_struct_check ((inner), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4450, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
)
)
4451 && tree_fits_shwi_p (size)
4452 && tree_to_shwi (size) == bitsize)
4453 return fold_convert_loc (loc, type, inner);
4454 }
4455
4456 bftype = type;
4457 if (TYPE_PRECISION (bftype)((tree_class_check ((bftype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4457, __FUNCTION__))->type_common.precision)
!= bitsize
4458 || TYPE_UNSIGNED (bftype)((tree_class_check ((bftype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4458, __FUNCTION__))->base.u.bits.unsigned_flag)
== !unsignedp)
4459 bftype = build_nonstandard_integer_type (bitsize, 0);
4460
4461 result = build3_loc (loc, BIT_FIELD_REF, bftype, inner,
4462 bitsize_int (bitsize)size_int_kind (bitsize, stk_bitsizetype), bitsize_int (bitpos)size_int_kind (bitpos, stk_bitsizetype));
4463 REF_REVERSE_STORAGE_ORDER (result)((tree_check2 ((result), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4463, __FUNCTION__, (BIT_FIELD_REF), (MEM_REF)))->base.default_def_flag
)
= reversep;
4464
4465 if (bftype != type)
4466 result = fold_convert_loc (loc, type, result);
4467
4468 return result;
4469}
4470
4471/* Optimize a bit-field compare.
4472
4473 There are two cases: First is a compare against a constant and the
4474 second is a comparison of two items where the fields are at the same
4475 bit position relative to the start of a chunk (byte, halfword, word)
4476 large enough to contain it. In these cases we can avoid the shift
4477 implicit in bitfield extractions.
4478
4479 For constants, we emit a compare of the shifted constant with the
4480 BIT_AND_EXPR of a mask and a byte, halfword, or word of the operand being
4481 compared. For two fields at the same position, we do the ANDs with the
4482 similar mask and compare the result of the ANDs.
4483
4484 CODE is the comparison code, known to be either NE_EXPR or EQ_EXPR.
4485 COMPARE_TYPE is the type of the comparison, and LHS and RHS
4486 are the left and right operands of the comparison, respectively.
4487
4488 If the optimization described above can be done, we return the resulting
4489 tree. Otherwise we return zero. */
4490
4491static tree
4492optimize_bit_field_compare (location_t loc, enum tree_code code,
4493 tree compare_type, tree lhs, tree rhs)
4494{
4495 poly_int64 plbitpos, plbitsize, rbitpos, rbitsize;
4496 HOST_WIDE_INTlong lbitpos, lbitsize, nbitpos, nbitsize;
4497 tree type = TREE_TYPE (lhs)((contains_struct_check ((lhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4497, __FUNCTION__))->typed.type)
;
4498 tree unsigned_type;
4499 int const_p = TREE_CODE (rhs)((enum tree_code) (rhs)->base.code) == INTEGER_CST;
4500 machine_mode lmode, rmode;
4501 scalar_int_mode nmode;
4502 int lunsignedp, runsignedp;
4503 int lreversep, rreversep;
4504 int lvolatilep = 0, rvolatilep = 0;
4505 tree linner, rinner = NULL_TREE(tree) __null;
4506 tree mask;
4507 tree offset;
4508
4509 /* Get all the information about the extractions being done. If the bit size
4510 is the same as the size of the underlying object, we aren't doing an
4511 extraction at all and so can do nothing. We also don't want to
4512 do anything if the inner expression is a PLACEHOLDER_EXPR since we
4513 then will no longer be able to replace it. */
4514 linner = get_inner_reference (lhs, &plbitsize, &plbitpos, &offset, &lmode,
4515 &lunsignedp, &lreversep, &lvolatilep);
4516 if (linner == lhs
4517 || !known_size_p (plbitsize)
4518 || !plbitsize.is_constant (&lbitsize)
4519 || !plbitpos.is_constant (&lbitpos)
4520 || known_eq (lbitsize, GET_MODE_BITSIZE (lmode))(!maybe_ne (lbitsize, GET_MODE_BITSIZE (lmode)))
4521 || offset != 0
4522 || TREE_CODE (linner)((enum tree_code) (linner)->base.code) == PLACEHOLDER_EXPR
4523 || lvolatilep)
4524 return 0;
4525
4526 if (const_p)
4527 rreversep = lreversep;
4528 else
4529 {
4530 /* If this is not a constant, we can only do something if bit positions,
4531 sizes, signedness and storage order are the same. */
4532 rinner
4533 = get_inner_reference (rhs, &rbitsize, &rbitpos, &offset, &rmode,
4534 &runsignedp, &rreversep, &rvolatilep);
4535
4536 if (rinner == rhs
4537 || maybe_ne (lbitpos, rbitpos)
4538 || maybe_ne (lbitsize, rbitsize)
4539 || lunsignedp != runsignedp
4540 || lreversep != rreversep
4541 || offset != 0
4542 || TREE_CODE (rinner)((enum tree_code) (rinner)->base.code) == PLACEHOLDER_EXPR
4543 || rvolatilep)
4544 return 0;
4545 }
4546
4547 /* Honor the C++ memory model and mimic what RTL expansion does. */
4548 poly_uint64 bitstart = 0;
4549 poly_uint64 bitend = 0;
4550 if (TREE_CODE (lhs)((enum tree_code) (lhs)->base.code) == COMPONENT_REF)
4551 {
4552 get_bit_range (&bitstart, &bitend, lhs, &plbitpos, &offset);
4553 if (!plbitpos.is_constant (&lbitpos) || offset != NULL_TREE(tree) __null)
4554 return 0;
4555 }
4556
4557 /* See if we can find a mode to refer to this field. We should be able to,
4558 but fail if we can't. */
4559 if (!get_best_mode (lbitsize, lbitpos, bitstart, bitend,
4560 const_p ? TYPE_ALIGN (TREE_TYPE (linner))((tree_class_check ((((contains_struct_check ((linner), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4560, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4560, __FUNCTION__))->type_common.align ? ((unsigned)1) <<
((((contains_struct_check ((linner), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4560, __FUNCTION__))->typed.type))->type_common.align
- 1) : 0)
4561 : MIN (TYPE_ALIGN (TREE_TYPE (linner)),((((tree_class_check ((((contains_struct_check ((linner), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4561, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4561, __FUNCTION__))->type_common.align ? ((unsigned)1) <<
((((contains_struct_check ((linner), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4561, __FUNCTION__))->typed.type))->type_common.align
- 1) : 0)) < (((tree_class_check ((((contains_struct_check
((rinner), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4562, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4562, __FUNCTION__))->type_common.align ? ((unsigned)1) <<
((((contains_struct_check ((rinner), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4562, __FUNCTION__))->typed.type))->type_common.align
- 1) : 0)) ? (((tree_class_check ((((contains_struct_check (
(linner), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4561, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4561, __FUNCTION__))->type_common.align ? ((unsigned)1) <<
((((contains_struct_check ((linner), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4561, __FUNCTION__))->typed.type))->type_common.align
- 1) : 0)) : (((tree_class_check ((((contains_struct_check (
(rinner), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4562, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4562, __FUNCTION__))->type_common.align ? ((unsigned)1) <<
((((contains_struct_check ((rinner), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4562, __FUNCTION__))->typed.type))->type_common.align
- 1) : 0)))
4562 TYPE_ALIGN (TREE_TYPE (rinner)))((((tree_class_check ((((contains_struct_check ((linner), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4561, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4561, __FUNCTION__))->type_common.align ? ((unsigned)1) <<
((((contains_struct_check ((linner), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4561, __FUNCTION__))->typed.type))->type_common.align
- 1) : 0)) < (((tree_class_check ((((contains_struct_check
((rinner), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4562, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4562, __FUNCTION__))->type_common.align ? ((unsigned)1) <<
((((contains_struct_check ((rinner), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4562, __FUNCTION__))->typed.type))->type_common.align
- 1) : 0)) ? (((tree_class_check ((((contains_struct_check (
(linner), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4561, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4561, __FUNCTION__))->type_common.align ? ((unsigned)1) <<
((((contains_struct_check ((linner), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4561, __FUNCTION__))->typed.type))->type_common.align
- 1) : 0)) : (((tree_class_check ((((contains_struct_check (
(rinner), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4562, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4562, __FUNCTION__))->type_common.align ? ((unsigned)1) <<
((((contains_struct_check ((rinner), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4562, __FUNCTION__))->typed.type))->type_common.align
- 1) : 0)))
,
4563 BITS_PER_WORD((8) * (((global_options.x_ix86_isa_flags & (1UL <<
1)) != 0) ? 8 : 4))
, false, &nmode))
4564 return 0;
4565
4566 /* Set signed and unsigned types of the precision of this mode for the
4567 shifts below. */
4568 unsigned_type = lang_hooks.types.type_for_mode (nmode, 1);
4569
4570 /* Compute the bit position and size for the new reference and our offset
4571 within it. If the new reference is the same size as the original, we
4572 won't optimize anything, so return zero. */
4573 nbitsize = GET_MODE_BITSIZE (nmode);
4574 nbitpos = lbitpos & ~ (nbitsize - 1);
4575 lbitpos -= nbitpos;
4576 if (nbitsize == lbitsize)
4577 return 0;
4578
4579 if (lreversep ? !BYTES_BIG_ENDIAN0 : BYTES_BIG_ENDIAN0)
4580 lbitpos = nbitsize - lbitsize - lbitpos;
4581
4582 /* Make the mask to be used against the extracted field. */
4583 mask = build_int_cst_type (unsigned_type, -1);
4584 mask = const_binop (LSHIFT_EXPR, mask, size_int (nbitsize - lbitsize)size_int_kind (nbitsize - lbitsize, stk_sizetype));
4585 mask = const_binop (RSHIFT_EXPR, mask,
4586 size_int (nbitsize - lbitsize - lbitpos)size_int_kind (nbitsize - lbitsize - lbitpos, stk_sizetype));
4587
4588 if (! const_p)
4589 {
4590 if (nbitpos < 0)
4591 return 0;
4592
4593 /* If not comparing with constant, just rework the comparison
4594 and return. */
4595 tree t1 = make_bit_field_ref (loc, linner, lhs, unsigned_type,
4596 nbitsize, nbitpos, 1, lreversep);
4597 t1 = fold_build2_loc (loc, BIT_AND_EXPR, unsigned_type, t1, mask);
4598 tree t2 = make_bit_field_ref (loc, rinner, rhs, unsigned_type,
4599 nbitsize, nbitpos, 1, rreversep);
4600 t2 = fold_build2_loc (loc, BIT_AND_EXPR, unsigned_type, t2, mask);
4601 return fold_build2_loc (loc, code, compare_type, t1, t2);
4602 }
4603
4604 /* Otherwise, we are handling the constant case. See if the constant is too
4605 big for the field. Warn and return a tree for 0 (false) if so. We do
4606 this not only for its own sake, but to avoid having to test for this
4607 error case below. If we didn't, we might generate wrong code.
4608
4609 For unsigned fields, the constant shifted right by the field length should
4610 be all zero. For signed fields, the high-order bits should agree with
4611 the sign bit. */
4612
4613 if (lunsignedp)
4614 {
4615 if (wi::lrshift (wi::to_wide (rhs), lbitsize) != 0)
4616 {
4617 warning (0, "comparison is always %d due to width of bit-field",
4618 code == NE_EXPR);
4619 return constant_boolean_node (code == NE_EXPR, compare_type);
4620 }
4621 }
4622 else
4623 {
4624 wide_int tem = wi::arshift (wi::to_wide (rhs), lbitsize - 1);
4625 if (tem != 0 && tem != -1)
4626 {
4627 warning (0, "comparison is always %d due to width of bit-field",
4628 code == NE_EXPR);
4629 return constant_boolean_node (code == NE_EXPR, compare_type);
4630 }
4631 }
4632
4633 if (nbitpos < 0)
4634 return 0;
4635
4636 /* Single-bit compares should always be against zero. */
4637 if (lbitsize == 1 && ! integer_zerop (rhs))
4638 {
4639 code = code == EQ_EXPR ? NE_EXPR : EQ_EXPR;
4640 rhs = build_int_cst (type, 0);
4641 }
4642
4643 /* Make a new bitfield reference, shift the constant over the
4644 appropriate number of bits and mask it with the computed mask
4645 (in case this was a signed field). If we changed it, make a new one. */
4646 lhs = make_bit_field_ref (loc, linner, lhs, unsigned_type,
4647 nbitsize, nbitpos, 1, lreversep);
4648
4649 rhs = const_binop (BIT_AND_EXPR,
4650 const_binop (LSHIFT_EXPR,
4651 fold_convert_loc (loc, unsigned_type, rhs),
4652 size_int (lbitpos)size_int_kind (lbitpos, stk_sizetype)),
4653 mask);
4654
4655 lhs = build2_loc (loc, code, compare_type,
4656 build2 (BIT_AND_EXPR, unsigned_type, lhs, mask), rhs);
4657 return lhs;
4658}
4659
4660/* Subroutine for fold_truth_andor_1: decode a field reference.
4661
4662 If EXP is a comparison reference, we return the innermost reference.
4663
4664 *PBITSIZE is set to the number of bits in the reference, *PBITPOS is
4665 set to the starting bit number.
4666
4667 If the innermost field can be completely contained in a mode-sized
4668 unit, *PMODE is set to that mode. Otherwise, it is set to VOIDmode.
4669
4670 *PVOLATILEP is set to 1 if the any expression encountered is volatile;
4671 otherwise it is not changed.
4672
4673 *PUNSIGNEDP is set to the signedness of the field.
4674
4675 *PREVERSEP is set to the storage order of the field.
4676
4677 *PMASK is set to the mask used. This is either contained in a
4678 BIT_AND_EXPR or derived from the width of the field.
4679
4680 *PAND_MASK is set to the mask found in a BIT_AND_EXPR, if any.
4681
4682 Return 0 if this is not a component reference or is one that we can't
4683 do anything with. */
4684
4685static tree
4686decode_field_reference (location_t loc, tree *exp_, HOST_WIDE_INTlong *pbitsize,
4687 HOST_WIDE_INTlong *pbitpos, machine_mode *pmode,
4688 int *punsignedp, int *preversep, int *pvolatilep,
4689 tree *pmask, tree *pand_mask)
4690{
4691 tree exp = *exp_;
4692 tree outer_type = 0;
4693 tree and_mask = 0;
4694 tree mask, inner, offset;
4695 tree unsigned_type;
4696 unsigned int precision;
4697
4698 /* All the optimizations using this function assume integer fields.
4699 There are problems with FP fields since the type_for_size call
4700 below can fail for, e.g., XFmode. */
4701 if (! INTEGRAL_TYPE_P (TREE_TYPE (exp))(((enum tree_code) (((contains_struct_check ((exp), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4701, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE
|| ((enum tree_code) (((contains_struct_check ((exp), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4701, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (((contains_struct_check ((exp), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4701, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE
)
)
4702 return NULL_TREE(tree) __null;
4703
4704 /* We are interested in the bare arrangement of bits, so strip everything
4705 that doesn't affect the machine mode. However, record the type of the
4706 outermost expression if it may matter below. */
4707 if (CONVERT_EXPR_P (exp)((((enum tree_code) (exp)->base.code)) == NOP_EXPR || (((enum
tree_code) (exp)->base.code)) == CONVERT_EXPR)
4708 || TREE_CODE (exp)((enum tree_code) (exp)->base.code) == NON_LVALUE_EXPR)
4709 outer_type = TREE_TYPE (exp)((contains_struct_check ((exp), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4709, __FUNCTION__))->typed.type)
;
4710 STRIP_NOPS (exp)(exp) = tree_strip_nop_conversions ((const_cast<union tree_node
*> (((exp)))))
;
4711
4712 if (TREE_CODE (exp)((enum tree_code) (exp)->base.code) == BIT_AND_EXPR)
4713 {
4714 and_mask = TREE_OPERAND (exp, 1)(*((const_cast<tree*> (tree_operand_check ((exp), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4714, __FUNCTION__)))))
;
4715 exp = TREE_OPERAND (exp, 0)(*((const_cast<tree*> (tree_operand_check ((exp), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4715, __FUNCTION__)))))
;
4716 STRIP_NOPS (exp)(exp) = tree_strip_nop_conversions ((const_cast<union tree_node
*> (((exp)))))
; STRIP_NOPS (and_mask)(and_mask) = tree_strip_nop_conversions ((const_cast<union
tree_node *> (((and_mask)))))
;
4717 if (TREE_CODE (and_mask)((enum tree_code) (and_mask)->base.code) != INTEGER_CST)
4718 return NULL_TREE(tree) __null;
4719 }
4720
4721 poly_int64 poly_bitsize, poly_bitpos;
4722 inner = get_inner_reference (exp, &poly_bitsize, &poly_bitpos, &offset,
4723 pmode, punsignedp, preversep, pvolatilep);
4724 if ((inner == exp && and_mask == 0)
4725 || !poly_bitsize.is_constant (pbitsize)
4726 || !poly_bitpos.is_constant (pbitpos)
4727 || *pbitsize < 0
4728 || offset != 0
4729 || TREE_CODE (inner)((enum tree_code) (inner)->base.code) == PLACEHOLDER_EXPR
4730 /* Reject out-of-bound accesses (PR79731). */
4731 || (! AGGREGATE_TYPE_P (TREE_TYPE (inner))(((enum tree_code) (((contains_struct_check ((inner), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4731, __FUNCTION__))->typed.type))->base.code) == ARRAY_TYPE
|| (((enum tree_code) (((contains_struct_check ((inner), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4731, __FUNCTION__))->typed.type))->base.code) == RECORD_TYPE
|| ((enum tree_code) (((contains_struct_check ((inner), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4731, __FUNCTION__))->typed.type))->base.code) == UNION_TYPE
|| ((enum tree_code) (((contains_struct_check ((inner), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4731, __FUNCTION__))->typed.type))->base.code) == QUAL_UNION_TYPE
))
4732 && compare_tree_int (TYPE_SIZE (TREE_TYPE (inner))((tree_class_check ((((contains_struct_check ((inner), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4732, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4732, __FUNCTION__))->type_common.size)
,
4733 *pbitpos + *pbitsize) < 0))
4734 return NULL_TREE(tree) __null;
4735
4736 unsigned_type = lang_hooks.types.type_for_size (*pbitsize, 1);
4737 if (unsigned_type == NULL_TREE(tree) __null)
4738 return NULL_TREE(tree) __null;
4739
4740 *exp_ = exp;
4741
4742 /* If the number of bits in the reference is the same as the bitsize of
4743 the outer type, then the outer type gives the signedness. Otherwise
4744 (in case of a small bitfield) the signedness is unchanged. */
4745 if (outer_type && *pbitsize == TYPE_PRECISION (outer_type)((tree_class_check ((outer_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4745, __FUNCTION__))->type_common.precision)
)
4746 *punsignedp = TYPE_UNSIGNED (outer_type)((tree_class_check ((outer_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4746, __FUNCTION__))->base.u.bits.unsigned_flag)
;
4747
4748 /* Compute the mask to access the bitfield. */
4749 precision = TYPE_PRECISION (unsigned_type)((tree_class_check ((unsigned_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4749, __FUNCTION__))->type_common.precision)
;
4750
4751 mask = build_int_cst_type (unsigned_type, -1);
4752
4753 mask = const_binop (LSHIFT_EXPR, mask, size_int (precision - *pbitsize)size_int_kind (precision - *pbitsize, stk_sizetype));
4754 mask = const_binop (RSHIFT_EXPR, mask, size_int (precision - *pbitsize)size_int_kind (precision - *pbitsize, stk_sizetype));
4755
4756 /* Merge it with the mask we found in the BIT_AND_EXPR, if any. */
4757 if (and_mask != 0)
4758 mask = fold_build2_loc (loc, BIT_AND_EXPR, unsigned_type,
4759 fold_convert_loc (loc, unsigned_type, and_mask), mask);
4760
4761 *pmask = mask;
4762 *pand_mask = and_mask;
4763 return inner;
4764}
4765
4766/* Return nonzero if MASK represents a mask of SIZE ones in the low-order
4767 bit positions and MASK is SIGNED. */
4768
4769static bool
4770all_ones_mask_p (const_tree mask, unsigned int size)
4771{
4772 tree type = TREE_TYPE (mask)((contains_struct_check ((mask), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4772, __FUNCTION__))->typed.type)
;
4773 unsigned int precision = TYPE_PRECISION (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4773, __FUNCTION__))->type_common.precision)
;
4774
4775 /* If this function returns true when the type of the mask is
4776 UNSIGNED, then there will be errors. In particular see
4777 gcc.c-torture/execute/990326-1.c. There does not appear to be
4778 any documentation paper trail as to why this is so. But the pre
4779 wide-int worked with that restriction and it has been preserved
4780 here. */
4781 if (size > precision || TYPE_SIGN (type)((signop) ((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4781, __FUNCTION__))->base.u.bits.unsigned_flag))
== UNSIGNED)
4782 return false;
4783
4784 return wi::mask (size, false, precision) == wi::to_wide (mask);
4785}
4786
4787/* Subroutine for fold: determine if VAL is the INTEGER_CONST that
4788 represents the sign bit of EXP's type. If EXP represents a sign
4789 or zero extension, also test VAL against the unextended type.
4790 The return value is the (sub)expression whose sign bit is VAL,
4791 or NULL_TREE otherwise. */
4792
4793tree
4794sign_bit_p (tree exp, const_tree val)
4795{
4796 int width;
4797 tree t;
4798
4799 /* Tree EXP must have an integral type. */
4800 t = TREE_TYPE (exp)((contains_struct_check ((exp), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4800, __FUNCTION__))->typed.type)
;
4801 if (! INTEGRAL_TYPE_P (t)(((enum tree_code) (t)->base.code) == ENUMERAL_TYPE || ((enum
tree_code) (t)->base.code) == BOOLEAN_TYPE || ((enum tree_code
) (t)->base.code) == INTEGER_TYPE)
)
4802 return NULL_TREE(tree) __null;
4803
4804 /* Tree VAL must be an integer constant. */
4805 if (TREE_CODE (val)((enum tree_code) (val)->base.code) != INTEGER_CST
4806 || TREE_OVERFLOW (val)((tree_class_check ((val), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4806, __FUNCTION__))->base.public_flag)
)
4807 return NULL_TREE(tree) __null;
4808
4809 width = TYPE_PRECISION (t)((tree_class_check ((t), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4809, __FUNCTION__))->type_common.precision)
;
4810 if (wi::only_sign_bit_p (wi::to_wide (val), width))
4811 return exp;
4812
4813 /* Handle extension from a narrower type. */
4814 if (TREE_CODE (exp)((enum tree_code) (exp)->base.code) == NOP_EXPR
4815 && TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (exp, 0)))((tree_class_check ((((contains_struct_check (((*((const_cast
<tree*> (tree_operand_check ((exp), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4815, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4815, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4815, __FUNCTION__))->type_common.precision)
< width)
4816 return sign_bit_p (TREE_OPERAND (exp, 0)(*((const_cast<tree*> (tree_operand_check ((exp), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4816, __FUNCTION__)))))
, val);
4817
4818 return NULL_TREE(tree) __null;
4819}
4820
4821/* Subroutine for fold_truth_andor_1: determine if an operand is simple enough
4822 to be evaluated unconditionally. */
4823
4824static bool
4825simple_operand_p (const_tree exp)
4826{
4827 /* Strip any conversions that don't change the machine mode. */
4828 STRIP_NOPS (exp)(exp) = tree_strip_nop_conversions ((const_cast<union tree_node
*> (((exp)))))
;
4829
4830 return (CONSTANT_CLASS_P (exp)(tree_code_type[(int) (((enum tree_code) (exp)->base.code)
)] == tcc_constant)
4831 || TREE_CODE (exp)((enum tree_code) (exp)->base.code) == SSA_NAME
4832 || (DECL_P (exp)(tree_code_type[(int) (((enum tree_code) (exp)->base.code)
)] == tcc_declaration)
4833 && ! TREE_ADDRESSABLE (exp)((exp)->base.addressable_flag)
4834 && ! TREE_THIS_VOLATILE (exp)((exp)->base.volatile_flag)
4835 && ! DECL_NONLOCAL (exp)((contains_struct_check ((exp), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4835, __FUNCTION__))->decl_common.nonlocal_flag)
4836 /* Don't regard global variables as simple. They may be
4837 allocated in ways unknown to the compiler (shared memory,
4838 #pragma weak, etc). */
4839 && ! TREE_PUBLIC (exp)((exp)->base.public_flag)
4840 && ! DECL_EXTERNAL (exp)((contains_struct_check ((exp), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4840, __FUNCTION__))->decl_common.decl_flag_1)
4841 /* Weakrefs are not safe to be read, since they can be NULL.
4842 They are !TREE_PUBLIC && !DECL_EXTERNAL but still
4843 have DECL_WEAK flag set. */
4844 && (! VAR_OR_FUNCTION_DECL_P (exp)(((enum tree_code) (exp)->base.code) == VAR_DECL || ((enum
tree_code) (exp)->base.code) == FUNCTION_DECL)
|| ! DECL_WEAK (exp)((contains_struct_check ((exp), (TS_DECL_WITH_VIS), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4844, __FUNCTION__))->decl_with_vis.weak_flag)
)
4845 /* Loading a static variable is unduly expensive, but global
4846 registers aren't expensive. */
4847 && (! TREE_STATIC (exp)((exp)->base.static_flag) || DECL_REGISTER (exp)((contains_struct_check ((exp), (TS_DECL_WRTL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4847, __FUNCTION__))->decl_common.decl_flag_0)
)));
4848}
4849
4850/* Subroutine for fold_truth_andor: determine if an operand is simple enough
4851 to be evaluated unconditionally.
4852 I addition to simple_operand_p, we assume that comparisons, conversions,
4853 and logic-not operations are simple, if their operands are simple, too. */
4854
4855static bool
4856simple_operand_p_2 (tree exp)
4857{
4858 enum tree_code code;
4859
4860 if (TREE_SIDE_EFFECTS (exp)((non_type_check ((exp), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4860, __FUNCTION__))->base.side_effects_flag)
|| generic_expr_could_trap_p (exp))
4861 return false;
4862
4863 while (CONVERT_EXPR_P (exp)((((enum tree_code) (exp)->base.code)) == NOP_EXPR || (((enum
tree_code) (exp)->base.code)) == CONVERT_EXPR)
)
4864 exp = TREE_OPERAND (exp, 0)(*((const_cast<tree*> (tree_operand_check ((exp), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4864, __FUNCTION__)))))
;
4865
4866 code = TREE_CODE (exp)((enum tree_code) (exp)->base.code);
4867
4868 if (TREE_CODE_CLASS (code)tree_code_type[(int) (code)] == tcc_comparison)
4869 return (simple_operand_p (TREE_OPERAND (exp, 0)(*((const_cast<tree*> (tree_operand_check ((exp), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4869, __FUNCTION__)))))
)
4870 && simple_operand_p (TREE_OPERAND (exp, 1)(*((const_cast<tree*> (tree_operand_check ((exp), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4870, __FUNCTION__)))))
));
4871
4872 if (code == TRUTH_NOT_EXPR)
4873 return simple_operand_p_2 (TREE_OPERAND (exp, 0)(*((const_cast<tree*> (tree_operand_check ((exp), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/fold-const.c"
, 4873, __FUNCTION__)))))
);
4874
4875 return simple_operand_p (exp);
4876}
4877
4878
4879/* The following functions are subroutines to fold_range_test and allow it to
4880 try to change a logical combination of comparisons into a range test.
4881
4882 For example, both
4883 X == 2 || X == 3 || X == 4 || X == 5
4884 and
4885 X >= 2 && X <= 5
4886 are converted to
4887 (unsigned) (X - 2) <= 3
4888
4889 We describe each set of comparisons as being either inside or outside
4890 a range, using a variable named like IN_P, and then describe the
4891 range with a lower and upper bound. If one of the bounds is omitted,
4892 it represents either the highest or lowest value of the type.
4893
4894 In the comments below, we represent a range by two numbers in brackets
4895 preceded by a "+" to designate being inside that range, or a "-" to
4896 designate being outside that range, so the condition can be inverted by
4897 flipping the prefix. An omitted bound is represented by a "-". For
4898 example, "- [-, 10]" means being outside the range starting at the lowest
4899 possible value and ending at 10, in other words, being greater than 10.
4900 The range "+ [-, -]" is always true and hence the range "- [-, -]" is
4901 always false.
4902
4903 We set up things so that the missing bounds are handled in a consistent
4904 manner so neither a missing bound nor "true" and "false" need to be
4905 handled using a special case. */
4906
4907/* Return the result of applying CODE to ARG0 and ARG1, but handle the case
4908 of ARG0 and/or ARG1 being omitted, meaning an unlimited range. UPPER0_P
4909 and UPPER1_P are nonzero if the respective argument is an upper bound
4910 and zero for a lower. TYPE, if nonzero, is the type of the result; it