Bug Summary

File:build/gcc/fold-const.c
Warning:line 7775, column 3
Value stored to 'words' is never read

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