Bug Summary

File:build/gcc/cp/constexpr.c
Warning:line 5523, column 8
Called C++ object pointer is null

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 constexpr.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_FRONTEND -D IN_GCC -D HAVE_CONFIG_H -I . -I cp -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/cp -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-v3yQO1.plist -x c++ /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c

/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c

1/* Perform -*- C++ -*- constant expression evaluation, including calls to
2 constexpr functions. These routines are used both during actual parsing
3 and during the instantiation of template functions.
4
5 Copyright (C) 1998-2021 Free Software Foundation, Inc.
6
7 This file is part of GCC.
8
9 GCC is free software; you can redistribute it and/or modify it
10 under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3, or (at your option)
12 any later version.
13
14 GCC is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 General Public License for more details.
18
19You should have received a copy of the GNU General Public License
20along with GCC; see the file COPYING3. If not see
21<http://www.gnu.org/licenses/>. */
22
23#include "config.h"
24#include "system.h"
25#include "coretypes.h"
26#include "cp-tree.h"
27#include "varasm.h"
28#include "c-family/c-objc.h"
29#include "tree-iterator.h"
30#include "gimplify.h"
31#include "builtins.h"
32#include "tree-inline.h"
33#include "ubsan.h"
34#include "gimple-fold.h"
35#include "timevar.h"
36#include "fold-const-call.h"
37#include "stor-layout.h"
38#include "cgraph.h"
39#include "opts.h"
40#include "stringpool.h"
41#include "attribs.h"
42
43static bool verify_constant (tree, bool, bool *, bool *);
44#define VERIFY_CONSTANT(X)do { if (verify_constant ((X), ctx->quiet, non_constant_p,
overflow_p)) return t; } while (0)
\
45do { \
46 if (verify_constant ((X), ctx->quiet, non_constant_p, overflow_p)) \
47 return t; \
48 } while (0)
49
50static HOST_WIDE_INTlong find_array_ctor_elt (tree ary, tree dindex,
51 bool insert = false);
52static int array_index_cmp (tree key, tree index);
53
54/* Returns true iff FUN is an instantiation of a constexpr function
55 template or a defaulted constexpr function. */
56
57bool
58is_instantiation_of_constexpr (tree fun)
59{
60 return ((DECL_TEMPLOID_INSTANTIATION (fun)(((((contains_struct_check ((fun), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 60, __FUNCTION__))->decl_common.lang_specific)->u.base
.use_template) & 1) || (((contains_struct_check ((fun), (
TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 60, __FUNCTION__))->decl_common.lang_specific) &&
(((contains_struct_check ((template_info_decl_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 60, __FUNCTION__)), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 60, __FUNCTION__))->decl_common.lang_specific) ->u.min
.template_info) && !(((contains_struct_check ((fun), (
TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 60, __FUNCTION__))->decl_common.lang_specific)->u.base
.use_template)))
61 && DECL_DECLARED_CONSTEXPR_P (DECL_TI_TEMPLATE (fun))((contains_struct_check (((tree_check2 (((((enum tree_code) (
((struct tree_template_info*)(tree_check (((((contains_struct_check
((template_info_decl_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 61, __FUNCTION__)), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 61, __FUNCTION__))->decl_common.lang_specific) ->u.min
.template_info)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 61, __FUNCTION__, (TEMPLATE_INFO))))->tmpl)->base.code
) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast
<union tree_node *> ((((tree_check ((((struct tree_template_info
*)(tree_check (((((contains_struct_check ((template_info_decl_check
((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 61, __FUNCTION__)), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 61, __FUNCTION__))->decl_common.lang_specific) ->u.min
.template_info)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 61, __FUNCTION__, (TEMPLATE_INFO))))->tmpl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 61, __FUNCTION__, (TEMPLATE_DECL))))))))->result : ((struct
tree_template_info*)(tree_check (((((contains_struct_check (
(template_info_decl_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 61, __FUNCTION__)), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 61, __FUNCTION__))->decl_common.lang_specific) ->u.min
.template_info)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 61, __FUNCTION__, (TEMPLATE_INFO))))->tmpl)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 61, __FUNCTION__, (VAR_DECL), (FUNCTION_DECL)))), (TS_DECL_COMMON
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 61, __FUNCTION__))->decl_common.lang_flag_8)
)
62 || (DECL_DEFAULTED_FN (fun)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (fun)->base.code) == TEMPLATE_DECL ?
((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 62, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fun))
, (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 62, __FUNCTION__))->decl_common.lang_specific); if (!(((
enum tree_code) (fun)->base.code) == FUNCTION_DECL || (((enum
tree_code) (fun)->base.code) == TEMPLATE_DECL && (
(struct tree_template_decl *)(const_cast<union tree_node *
> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 62, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) nullptr && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fun)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 62, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base
.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 62, __FUNCTION__); &lt->u.fn; })->defaulted_p)
63 && DECL_DECLARED_CONSTEXPR_P (fun)((contains_struct_check (((tree_check2 (((((enum tree_code) (
fun)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fun)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 63, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fun))
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 63, __FUNCTION__, (VAR_DECL), (FUNCTION_DECL)))), (TS_DECL_COMMON
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 63, __FUNCTION__))->decl_common.lang_flag_8)
));
64}
65
66/* Return true if T is a literal type. */
67
68bool
69literal_type_p (tree t)
70{
71 if (SCALAR_TYPE_P (t)((((enum tree_code) (t)->base.code) == OFFSET_TYPE) || ((enum
tree_code) (t)->base.code) == ENUMERAL_TYPE || ((((enum tree_code
) (t)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (t)
->base.code) == INTEGER_TYPE) || ((enum tree_code) (t)->
base.code) == REAL_TYPE || ((enum tree_code) (t)->base.code
) == COMPLEX_TYPE) || (((enum tree_code) (t)->base.code) ==
POINTER_TYPE) || (((enum tree_code) (t)->base.code) == RECORD_TYPE
&& (((tree_class_check (((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 71, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 71, __FUNCTION__))->type_common.lang_flag_2))) || (((enum
tree_code) (t)->base.code) == NULLPTR_TYPE))
72 || VECTOR_TYPE_P (t)(((enum tree_code) (t)->base.code) == VECTOR_TYPE)
73 || TYPE_REF_P (t)(((enum tree_code) (t)->base.code) == REFERENCE_TYPE)
74 || (VOID_TYPE_P (t)(((enum tree_code) (t)->base.code) == VOID_TYPE) && cxx_dialect >= cxx14))
75 return true;
76 if (CLASS_TYPE_P (t)(((((enum tree_code) (t)->base.code)) == RECORD_TYPE || ((
(enum tree_code) (t)->base.code)) == UNION_TYPE) &&
((tree_class_check ((t), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 76, __FUNCTION__))->type_common.lang_flag_5))
)
77 {
78 t = complete_type (t);
79 gcc_assert (COMPLETE_TYPE_P (t) || errorcount)((void)(!((((tree_class_check ((t), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 79, __FUNCTION__))->type_common.size) != (tree) nullptr)
|| (global_dc)->diagnostic_count[(int) (DK_ERROR)]) ? fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 79, __FUNCTION__), 0 : 0))
;
80 return CLASSTYPE_LITERAL_P (t)((((tree_class_check ((t), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 80, __FUNCTION__))->type_with_lang_specific.lang_specific
))->is_literal)
;
81 }
82 if (TREE_CODE (t)((enum tree_code) (t)->base.code) == ARRAY_TYPE)
83 return literal_type_p (strip_array_types (t));
84 return false;
85}
86
87/* If DECL is a variable declared `constexpr', require its type
88 be literal. Return error_mark_node if we give an error, the
89 DECL otherwise. */
90
91tree
92ensure_literal_type_for_constexpr_object (tree decl)
93{
94 tree type = TREE_TYPE (decl)((contains_struct_check ((decl), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 94, __FUNCTION__))->typed.type)
;
95 if (VAR_P (decl)(((enum tree_code) (decl)->base.code) == VAR_DECL)
96 && (DECL_DECLARED_CONSTEXPR_P (decl)((contains_struct_check (((tree_check2 (((((enum tree_code) (
decl)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((decl
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 96, __FUNCTION__, (TEMPLATE_DECL))))))))->result : decl)
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 96, __FUNCTION__, (VAR_DECL), (FUNCTION_DECL)))), (TS_DECL_COMMON
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 96, __FUNCTION__))->decl_common.lang_flag_8)
97 || var_in_constexpr_fn (decl))
98 && !processing_template_declscope_chain->x_processing_template_decl)
99 {
100 tree stype = strip_array_types (type);
101 if (CLASS_TYPE_P (stype)(((((enum tree_code) (stype)->base.code)) == RECORD_TYPE ||
(((enum tree_code) (stype)->base.code)) == UNION_TYPE) &&
((tree_class_check ((stype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 101, __FUNCTION__))->type_common.lang_flag_5))
&& !COMPLETE_TYPE_P (complete_type (stype))(((tree_class_check ((complete_type (stype)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 101, __FUNCTION__))->type_common.size) != (tree) nullptr
)
)
102 /* Don't complain here, we'll complain about incompleteness
103 when we try to initialize the variable. */;
104 else if (!literal_type_p (type))
105 {
106 if (DECL_DECLARED_CONSTEXPR_P (decl)((contains_struct_check (((tree_check2 (((((enum tree_code) (
decl)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((decl
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 106, __FUNCTION__, (TEMPLATE_DECL))))))))->result : decl
)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 106, __FUNCTION__, (VAR_DECL), (FUNCTION_DECL)))), (TS_DECL_COMMON
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 106, __FUNCTION__))->decl_common.lang_flag_8)
)
107 {
108 auto_diagnostic_group d;
109 error_at (DECL_SOURCE_LOCATION (decl)((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 109, __FUNCTION__))->decl_minimal.locus)
,
110 "the type %qT of %<constexpr%> variable %qD "
111 "is not literal", type, decl);
112 explain_non_literal_class (type);
113 decl = error_mark_nodeglobal_trees[TI_ERROR_MARK];
114 }
115 else if (cxx_dialect < cxx23)
116 {
117 if (!is_instantiation_of_constexpr (current_function_decl))
118 {
119 auto_diagnostic_group d;
120 error_at (DECL_SOURCE_LOCATION (decl)((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 120, __FUNCTION__))->decl_minimal.locus)
,
121 "variable %qD of non-literal type %qT in "
122 "%<constexpr%> function only available with "
123 "%<-std=c++2b%> or %<-std=gnu++2b%>", decl, type);
124 explain_non_literal_class (type);
125 decl = error_mark_nodeglobal_trees[TI_ERROR_MARK];
126 }
127 cp_function_chain((cfun + 0)->language)->invalid_constexpr = true;
128 }
129 }
130 else if (DECL_DECLARED_CONSTEXPR_P (decl)((contains_struct_check (((tree_check2 (((((enum tree_code) (
decl)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((decl
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 130, __FUNCTION__, (TEMPLATE_DECL))))))))->result : decl
)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 130, __FUNCTION__, (VAR_DECL), (FUNCTION_DECL)))), (TS_DECL_COMMON
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 130, __FUNCTION__))->decl_common.lang_flag_8)
131 && variably_modified_type_p (type, NULL_TREE(tree) nullptr))
132 {
133 error_at (DECL_SOURCE_LOCATION (decl)((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 133, __FUNCTION__))->decl_minimal.locus)
,
134 "%<constexpr%> variable %qD has variably-modified "
135 "type %qT", decl, type);
136 decl = error_mark_nodeglobal_trees[TI_ERROR_MARK];
137 }
138 }
139 return decl;
140}
141
142struct constexpr_fundef_hasher : ggc_ptr_hash<constexpr_fundef>
143{
144 static hashval_t hash (const constexpr_fundef *);
145 static bool equal (const constexpr_fundef *, const constexpr_fundef *);
146};
147
148/* This table holds all constexpr function definitions seen in
149 the current translation unit. */
150
151static GTY (()) hash_table<constexpr_fundef_hasher> *constexpr_fundef_table;
152
153/* Utility function used for managing the constexpr function table.
154 Return true if the entries pointed to by P and Q are for the
155 same constexpr function. */
156
157inline bool
158constexpr_fundef_hasher::equal (const constexpr_fundef *lhs,
159 const constexpr_fundef *rhs)
160{
161 return lhs->decl == rhs->decl;
162}
163
164/* Utility function used for managing the constexpr function table.
165 Return a hash value for the entry pointed to by Q. */
166
167inline hashval_t
168constexpr_fundef_hasher::hash (const constexpr_fundef *fundef)
169{
170 return DECL_UID (fundef->decl)((contains_struct_check ((fundef->decl), (TS_DECL_MINIMAL)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 170, __FUNCTION__))->decl_minimal.uid)
;
171}
172
173/* Return a previously saved definition of function FUN. */
174
175constexpr_fundef *
176retrieve_constexpr_fundef (tree fun)
177{
178 if (constexpr_fundef_table == NULLnullptr)
179 return NULLnullptr;
180
181 constexpr_fundef fundef = { fun, NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr };
182 return constexpr_fundef_table->find (&fundef);
183}
184
185/* Check whether the parameter and return types of FUN are valid for a
186 constexpr function, and complain if COMPLAIN. */
187
188bool
189is_valid_constexpr_fn (tree fun, bool complain)
190{
191 bool ret = true;
192
193 if (DECL_INHERITED_CTOR (fun)((((enum tree_code) (fun)->base.code) == FUNCTION_DECL || (
((enum tree_code) (fun)->base.code) == TEMPLATE_DECL &&
((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 193, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) nullptr && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fun)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 193, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base
.code) == FUNCTION_DECL)) && ((tree_check (((((enum tree_code
) (fun)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fun)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 193, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fun)
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 193, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
) ? __extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (fun)->base.code) == TEMPLATE_DECL ?
((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 193, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fun)
), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 193, __FUNCTION__))->decl_common.lang_specific); if (!((
(enum tree_code) (fun)->base.code) == FUNCTION_DECL || (((
enum tree_code) (fun)->base.code) == TEMPLATE_DECL &&
((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 193, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) nullptr && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fun)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 193, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base
.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 193, __FUNCTION__); &lt->u.fn; })->context : (tree
) nullptr)
194 && TREE_CODE (fun)((enum tree_code) (fun)->base.code) == TEMPLATE_DECL)
195 {
196 ret = false;
197 if (complain)
198 error ("inherited constructor %qD is not %<constexpr%>",
199 DECL_INHERITED_CTOR (fun)((((enum tree_code) (fun)->base.code) == FUNCTION_DECL || (
((enum tree_code) (fun)->base.code) == TEMPLATE_DECL &&
((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 199, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) nullptr && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fun)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 199, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base
.code) == FUNCTION_DECL)) && ((tree_check (((((enum tree_code
) (fun)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fun)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 199, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fun)
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 199, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
) ? __extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (fun)->base.code) == TEMPLATE_DECL ?
((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 199, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fun)
), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 199, __FUNCTION__))->decl_common.lang_specific); if (!((
(enum tree_code) (fun)->base.code) == FUNCTION_DECL || (((
enum tree_code) (fun)->base.code) == TEMPLATE_DECL &&
((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 199, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) nullptr && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fun)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 199, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base
.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 199, __FUNCTION__); &lt->u.fn; })->context : (tree
) nullptr)
);
200 }
201 else
202 {
203 for (tree parm = FUNCTION_FIRST_USER_PARM (fun)skip_artificial_parms_for ((fun), ((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 203, __FUNCTION__, (FUNCTION_DECL)))->function_decl.arguments
))
;
204 parm != NULL_TREE(tree) nullptr; parm = TREE_CHAIN (parm)((contains_struct_check ((parm), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 204, __FUNCTION__))->common.chain)
)
205 if (!literal_type_p (TREE_TYPE (parm)((contains_struct_check ((parm), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 205, __FUNCTION__))->typed.type)
))
206 {
207 ret = false;
208 if (complain)
209 {
210 auto_diagnostic_group d;
211 error ("invalid type for parameter %d of %<constexpr%> "
212 "function %q+#D", DECL_PARM_INDEX (parm)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check
((parm), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 212, __FUNCTION__))->decl_common.lang_specific); if (((enum
tree_code) (parm)->base.code) != PARM_DECL || lt->u.base
.selector != lds_parm) lang_check_failed ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 212, __FUNCTION__); &lt->u.parm; })->index)
, fun);
213 explain_non_literal_class (TREE_TYPE (parm)((contains_struct_check ((parm), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 213, __FUNCTION__))->typed.type)
);
214 }
215 }
216 }
217
218 if (LAMBDA_TYPE_P (CP_DECL_CONTEXT (fun))(((enum tree_code) ((!(! (((contains_struct_check ((fun), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->decl_minimal.context)) || ((enum tree_code
) (((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->decl_minimal.context))->base.code
) == TRANSLATION_UNIT_DECL) ? ((contains_struct_check ((fun),
(TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->decl_minimal.context) : cp_global_trees
[CPTI_GLOBAL]))->base.code) == RECORD_TYPE && ((((
tree_class_check ((((tree_class_check (((!(! (((contains_struct_check
((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->decl_minimal.context)) || ((enum tree_code
) (((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->decl_minimal.context))->base.code
) == TRANSLATION_UNIT_DECL) ? ((contains_struct_check ((fun),
(TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->decl_minimal.context) : cp_global_trees
[CPTI_GLOBAL])), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->type_common.name) && (tree_code_type
[(int) (((enum tree_code) (((tree_class_check ((((tree_class_check
(((!(! (((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->decl_minimal.context)) || ((enum tree_code
) (((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->decl_minimal.context))->base.code
) == TRANSLATION_UNIT_DECL) ? ((contains_struct_check ((fun),
(TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->decl_minimal.context) : cp_global_trees
[CPTI_GLOBAL])), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->type_common.name))->base.code))]
== tcc_declaration) ? ((contains_struct_check ((((tree_class_check
((((tree_class_check (((!(! (((contains_struct_check ((fun),
(TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->decl_minimal.context)) || ((enum tree_code
) (((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->decl_minimal.context))->base.code
) == TRANSLATION_UNIT_DECL) ? ((contains_struct_check ((fun),
(TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->decl_minimal.context) : cp_global_trees
[CPTI_GLOBAL])), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->type_common.name)), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->decl_minimal.name) : ((tree_class_check
((((tree_class_check (((!(! (((contains_struct_check ((fun),
(TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->decl_minimal.context)) || ((enum tree_code
) (((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->decl_minimal.context))->base.code
) == TRANSLATION_UNIT_DECL) ? ((contains_struct_check ((fun),
(TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->decl_minimal.context) : cp_global_trees
[CPTI_GLOBAL])), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->type_common.name))) && ((tree_check
((((((tree_class_check ((((tree_class_check (((!(! (((contains_struct_check
((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->decl_minimal.context)) || ((enum tree_code
) (((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->decl_minimal.context))->base.code
) == TRANSLATION_UNIT_DECL) ? ((contains_struct_check ((fun),
(TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->decl_minimal.context) : cp_global_trees
[CPTI_GLOBAL])), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->type_common.name) && (tree_code_type
[(int) (((enum tree_code) (((tree_class_check ((((tree_class_check
(((!(! (((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->decl_minimal.context)) || ((enum tree_code
) (((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->decl_minimal.context))->base.code
) == TRANSLATION_UNIT_DECL) ? ((contains_struct_check ((fun),
(TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->decl_minimal.context) : cp_global_trees
[CPTI_GLOBAL])), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->type_common.name))->base.code))]
== tcc_declaration) ? ((contains_struct_check ((((tree_class_check
((((tree_class_check (((!(! (((contains_struct_check ((fun),
(TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->decl_minimal.context)) || ((enum tree_code
) (((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->decl_minimal.context))->base.code
) == TRANSLATION_UNIT_DECL) ? ((contains_struct_check ((fun),
(TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->decl_minimal.context) : cp_global_trees
[CPTI_GLOBAL])), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->type_common.name)), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->decl_minimal.name) : ((tree_class_check
((((tree_class_check (((!(! (((contains_struct_check ((fun),
(TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->decl_minimal.context)) || ((enum tree_code
) (((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->decl_minimal.context))->base.code
) == TRANSLATION_UNIT_DECL) ? ((contains_struct_check ((fun),
(TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->decl_minimal.context) : cp_global_trees
[CPTI_GLOBAL])), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__))->type_common.name)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 218, __FUNCTION__, (IDENTIFIER_NODE)))->base.protected_flag
))
&& cxx_dialect < cxx17)
219 {
220 ret = false;
221 if (complain)
222 inform (DECL_SOURCE_LOCATION (fun)((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 222, __FUNCTION__))->decl_minimal.locus)
,
223 "lambdas are implicitly %<constexpr%> only in C++17 and later");
224 }
225 else if (DECL_DESTRUCTOR_P (fun)((tree_check (((((enum tree_code) (fun)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 225, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fun)
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 225, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_destructor
)
)
226 {
227 if (cxx_dialect < cxx20)
228 {
229 ret = false;
230 if (complain)
231 error_at (DECL_SOURCE_LOCATION (fun)((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 231, __FUNCTION__))->decl_minimal.locus)
,
232 "%<constexpr%> destructors only available"
233 " with %<-std=c++20%> or %<-std=gnu++20%>");
234 }
235 }
236 else if (!DECL_CONSTRUCTOR_P (fun)((tree_check (((((enum tree_code) (fun)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 236, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fun)
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 236, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
)
237 {
238 tree rettype = TREE_TYPE (TREE_TYPE (fun))((contains_struct_check ((((contains_struct_check ((fun), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 238, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 238, __FUNCTION__))->typed.type)
;
239 if (!literal_type_p (rettype))
240 {
241 ret = false;
242 if (complain)
243 {
244 auto_diagnostic_group d;
245 error ("invalid return type %qT of %<constexpr%> function %q+D",
246 rettype, fun);
247 explain_non_literal_class (rettype);
248 }
249 }
250
251 /* C++14 DR 1684 removed this restriction. */
252 if (cxx_dialect < cxx14
253 && DECL_NONSTATIC_MEMBER_FUNCTION_P (fun)(((enum tree_code) (((contains_struct_check ((fun), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 253, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE
)
254 && !CLASSTYPE_LITERAL_P (DECL_CONTEXT (fun))((((tree_class_check ((((contains_struct_check ((fun), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 254, __FUNCTION__))->decl_minimal.context)), (tcc_type),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 254, __FUNCTION__))->type_with_lang_specific.lang_specific
))->is_literal)
)
255 {
256 ret = false;
257 if (complain)
258 {
259 auto_diagnostic_group d;
260 if (pedwarn (DECL_SOURCE_LOCATION (fun)((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 260, __FUNCTION__))->decl_minimal.locus)
, OPT_Wpedantic,
261 "enclosing class of %<constexpr%> non-static"
262 " member function %q+#D is not a literal type",
263 fun))
264 explain_non_literal_class (DECL_CONTEXT (fun)((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 264, __FUNCTION__))->decl_minimal.context)
);
265 }
266 }
267 }
268 else if (CLASSTYPE_VBASECLASSES (DECL_CONTEXT (fun))((((tree_class_check ((((contains_struct_check ((fun), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 268, __FUNCTION__))->decl_minimal.context)), (tcc_type),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 268, __FUNCTION__))->type_with_lang_specific.lang_specific
))->vbases)
)
269 {
270 ret = false;
271 if (complain)
272 error ("%q#T has virtual base classes", DECL_CONTEXT (fun)((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 272, __FUNCTION__))->decl_minimal.context)
);
273 }
274
275 return ret;
276}
277
278/* Subroutine of build_data_member_initialization. MEMBER is a COMPONENT_REF
279 for a member of an anonymous aggregate, INIT is the initializer for that
280 member, and VEC_OUTER is the vector of constructor elements for the class
281 whose constructor we are processing. Add the initializer to the vector
282 and return true to indicate success. */
283
284static bool
285build_anon_member_initialization (tree member, tree init,
286 vec<constructor_elt, va_gc> **vec_outer)
287{
288 /* MEMBER presents the relevant fields from the inside out, but we need
289 to build up the initializer from the outside in so that we can reuse
290 previously built CONSTRUCTORs if this is, say, the second field in an
291 anonymous struct. So we use a vec as a stack. */
292 auto_vec<tree, 2> fields;
293 do
294 {
295 fields.safe_push (TREE_OPERAND (member, 1)(*((const_cast<tree*> (tree_operand_check ((member), (1
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 295, __FUNCTION__)))))
);
296 member = TREE_OPERAND (member, 0)(*((const_cast<tree*> (tree_operand_check ((member), (0
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 296, __FUNCTION__)))))
;
297 }
298 while (ANON_AGGR_TYPE_P (TREE_TYPE (member))((((((enum tree_code) (((contains_struct_check ((member), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 298, __FUNCTION__))->typed.type))->base.code)) == RECORD_TYPE
|| (((enum tree_code) (((contains_struct_check ((member), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 298, __FUNCTION__))->typed.type))->base.code)) == UNION_TYPE
) && ((tree_class_check ((((contains_struct_check ((member
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 298, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 298, __FUNCTION__))->type_common.lang_flag_5)) &&
(((tree_class_check ((((contains_struct_check ((member), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 298, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 298, __FUNCTION__))->type_with_lang_specific.lang_specific
))->anon_aggr)
299 && TREE_CODE (member)((enum tree_code) (member)->base.code) == COMPONENT_REF);
300
301 /* VEC has the constructor elements vector for the context of FIELD.
302 If FIELD is an anonymous aggregate, we will push inside it. */
303 vec<constructor_elt, va_gc> **vec = vec_outer;
304 tree field;
305 while (field = fields.pop(),
306 ANON_AGGR_TYPE_P (TREE_TYPE (field))((((((enum tree_code) (((contains_struct_check ((field), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 306, __FUNCTION__))->typed.type))->base.code)) == RECORD_TYPE
|| (((enum tree_code) (((contains_struct_check ((field), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 306, __FUNCTION__))->typed.type))->base.code)) == UNION_TYPE
) && ((tree_class_check ((((contains_struct_check ((field
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 306, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 306, __FUNCTION__))->type_common.lang_flag_5)) &&
(((tree_class_check ((((contains_struct_check ((field), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 306, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 306, __FUNCTION__))->type_with_lang_specific.lang_specific
))->anon_aggr)
)
307 {
308 tree ctor;
309 /* If there is already an outer constructor entry for the anonymous
310 aggregate FIELD, use it; otherwise, insert one. */
311 if (vec_safe_is_empty (*vec)
312 || (*vec)->last().index != field)
313 {
314 ctor = build_constructor (TREE_TYPE (field)((contains_struct_check ((field), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 314, __FUNCTION__))->typed.type)
, NULLnullptr);
315 CONSTRUCTOR_APPEND_ELT (*vec, field, ctor)do { constructor_elt _ce___ = {field, ctor}; vec_safe_push ((
*vec), _ce___); } while (0)
;
316 }
317 else
318 ctor = (*vec)->last().value;
319 vec = &CONSTRUCTOR_ELTS (ctor)((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 319, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
;
320 }
321
322 /* Now we're at the innermost field, the one that isn't an anonymous
323 aggregate. Add its initializer to the CONSTRUCTOR and we're done. */
324 gcc_assert (fields.is_empty())((void)(!(fields.is_empty()) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 324, __FUNCTION__), 0 : 0))
;
325 CONSTRUCTOR_APPEND_ELT (*vec, field, init)do { constructor_elt _ce___ = {field, init}; vec_safe_push ((
*vec), _ce___); } while (0)
;
326
327 return true;
328}
329
330/* Subroutine of build_constexpr_constructor_member_initializers.
331 The expression tree T represents a data member initialization
332 in a (constexpr) constructor definition. Build a pairing of
333 the data member with its initializer, and prepend that pair
334 to the existing initialization pair INITS. */
335
336static bool
337build_data_member_initialization (tree t, vec<constructor_elt, va_gc> **vec)
338{
339 tree member, init;
340 if (TREE_CODE (t)((enum tree_code) (t)->base.code) == CLEANUP_POINT_EXPR)
341 t = TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 341, __FUNCTION__)))))
;
342 if (TREE_CODE (t)((enum tree_code) (t)->base.code) == EXPR_STMT)
343 t = TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 343, __FUNCTION__)))))
;
344 if (t == error_mark_nodeglobal_trees[TI_ERROR_MARK])
345 return false;
346 if (TREE_CODE (t)((enum tree_code) (t)->base.code) == STATEMENT_LIST)
347 {
348 for (tree stmt : tsi_range (t))
349 if (! build_data_member_initialization (stmt, vec))
350 return false;
351 return true;
352 }
353 if (TREE_CODE (t)((enum tree_code) (t)->base.code) == CLEANUP_STMT)
354 {
355 /* We can't see a CLEANUP_STMT in a constructor for a literal class,
356 but we can in a constexpr constructor for a non-literal class. Just
357 ignore it; either all the initialization will be constant, in which
358 case the cleanup can't run, or it can't be constexpr.
359 Still recurse into CLEANUP_BODY. */
360 return build_data_member_initialization (CLEANUP_BODY (t)(*((const_cast<tree*> (tree_operand_check (((tree_check
((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 360, __FUNCTION__, (CLEANUP_STMT)))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 360, __FUNCTION__)))))
, vec);
361 }
362 if (TREE_CODE (t)((enum tree_code) (t)->base.code) == CONVERT_EXPR)
363 t = TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 363, __FUNCTION__)))))
;
364 if (TREE_CODE (t)((enum tree_code) (t)->base.code) == INIT_EXPR
365 /* vptr initialization shows up as a MODIFY_EXPR. In C++14 we only
366 use what this function builds for cx_check_missing_mem_inits, and
367 assignment in the ctor body doesn't count. */
368 || (cxx_dialect < cxx14 && TREE_CODE (t)((enum tree_code) (t)->base.code) == MODIFY_EXPR))
369 {
370 member = TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 370, __FUNCTION__)))))
;
371 init = break_out_target_exprs (TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 371, __FUNCTION__)))))
);
372 }
373 else if (TREE_CODE (t)((enum tree_code) (t)->base.code) == CALL_EXPR)
374 {
375 tree fn = get_callee_fndecl (t);
376 if (!fn || !DECL_CONSTRUCTOR_P (fn)((tree_check (((((enum tree_code) (fn)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 376, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn))
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 376, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
)
377 /* We're only interested in calls to subobject constructors. */
378 return true;
379 member = 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/cp/constexpr.c"
, 379, __FUNCTION__, (CALL_EXPR)))), ((0) + 3), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 379, __FUNCTION__)))))
;
380 /* We don't use build_cplus_new here because it complains about
381 abstract bases. Leaving the call unwrapped means that it has the
382 wrong type, but cxx_eval_constant_expression doesn't care. */
383 init = break_out_target_exprs (t);
384 }
385 else if (TREE_CODE (t)((enum tree_code) (t)->base.code) == BIND_EXPR)
386 return build_data_member_initialization (BIND_EXPR_BODY (t)((*((const_cast<tree*> (tree_operand_check (((tree_check
((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 386, __FUNCTION__, (BIND_EXPR)))), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 386, __FUNCTION__))))))
, vec);
387 else
388 /* Don't add anything else to the CONSTRUCTOR. */
389 return true;
390 if (INDIRECT_REF_P (member)(((enum tree_code) (member)->base.code) == INDIRECT_REF))
391 member = TREE_OPERAND (member, 0)(*((const_cast<tree*> (tree_operand_check ((member), (0
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 391, __FUNCTION__)))))
;
392 if (TREE_CODE (member)((enum tree_code) (member)->base.code) == NOP_EXPR)
393 {
394 tree op = member;
395 STRIP_NOPS (op)(op) = tree_strip_nop_conversions ((const_cast<union tree_node
*> (((op)))))
;
396 if (TREE_CODE (op)((enum tree_code) (op)->base.code) == ADDR_EXPR)
397 {
398 gcc_assert (same_type_ignoring_top_level_qualifiers_p((void)(!(same_type_ignoring_top_level_qualifiers_p (((contains_struct_check
((((contains_struct_check ((op), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 399, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 399, __FUNCTION__))->typed.type), ((contains_struct_check
((((contains_struct_check ((member), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 400, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 400, __FUNCTION__))->typed.type))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 400, __FUNCTION__), 0 : 0))
399 (TREE_TYPE (TREE_TYPE (op)),((void)(!(same_type_ignoring_top_level_qualifiers_p (((contains_struct_check
((((contains_struct_check ((op), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 399, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 399, __FUNCTION__))->typed.type), ((contains_struct_check
((((contains_struct_check ((member), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 400, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 400, __FUNCTION__))->typed.type))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 400, __FUNCTION__), 0 : 0))
400 TREE_TYPE (TREE_TYPE (member))))((void)(!(same_type_ignoring_top_level_qualifiers_p (((contains_struct_check
((((contains_struct_check ((op), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 399, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 399, __FUNCTION__))->typed.type), ((contains_struct_check
((((contains_struct_check ((member), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 400, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 400, __FUNCTION__))->typed.type))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 400, __FUNCTION__), 0 : 0))
;
401 /* Initializing a cv-qualified member; we need to look through
402 the const_cast. */
403 member = op;
404 }
405 else if (op == current_class_ptr(*((cfun + 0) && ((cfun + 0)->language) ? &((cfun
+ 0)->language)->x_current_class_ptr : &scope_chain
->x_current_class_ptr))
406 && (same_type_ignoring_top_level_qualifiers_p
407 (TREE_TYPE (TREE_TYPE (member))((contains_struct_check ((((contains_struct_check ((member), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 407, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 407, __FUNCTION__))->typed.type)
,
408 current_class_typescope_chain->class_type)))
409 /* Delegating constructor. */
410 member = op;
411 else
412 {
413 /* This is an initializer for an empty base; keep it for now so
414 we can check it in cxx_eval_bare_aggregate. */
415 gcc_assert (is_empty_class (TREE_TYPE (TREE_TYPE (member))))((void)(!(is_empty_class (((contains_struct_check ((((contains_struct_check
((member), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 415, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 415, __FUNCTION__))->typed.type))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 415, __FUNCTION__), 0 : 0))
;
416 }
417 }
418 if (TREE_CODE (member)((enum tree_code) (member)->base.code) == ADDR_EXPR)
419 member = TREE_OPERAND (member, 0)(*((const_cast<tree*> (tree_operand_check ((member), (0
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 419, __FUNCTION__)))))
;
420 if (TREE_CODE (member)((enum tree_code) (member)->base.code) == COMPONENT_REF)
421 {
422 tree aggr = TREE_OPERAND (member, 0)(*((const_cast<tree*> (tree_operand_check ((member), (0
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 422, __FUNCTION__)))))
;
423 if (TREE_CODE (aggr)((enum tree_code) (aggr)->base.code) == VAR_DECL)
424 /* Initializing a local variable, don't add anything. */
425 return true;
426 if (TREE_CODE (aggr)((enum tree_code) (aggr)->base.code) != COMPONENT_REF)
427 /* Normal member initialization. */
428 member = TREE_OPERAND (member, 1)(*((const_cast<tree*> (tree_operand_check ((member), (1
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 428, __FUNCTION__)))))
;
429 else if (ANON_AGGR_TYPE_P (TREE_TYPE (aggr))((((((enum tree_code) (((contains_struct_check ((aggr), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 429, __FUNCTION__))->typed.type))->base.code)) == RECORD_TYPE
|| (((enum tree_code) (((contains_struct_check ((aggr), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 429, __FUNCTION__))->typed.type))->base.code)) == UNION_TYPE
) && ((tree_class_check ((((contains_struct_check ((aggr
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 429, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 429, __FUNCTION__))->type_common.lang_flag_5)) &&
(((tree_class_check ((((contains_struct_check ((aggr), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 429, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 429, __FUNCTION__))->type_with_lang_specific.lang_specific
))->anon_aggr)
)
430 /* Initializing a member of an anonymous union. */
431 return build_anon_member_initialization (member, init, vec);
432 else
433 /* We're initializing a vtable pointer in a base. Leave it as
434 COMPONENT_REF so we remember the path to get to the vfield. */
435 gcc_assert (TREE_TYPE (member) == vtbl_ptr_type_node)((void)(!(((contains_struct_check ((member), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 435, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_VTBL_PTR_TYPE
]) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 435, __FUNCTION__), 0 : 0))
;
436 }
437
438 /* Value-initialization can produce multiple initializers for the
439 same field; use the last one. */
440 if (!vec_safe_is_empty (*vec) && (*vec)->last().index == member)
441 (*vec)->last().value = init;
442 else
443 CONSTRUCTOR_APPEND_ELT (*vec, member, init)do { constructor_elt _ce___ = {member, init}; vec_safe_push (
(*vec), _ce___); } while (0)
;
444 return true;
445}
446
447/* Subroutine of check_constexpr_ctor_body_1 and constexpr_fn_retval.
448 In C++11 mode checks that the TYPE_DECLs in the BIND_EXPR_VARS of a
449 BIND_EXPR conform to 7.1.5/3/4 on typedef and alias declarations. */
450
451static bool
452check_constexpr_bind_expr_vars (tree t)
453{
454 gcc_assert (TREE_CODE (t) == BIND_EXPR)((void)(!(((enum tree_code) (t)->base.code) == BIND_EXPR) ?
fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 454, __FUNCTION__), 0 : 0))
;
455
456 for (tree var = BIND_EXPR_VARS (t)((*((const_cast<tree*> (tree_operand_check (((tree_check
((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 456, __FUNCTION__, (BIND_EXPR)))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 456, __FUNCTION__))))))
; var; var = DECL_CHAIN (var)(((contains_struct_check (((contains_struct_check ((var), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 456, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 456, __FUNCTION__))->common.chain))
)
457 if (TREE_CODE (var)((enum tree_code) (var)->base.code) == TYPE_DECL
458 && DECL_IMPLICIT_TYPEDEF_P (var)(((enum tree_code) (var)->base.code) == TYPE_DECL &&
((contains_struct_check ((var), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 458, __FUNCTION__))->decl_common.lang_flag_2))
459 && !LAMBDA_TYPE_P (TREE_TYPE (var))(((enum tree_code) (((contains_struct_check ((var), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 459, __FUNCTION__))->typed.type))->base.code) == RECORD_TYPE
&& ((((tree_class_check ((((tree_class_check ((((contains_struct_check
((var), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 459, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 459, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 459, __FUNCTION__))->type_common.name) && (tree_code_type
[(int) (((enum tree_code) (((tree_class_check ((((tree_class_check
((((contains_struct_check ((var), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 459, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 459, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 459, __FUNCTION__))->type_common.name))->base.code))]
== tcc_declaration) ? ((contains_struct_check ((((tree_class_check
((((tree_class_check ((((contains_struct_check ((var), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 459, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 459, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 459, __FUNCTION__))->type_common.name)), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 459, __FUNCTION__))->decl_minimal.name) : ((tree_class_check
((((tree_class_check ((((contains_struct_check ((var), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 459, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 459, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 459, __FUNCTION__))->type_common.name))) && ((tree_check
((((((tree_class_check ((((tree_class_check ((((contains_struct_check
((var), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 459, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 459, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 459, __FUNCTION__))->type_common.name) && (tree_code_type
[(int) (((enum tree_code) (((tree_class_check ((((tree_class_check
((((contains_struct_check ((var), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 459, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 459, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 459, __FUNCTION__))->type_common.name))->base.code))]
== tcc_declaration) ? ((contains_struct_check ((((tree_class_check
((((tree_class_check ((((contains_struct_check ((var), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 459, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 459, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 459, __FUNCTION__))->type_common.name)), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 459, __FUNCTION__))->decl_minimal.name) : ((tree_class_check
((((tree_class_check ((((contains_struct_check ((var), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 459, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 459, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 459, __FUNCTION__))->type_common.name)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 459, __FUNCTION__, (IDENTIFIER_NODE)))->base.protected_flag
))
)
460 return false;
461 return true;
462}
463
464/* Subroutine of check_constexpr_ctor_body. */
465
466static bool
467check_constexpr_ctor_body_1 (tree last, tree list)
468{
469 switch (TREE_CODE (list)((enum tree_code) (list)->base.code))
470 {
471 case DECL_EXPR:
472 if (TREE_CODE (DECL_EXPR_DECL (list))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check
(((tree_check ((list), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 472, __FUNCTION__, (DECL_EXPR)))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 472, __FUNCTION__))))))->base.code)
== USING_DECL
473 || TREE_CODE (DECL_EXPR_DECL (list))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check
(((tree_check ((list), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 473, __FUNCTION__, (DECL_EXPR)))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 473, __FUNCTION__))))))->base.code)
== TYPE_DECL)
474 return true;
475 return false;
476
477 case CLEANUP_POINT_EXPR:
478 return check_constexpr_ctor_body (last, TREE_OPERAND (list, 0)(*((const_cast<tree*> (tree_operand_check ((list), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 478, __FUNCTION__)))))
,
479 /*complain=*/false);
480
481 case BIND_EXPR:
482 if (!check_constexpr_bind_expr_vars (list)
483 || !check_constexpr_ctor_body (last, BIND_EXPR_BODY (list)((*((const_cast<tree*> (tree_operand_check (((tree_check
((list), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 483, __FUNCTION__, (BIND_EXPR)))), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 483, __FUNCTION__))))))
,
484 /*complain=*/false))
485 return false;
486 return true;
487
488 case USING_STMT:
489 case STATIC_ASSERT:
490 case DEBUG_BEGIN_STMT:
491 return true;
492
493 default:
494 return false;
495 }
496}
497
498/* Make sure that there are no statements after LAST in the constructor
499 body represented by LIST. */
500
501bool
502check_constexpr_ctor_body (tree last, tree list, bool complain)
503{
504 /* C++14 doesn't require a constexpr ctor to have an empty body. */
505 if (cxx_dialect >= cxx14)
506 return true;
507
508 bool ok = true;
509 if (TREE_CODE (list)((enum tree_code) (list)->base.code) == STATEMENT_LIST)
510 {
511 tree_stmt_iterator i = tsi_last (list);
512 for (; !tsi_end_p (i); tsi_prev (&i))
513 {
514 tree t = tsi_stmt (i);
515 if (t == last)
516 break;
517 if (!check_constexpr_ctor_body_1 (last, t))
518 {
519 ok = false;
520 break;
521 }
522 }
523 }
524 else if (list != last
525 && !check_constexpr_ctor_body_1 (last, list))
526 ok = false;
527 if (!ok)
528 {
529 if (complain)
530 error ("%<constexpr%> constructor does not have empty body");
531 DECL_DECLARED_CONSTEXPR_P (current_function_decl)((contains_struct_check (((tree_check2 (((((enum tree_code) (
current_function_decl)->base.code) == TEMPLATE_DECL ? ((struct
tree_template_decl *)(const_cast<union tree_node *> ((
((tree_check ((current_function_decl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 531, __FUNCTION__, (TEMPLATE_DECL))))))))->result : current_function_decl
)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 531, __FUNCTION__, (VAR_DECL), (FUNCTION_DECL)))), (TS_DECL_COMMON
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 531, __FUNCTION__))->decl_common.lang_flag_8)
= false;
532 }
533 return ok;
534}
535
536/* V is a vector of constructor elements built up for the base and member
537 initializers of a constructor for TYPE. They need to be in increasing
538 offset order, which they might not be yet if TYPE has a primary base
539 which is not first in the base-clause or a vptr and at least one base
540 all of which are non-primary. */
541
542static vec<constructor_elt, va_gc> *
543sort_constexpr_mem_initializers (tree type, vec<constructor_elt, va_gc> *v)
544{
545 tree pri = CLASSTYPE_PRIMARY_BINFO (type)((((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 545, __FUNCTION__))->type_with_lang_specific.lang_specific
))->primary_base)
;
546 tree field_type;
547 unsigned i;
548 constructor_elt *ce;
549
550 if (pri)
551 field_type = BINFO_TYPE (pri)((contains_struct_check (((tree_check ((pri), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 551, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 551, __FUNCTION__))->typed.type)
;
552 else if (TYPE_CONTAINS_VPTR_P (type)((((tree_not_check2 ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 552, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_2)) || ((((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 552, __FUNCTION__))->type_with_lang_specific.lang_specific
))->vbases))
)
553 field_type = vtbl_ptr_type_nodecp_global_trees[CPTI_VTBL_PTR_TYPE];
554 else
555 return v;
556
557 /* Find the element for the primary base or vptr and move it to the
558 beginning of the vec. */
559 for (i = 0; vec_safe_iterate (v, i, &ce); ++i)
560 if (TREE_TYPE (ce->index)((contains_struct_check ((ce->index), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 560, __FUNCTION__))->typed.type)
== field_type)
561 break;
562
563 if (i > 0 && i < vec_safe_length (v))
564 {
565 vec<constructor_elt, va_gc> &vref = *v;
566 constructor_elt elt = vref[i];
567 for (; i > 0; --i)
568 vref[i] = vref[i-1];
569 vref[0] = elt;
570 }
571
572 return v;
573}
574
575/* Build compile-time evalable representations of member-initializer list
576 for a constexpr constructor. */
577
578static tree
579build_constexpr_constructor_member_initializers (tree type, tree body)
580{
581 vec<constructor_elt, va_gc> *vec = NULLnullptr;
582 bool ok = true;
583 while (true)
584 switch (TREE_CODE (body)((enum tree_code) (body)->base.code))
585 {
586 case MUST_NOT_THROW_EXPR:
587 case EH_SPEC_BLOCK:
588 body = TREE_OPERAND (body, 0)(*((const_cast<tree*> (tree_operand_check ((body), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 588, __FUNCTION__)))))
;
589 break;
590
591 case STATEMENT_LIST:
592 for (tree stmt : tsi_range (body))
593 {
594 body = stmt;
595 if (TREE_CODE (body)((enum tree_code) (body)->base.code) == BIND_EXPR)
596 break;
597 }
598 break;
599
600 case BIND_EXPR:
601 body = BIND_EXPR_BODY (body)((*((const_cast<tree*> (tree_operand_check (((tree_check
((body), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 601, __FUNCTION__, (BIND_EXPR)))), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 601, __FUNCTION__))))))
;
602 goto found;
603
604 default:
605 gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 605, __FUNCTION__))
;
606 }
607 found:
608 if (TREE_CODE (body)((enum tree_code) (body)->base.code) == TRY_BLOCK)
609 {
610 body = TREE_OPERAND (body, 0)(*((const_cast<tree*> (tree_operand_check ((body), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 610, __FUNCTION__)))))
;
611 if (TREE_CODE (body)((enum tree_code) (body)->base.code) == BIND_EXPR)
612 body = BIND_EXPR_BODY (body)((*((const_cast<tree*> (tree_operand_check (((tree_check
((body), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 612, __FUNCTION__, (BIND_EXPR)))), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 612, __FUNCTION__))))))
;
613 }
614 if (TREE_CODE (body)((enum tree_code) (body)->base.code) == CLEANUP_POINT_EXPR)
615 {
616 body = TREE_OPERAND (body, 0)(*((const_cast<tree*> (tree_operand_check ((body), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 616, __FUNCTION__)))))
;
617 if (TREE_CODE (body)((enum tree_code) (body)->base.code) == EXPR_STMT)
618 body = TREE_OPERAND (body, 0)(*((const_cast<tree*> (tree_operand_check ((body), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 618, __FUNCTION__)))))
;
619 if (TREE_CODE (body)((enum tree_code) (body)->base.code) == INIT_EXPR
620 && (same_type_ignoring_top_level_qualifiers_p
621 (TREE_TYPE (TREE_OPERAND (body, 0))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check
((body), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 621, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 621, __FUNCTION__))->typed.type)
,
622 current_class_typescope_chain->class_type)))
623 {
624 /* Trivial copy. */
625 return TREE_OPERAND (body, 1)(*((const_cast<tree*> (tree_operand_check ((body), (1),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 625, __FUNCTION__)))))
;
626 }
627 ok = build_data_member_initialization (body, &vec);
628 }
629 else if (TREE_CODE (body)((enum tree_code) (body)->base.code) == STATEMENT_LIST)
630 {
631 for (tree stmt : tsi_range (body))
632 {
633 ok = build_data_member_initialization (stmt, &vec);
634 if (!ok)
635 break;
636 }
637 }
638 else if (EXPR_P (body)((tree_code_type[(int) (((enum tree_code) (body)->base.code
))]) >= tcc_reference && (tree_code_type[(int) (((
enum tree_code) (body)->base.code))]) <= tcc_expression
)
)
639 ok = build_data_member_initialization (body, &vec);
640 else
641 gcc_assert (errorcount > 0)((void)(!((global_dc)->diagnostic_count[(int) (DK_ERROR)] >
0) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 641, __FUNCTION__), 0 : 0))
;
642 if (ok)
643 {
644 if (vec_safe_length (vec) > 0)
645 {
646 /* In a delegating constructor, return the target. */
647 constructor_elt *ce = &(*vec)[0];
648 if (ce->index == current_class_ptr(*((cfun + 0) && ((cfun + 0)->language) ? &((cfun
+ 0)->language)->x_current_class_ptr : &scope_chain
->x_current_class_ptr))
)
649 {
650 body = ce->value;
651 vec_free (vec);
652 return body;
653 }
654 }
655 vec = sort_constexpr_mem_initializers (type, vec);
656 return build_constructor (type, vec);
657 }
658 else
659 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
660}
661
662/* We have an expression tree T that represents a call, either CALL_EXPR
663 or AGGR_INIT_EXPR. If the call is lexically to a named function,
664 retrun the _DECL for that function. */
665
666static tree
667get_function_named_in_call (tree t)
668{
669 tree fun = cp_get_callee (t);
670 if (fun && TREE_CODE (fun)((enum tree_code) (fun)->base.code) == ADDR_EXPR
671 && TREE_CODE (TREE_OPERAND (fun, 0))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check
((fun), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 671, __FUNCTION__))))))->base.code)
== FUNCTION_DECL)
672 fun = TREE_OPERAND (fun, 0)(*((const_cast<tree*> (tree_operand_check ((fun), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 672, __FUNCTION__)))))
;
673 return fun;
674}
675
676/* Subroutine of check_constexpr_fundef. BODY is the body of a function
677 declared to be constexpr, or a sub-statement thereof. Returns the
678 return value if suitable, error_mark_node for a statement not allowed in
679 a constexpr function, or NULL_TREE if no return value was found. */
680
681tree
682constexpr_fn_retval (tree body)
683{
684 switch (TREE_CODE (body)((enum tree_code) (body)->base.code))
685 {
686 case STATEMENT_LIST:
687 {
688 tree expr = NULL_TREE(tree) nullptr;
689 for (tree stmt : tsi_range (body))
690 {
691 tree s = constexpr_fn_retval (stmt);
692 if (s == error_mark_nodeglobal_trees[TI_ERROR_MARK])
693 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
694 else if (s == NULL_TREE(tree) nullptr)
695 /* Keep iterating. */;
696 else if (expr)
697 /* Multiple return statements. */
698 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
699 else
700 expr = s;
701 }
702 return expr;
703 }
704
705 case RETURN_EXPR:
706 return break_out_target_exprs (TREE_OPERAND (body, 0)(*((const_cast<tree*> (tree_operand_check ((body), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 706, __FUNCTION__)))))
);
707
708 case DECL_EXPR:
709 {
710 tree decl = DECL_EXPR_DECL (body)(*((const_cast<tree*> (tree_operand_check (((tree_check
((body), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 710, __FUNCTION__, (DECL_EXPR)))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 710, __FUNCTION__)))))
;
711 if (TREE_CODE (decl)((enum tree_code) (decl)->base.code) == USING_DECL
712 /* Accept __func__, __FUNCTION__, and __PRETTY_FUNCTION__. */
713 || DECL_ARTIFICIAL (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 713, __FUNCTION__))->decl_common.artificial_flag)
)
714 return NULL_TREE(tree) nullptr;
715 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
716 }
717
718 case CLEANUP_POINT_EXPR:
719 return constexpr_fn_retval (TREE_OPERAND (body, 0)(*((const_cast<tree*> (tree_operand_check ((body), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 719, __FUNCTION__)))))
);
720
721 case BIND_EXPR:
722 if (!check_constexpr_bind_expr_vars (body))
723 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
724 return constexpr_fn_retval (BIND_EXPR_BODY (body)((*((const_cast<tree*> (tree_operand_check (((tree_check
((body), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 724, __FUNCTION__, (BIND_EXPR)))), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 724, __FUNCTION__))))))
);
725
726 case USING_STMT:
727 case DEBUG_BEGIN_STMT:
728 return NULL_TREE(tree) nullptr;
729
730 case CALL_EXPR:
731 {
732 tree fun = get_function_named_in_call (body);
733 if (fun != NULL_TREE(tree) nullptr
734 && fndecl_built_in_p (fun, BUILT_IN_UNREACHABLE))
735 return NULL_TREE(tree) nullptr;
736 }
737 /* Fallthru. */
738
739 default:
740 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
741 }
742}
743
744/* Subroutine of check_constexpr_fundef. BODY is the DECL_SAVED_TREE of
745 FUN; do the necessary transformations to turn it into a single expression
746 that we can store in the hash table. */
747
748static tree
749massage_constexpr_body (tree fun, tree body)
750{
751 if (DECL_CONSTRUCTOR_P (fun)((tree_check (((((enum tree_code) (fun)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 751, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fun)
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 751, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
)
752 body = build_constexpr_constructor_member_initializers
753 (DECL_CONTEXT (fun)((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 753, __FUNCTION__))->decl_minimal.context)
, body);
754 else if (cxx_dialect < cxx14)
755 {
756 if (TREE_CODE (body)((enum tree_code) (body)->base.code) == EH_SPEC_BLOCK)
757 body = EH_SPEC_STMTS (body)(*((const_cast<tree*> (tree_operand_check (((tree_check
((body), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 757, __FUNCTION__, (EH_SPEC_BLOCK)))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 757, __FUNCTION__)))))
;
758 if (TREE_CODE (body)((enum tree_code) (body)->base.code) == MUST_NOT_THROW_EXPR)
759 body = TREE_OPERAND (body, 0)(*((const_cast<tree*> (tree_operand_check ((body), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 759, __FUNCTION__)))))
;
760 body = constexpr_fn_retval (body);
761 }
762 return body;
763}
764
765/* CTYPE is a type constructed from BODY. Return true if some
766 bases/fields are uninitialized, and complain if COMPLAIN. */
767
768static bool
769cx_check_missing_mem_inits (tree ctype, tree body, bool complain)
770{
771 /* We allow uninitialized bases/fields in C++20. */
772 if (cxx_dialect >= cxx20)
773 return false;
774
775 unsigned nelts = 0;
776
777 if (body)
778 {
779 if (TREE_CODE (body)((enum tree_code) (body)->base.code) != CONSTRUCTOR)
780 return false;
781 nelts = CONSTRUCTOR_NELTS (body)(vec_safe_length (((tree_check ((body), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 781, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
;
782 }
783 tree field = TYPE_FIELDS (ctype)((tree_check3 ((ctype), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 783, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)
;
784
785 if (TREE_CODE (ctype)((enum tree_code) (ctype)->base.code) == UNION_TYPE)
786 {
787 if (nelts == 0 && next_initializable_field (field))
788 {
789 if (complain)
790 error ("%<constexpr%> constructor for union %qT must "
791 "initialize exactly one non-static data member", ctype);
792 return true;
793 }
794 return false;
795 }
796
797 /* Iterate over the CONSTRUCTOR, checking any missing fields don't
798 need an explicit initialization. */
799 bool bad = false;
800 for (unsigned i = 0; i <= nelts; ++i)
801 {
802 tree index = NULL_TREE(tree) nullptr;
803 if (i < nelts)
804 {
805 index = CONSTRUCTOR_ELT (body, i)(&(*((tree_check ((body), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 805, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[i
])
->index;
806 /* Skip base and vtable inits. */
807 if (TREE_CODE (index)((enum tree_code) (index)->base.code) != FIELD_DECL
808 || DECL_ARTIFICIAL (index)((contains_struct_check ((index), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 808, __FUNCTION__))->decl_common.artificial_flag)
)
809 continue;
810 }
811
812 for (; field != index; field = DECL_CHAIN (field)(((contains_struct_check (((contains_struct_check ((field), (
TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 812, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 812, __FUNCTION__))->common.chain))
)
813 {
814 tree ftype;
815 if (TREE_CODE (field)((enum tree_code) (field)->base.code) != FIELD_DECL)
816 continue;
817 if (DECL_UNNAMED_BIT_FIELD (field)((((contains_struct_check (((tree_check ((field), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 817, __FUNCTION__, (FIELD_DECL)))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 817, __FUNCTION__))->decl_common.lang_flag_4) == 1) &&
!((contains_struct_check ((field), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 817, __FUNCTION__))->decl_minimal.name))
)
818 continue;
819 if (DECL_ARTIFICIAL (field)((contains_struct_check ((field), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 819, __FUNCTION__))->decl_common.artificial_flag)
)
820 continue;
821 if (ANON_AGGR_TYPE_P (TREE_TYPE (field))((((((enum tree_code) (((contains_struct_check ((field), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 821, __FUNCTION__))->typed.type))->base.code)) == RECORD_TYPE
|| (((enum tree_code) (((contains_struct_check ((field), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 821, __FUNCTION__))->typed.type))->base.code)) == UNION_TYPE
) && ((tree_class_check ((((contains_struct_check ((field
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 821, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 821, __FUNCTION__))->type_common.lang_flag_5)) &&
(((tree_class_check ((((contains_struct_check ((field), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 821, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 821, __FUNCTION__))->type_with_lang_specific.lang_specific
))->anon_aggr)
)
822 {
823 /* Recurse to check the anonymous aggregate member. */
824 bad |= cx_check_missing_mem_inits
825 (TREE_TYPE (field)((contains_struct_check ((field), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 825, __FUNCTION__))->typed.type)
, NULL_TREE(tree) nullptr, complain);
826 if (bad && !complain)
827 return true;
828 continue;
829 }
830 ftype = TREE_TYPE (field)((contains_struct_check ((field), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 830, __FUNCTION__))->typed.type)
;
831 if (!ftype || !TYPE_P (ftype)(tree_code_type[(int) (((enum tree_code) (ftype)->base.code
))] == tcc_type)
|| !COMPLETE_TYPE_P (ftype)(((tree_class_check ((ftype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 831, __FUNCTION__))->type_common.size) != (tree) nullptr
)
)
832 /* A flexible array can't be intialized here, so don't complain
833 that it isn't. */
834 continue;
835 if (is_empty_field (field))
836 /* An empty field doesn't need an initializer. */
837 continue;
838 ftype = strip_array_types (ftype);
839 if (type_has_constexpr_default_constructor (ftype))
840 {
841 /* It's OK to skip a member with a trivial constexpr ctor.
842 A constexpr ctor that isn't trivial should have been
843 added in by now. */
844 gcc_checking_assert (!TYPE_HAS_COMPLEX_DFLT (ftype)((void)(!(!((((tree_class_check ((ftype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 844, __FUNCTION__))->type_with_lang_specific.lang_specific
))->has_complex_dflt) || (global_dc)->diagnostic_count[
(int) (DK_ERROR)] != 0) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 845, __FUNCTION__), 0 : 0))
845 || errorcount != 0)((void)(!(!((((tree_class_check ((ftype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 844, __FUNCTION__))->type_with_lang_specific.lang_specific
))->has_complex_dflt) || (global_dc)->diagnostic_count[
(int) (DK_ERROR)] != 0) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 845, __FUNCTION__), 0 : 0))
;
846 continue;
847 }
848 if (!complain)
849 return true;
850 auto_diagnostic_group d;
851 error ("member %qD must be initialized by mem-initializer "
852 "in %<constexpr%> constructor", field);
853 inform (DECL_SOURCE_LOCATION (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 853, __FUNCTION__))->decl_minimal.locus)
, "declared here");
854 bad = true;
855 }
856 if (field == NULL_TREE(tree) nullptr)
857 break;
858
859 if (ANON_AGGR_TYPE_P (TREE_TYPE (index))((((((enum tree_code) (((contains_struct_check ((index), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 859, __FUNCTION__))->typed.type))->base.code)) == RECORD_TYPE
|| (((enum tree_code) (((contains_struct_check ((index), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 859, __FUNCTION__))->typed.type))->base.code)) == UNION_TYPE
) && ((tree_class_check ((((contains_struct_check ((index
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 859, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 859, __FUNCTION__))->type_common.lang_flag_5)) &&
(((tree_class_check ((((contains_struct_check ((index), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 859, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 859, __FUNCTION__))->type_with_lang_specific.lang_specific
))->anon_aggr)
)
860 {
861 /* Check the anonymous aggregate initializer is valid. */
862 bad |= cx_check_missing_mem_inits
863 (TREE_TYPE (index)((contains_struct_check ((index), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 863, __FUNCTION__))->typed.type)
, CONSTRUCTOR_ELT (body, i)(&(*((tree_check ((body), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 863, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[i
])
->value, complain);
864 if (bad && !complain)
865 return true;
866 }
867 field = DECL_CHAIN (field)(((contains_struct_check (((contains_struct_check ((field), (
TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 867, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 867, __FUNCTION__))->common.chain))
;
868 }
869
870 return bad;
871}
872
873/* We are processing the definition of the constexpr function FUN.
874 Check that its body fulfills the apropriate requirements and
875 enter it in the constexpr function definition table. */
876
877void
878maybe_save_constexpr_fundef (tree fun)
879{
880 if (processing_template_declscope_chain->x_processing_template_decl
881 || cp_function_chain((cfun + 0)->language)->invalid_constexpr
882 || (DECL_CLONED_FUNCTION_P (fun)(((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 882, __FUNCTION__))->decl_minimal.name) && ((!((
tree_not_check2 (((tree_check ((((contains_struct_check ((fun
), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 882, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 882, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 882, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_2)) & ((tree_not_check2 (((tree_check ((((contains_struct_check
((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 882, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 882, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 882, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_1)) && !((((contains_struct_check ((fun), (
TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 882, __FUNCTION__))->decl_minimal.name) == cp_global_trees
[CPTI_CTOR_IDENTIFIER]) || (((contains_struct_check ((fun), (
TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 882, __FUNCTION__))->decl_minimal.name) == cp_global_trees
[CPTI_DTOR_IDENTIFIER])))
&& !DECL_DELETING_DESTRUCTOR_P (fun)(((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 882, __FUNCTION__))->decl_minimal.name) == cp_global_trees
[CPTI_DELETING_DTOR_IDENTIFIER])
))
883 return;
884
885 /* With -fimplicit-constexpr, try to make inlines constexpr. We'll
886 actually set DECL_DECLARED_CONSTEXPR_P below if the checks pass. */
887 bool implicit = false;
888 if (flag_implicit_constexprglobal_options.x_flag_implicit_constexpr)
889 {
890 if (DECL_DELETING_DESTRUCTOR_P (fun)(((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 890, __FUNCTION__))->decl_minimal.name) == cp_global_trees
[CPTI_DELETING_DTOR_IDENTIFIER])
891 && decl_implicit_constexpr_p (DECL_CLONED_FUNCTION (fun)(((contains_struct_check (((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 891, __FUNCTION__, (FUNCTION_DECL)))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 891, __FUNCTION__))->decl_common.lang_specific)->u.fn
.u5.cloned_function)
))
892 /* Don't inherit implicit constexpr from the non-deleting
893 destructor. */
894 DECL_DECLARED_CONSTEXPR_P (fun)((contains_struct_check (((tree_check2 (((((enum tree_code) (
fun)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fun)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 894, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fun)
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 894, __FUNCTION__, (VAR_DECL), (FUNCTION_DECL)))), (TS_DECL_COMMON
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 894, __FUNCTION__))->decl_common.lang_flag_8)
= false;
895
896 if (!DECL_DECLARED_CONSTEXPR_P (fun)((contains_struct_check (((tree_check2 (((((enum tree_code) (
fun)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fun)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 896, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fun)
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 896, __FUNCTION__, (VAR_DECL), (FUNCTION_DECL)))), (TS_DECL_COMMON
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 896, __FUNCTION__))->decl_common.lang_flag_8)
897 && DECL_DECLARED_INLINE_P (fun)((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 897, __FUNCTION__, (FUNCTION_DECL)))->function_decl.declared_inline_flag
)
898 && !lookup_attribute ("noinline", DECL_ATTRIBUTES (fun)((contains_struct_check ((fun), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 898, __FUNCTION__))->decl_common.attributes)
))
899 implicit = true;
900 }
901
902 if (!DECL_DECLARED_CONSTEXPR_P (fun)((contains_struct_check (((tree_check2 (((((enum tree_code) (
fun)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fun)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 902, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fun)
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 902, __FUNCTION__, (VAR_DECL), (FUNCTION_DECL)))), (TS_DECL_COMMON
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 902, __FUNCTION__))->decl_common.lang_flag_8)
&& !implicit)
903 return;
904
905 bool complain = !DECL_GENERATED_P (fun)((((((contains_struct_check ((fun), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 905, __FUNCTION__))->decl_common.lang_specific)->u.base
.use_template) & 1) || (((contains_struct_check ((fun), (
TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 905, __FUNCTION__))->decl_common.lang_specific) &&
(((contains_struct_check ((template_info_decl_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 905, __FUNCTION__)), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 905, __FUNCTION__))->decl_common.lang_specific) ->u.min
.template_info) && !(((contains_struct_check ((fun), (
TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 905, __FUNCTION__))->decl_common.lang_specific)->u.base
.use_template))) || (__extension__ ({ struct lang_decl *lt = (
(contains_struct_check (((((enum tree_code) (fun)->base.code
) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast
<union tree_node *> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 905, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fun)
), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 905, __FUNCTION__))->decl_common.lang_specific); if (!((
(enum tree_code) (fun)->base.code) == FUNCTION_DECL || (((
enum tree_code) (fun)->base.code) == TEMPLATE_DECL &&
((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 905, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) nullptr && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fun)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 905, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base
.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 905, __FUNCTION__); &lt->u.fn; })->defaulted_p))
&& !implicit;
906
907 if (!is_valid_constexpr_fn (fun, complain))
908 return;
909
910 tree massaged = massage_constexpr_body (fun, DECL_SAVED_TREE (fun)((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 910, __FUNCTION__, (FUNCTION_DECL)))->function_decl.saved_tree
)
);
911 if (massaged == NULL_TREE(tree) nullptr || massaged == error_mark_nodeglobal_trees[TI_ERROR_MARK])
912 {
913 if (!DECL_CONSTRUCTOR_P (fun)((tree_check (((((enum tree_code) (fun)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 913, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fun)
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 913, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
&& complain)
914 error ("body of %<constexpr%> function %qD not a return-statement",
915 fun);
916 return;
917 }
918
919 bool potential = potential_rvalue_constant_expression (massaged);
920 if (!potential && complain)
921 require_potential_rvalue_constant_expression (massaged);
922
923 if (DECL_CONSTRUCTOR_P (fun)((tree_check (((((enum tree_code) (fun)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 923, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fun)
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 923, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
&& potential)
924 {
925 if (cx_check_missing_mem_inits (DECL_CONTEXT (fun)((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 925, __FUNCTION__))->decl_minimal.context)
,
926 massaged, complain))
927 potential = false;
928 else if (cxx_dialect > cxx11)
929 {
930 /* What we got from massage_constexpr_body is pretty much just the
931 ctor-initializer, also check the body. */
932 massaged = DECL_SAVED_TREE (fun)((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 932, __FUNCTION__, (FUNCTION_DECL)))->function_decl.saved_tree
)
;
933 potential = potential_rvalue_constant_expression (massaged);
934 if (!potential && complain)
935 require_potential_rvalue_constant_expression (massaged);
936 }
937 }
938
939 if (!potential && complain)
940 return;
941
942 if (implicit)
943 {
944 if (potential)
945 {
946 DECL_DECLARED_CONSTEXPR_P (fun)((contains_struct_check (((tree_check2 (((((enum tree_code) (
fun)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fun)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 946, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fun)
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 946, __FUNCTION__, (VAR_DECL), (FUNCTION_DECL)))), (TS_DECL_COMMON
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 946, __FUNCTION__))->decl_common.lang_flag_8)
= true;
947 DECL_LANG_SPECIFIC (fun)((contains_struct_check ((fun), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 947, __FUNCTION__))->decl_common.lang_specific)
->u.fn.implicit_constexpr = true;
948 if (DECL_CONSTRUCTOR_P (fun)((tree_check (((((enum tree_code) (fun)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 948, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fun)
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 948, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
)
949 TYPE_HAS_CONSTEXPR_CTOR (DECL_CONTEXT (fun))((((tree_class_check ((((contains_struct_check ((fun), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 949, __FUNCTION__))->decl_minimal.context)), (tcc_type),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 949, __FUNCTION__))->type_with_lang_specific.lang_specific
))->has_constexpr_ctor)
= true;
950 }
951 else
952 /* Don't bother keeping the pre-generic body of unsuitable functions
953 not explicitly declared constexpr. */
954 return;
955 }
956
957 constexpr_fundef entry = {fun, NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr};
958 bool clear_ctx = false;
959 if (DECL_RESULT (fun)((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 959, __FUNCTION__, (FUNCTION_DECL)))->decl_non_common.result
)
&& DECL_CONTEXT (DECL_RESULT (fun))((contains_struct_check ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 959, __FUNCTION__, (FUNCTION_DECL)))->decl_non_common.result
)), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 959, __FUNCTION__))->decl_minimal.context)
== NULL_TREE(tree) nullptr)
960 {
961 clear_ctx = true;
962 DECL_CONTEXT (DECL_RESULT (fun))((contains_struct_check ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 962, __FUNCTION__, (FUNCTION_DECL)))->decl_non_common.result
)), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 962, __FUNCTION__))->decl_minimal.context)
= fun;
963 }
964 tree saved_fn = current_function_decl;
965 current_function_decl = fun;
966 entry.body = copy_fn (entry.decl, entry.parms, entry.result);
967 current_function_decl = saved_fn;
968 if (clear_ctx)
969 DECL_CONTEXT (DECL_RESULT (entry.decl))((contains_struct_check ((((tree_check ((entry.decl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 969, __FUNCTION__, (FUNCTION_DECL)))->decl_non_common.result
)), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 969, __FUNCTION__))->decl_minimal.context)
= NULL_TREE(tree) nullptr;
970 if (!potential)
971 /* For a template instantiation, we want to remember the pre-generic body
972 for explain_invalid_constexpr_fn, but do tell cxx_eval_call_expression
973 that it doesn't need to bother trying to expand the function. */
974 entry.result = error_mark_nodeglobal_trees[TI_ERROR_MARK];
975
976 register_constexpr_fundef (entry);
977}
978
979/* BODY is a validated and massaged definition of a constexpr
980 function. Register it in the hash table. */
981
982void
983register_constexpr_fundef (const constexpr_fundef &value)
984{
985 /* Create the constexpr function table if necessary. */
986 if (constexpr_fundef_table == NULLnullptr)
987 constexpr_fundef_table
988 = hash_table<constexpr_fundef_hasher>::create_ggc (101);
989
990 constexpr_fundef **slot = constexpr_fundef_table->find_slot
991 (const_cast<constexpr_fundef *> (&value), INSERT);
992
993 gcc_assert (*slot == NULL)((void)(!(*slot == nullptr) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 993, __FUNCTION__), 0 : 0))
;
994 *slot = ggc_alloc<constexpr_fundef> ();
995 **slot = value;
996}
997
998/* FUN is a non-constexpr function called in a context that requires a
999 constant expression. If it comes from a constexpr template, explain why
1000 the instantiation isn't constexpr. */
1001
1002void
1003explain_invalid_constexpr_fn (tree fun)
1004{
1005 static hash_set<tree> *diagnosed;
1006 tree body;
1007 /* Only diagnose defaulted functions, lambdas, or instantiations. */
1008 if (!DECL_DEFAULTED_FN (fun)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (fun)->base.code) == TEMPLATE_DECL ?
((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1008, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fun
)), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1008, __FUNCTION__))->decl_common.lang_specific); if (!(
((enum tree_code) (fun)->base.code) == FUNCTION_DECL || ((
(enum tree_code) (fun)->base.code) == TEMPLATE_DECL &&
((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1008, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) nullptr && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fun)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1008, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1008, __FUNCTION__); &lt->u.fn; })->defaulted_p)
1009 && !LAMBDA_TYPE_P (CP_DECL_CONTEXT (fun))(((enum tree_code) ((!(! (((contains_struct_check ((fun), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->decl_minimal.context)) || ((enum tree_code
) (((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->decl_minimal.context))->base.code
) == TRANSLATION_UNIT_DECL) ? ((contains_struct_check ((fun),
(TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->decl_minimal.context) : cp_global_trees
[CPTI_GLOBAL]))->base.code) == RECORD_TYPE && ((((
tree_class_check ((((tree_class_check (((!(! (((contains_struct_check
((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->decl_minimal.context)) || ((enum tree_code
) (((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->decl_minimal.context))->base.code
) == TRANSLATION_UNIT_DECL) ? ((contains_struct_check ((fun),
(TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->decl_minimal.context) : cp_global_trees
[CPTI_GLOBAL])), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->type_common.name) && (tree_code_type
[(int) (((enum tree_code) (((tree_class_check ((((tree_class_check
(((!(! (((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->decl_minimal.context)) || ((enum tree_code
) (((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->decl_minimal.context))->base.code
) == TRANSLATION_UNIT_DECL) ? ((contains_struct_check ((fun),
(TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->decl_minimal.context) : cp_global_trees
[CPTI_GLOBAL])), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->type_common.name))->base.code))
] == tcc_declaration) ? ((contains_struct_check ((((tree_class_check
((((tree_class_check (((!(! (((contains_struct_check ((fun),
(TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->decl_minimal.context)) || ((enum tree_code
) (((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->decl_minimal.context))->base.code
) == TRANSLATION_UNIT_DECL) ? ((contains_struct_check ((fun),
(TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->decl_minimal.context) : cp_global_trees
[CPTI_GLOBAL])), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->type_common.name)), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->decl_minimal.name) : ((tree_class_check
((((tree_class_check (((!(! (((contains_struct_check ((fun),
(TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->decl_minimal.context)) || ((enum tree_code
) (((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->decl_minimal.context))->base.code
) == TRANSLATION_UNIT_DECL) ? ((contains_struct_check ((fun),
(TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->decl_minimal.context) : cp_global_trees
[CPTI_GLOBAL])), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->type_common.name))) && ((tree_check
((((((tree_class_check ((((tree_class_check (((!(! (((contains_struct_check
((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->decl_minimal.context)) || ((enum tree_code
) (((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->decl_minimal.context))->base.code
) == TRANSLATION_UNIT_DECL) ? ((contains_struct_check ((fun),
(TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->decl_minimal.context) : cp_global_trees
[CPTI_GLOBAL])), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->type_common.name) && (tree_code_type
[(int) (((enum tree_code) (((tree_class_check ((((tree_class_check
(((!(! (((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->decl_minimal.context)) || ((enum tree_code
) (((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->decl_minimal.context))->base.code
) == TRANSLATION_UNIT_DECL) ? ((contains_struct_check ((fun),
(TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->decl_minimal.context) : cp_global_trees
[CPTI_GLOBAL])), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->type_common.name))->base.code))
] == tcc_declaration) ? ((contains_struct_check ((((tree_class_check
((((tree_class_check (((!(! (((contains_struct_check ((fun),
(TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->decl_minimal.context)) || ((enum tree_code
) (((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->decl_minimal.context))->base.code
) == TRANSLATION_UNIT_DECL) ? ((contains_struct_check ((fun),
(TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->decl_minimal.context) : cp_global_trees
[CPTI_GLOBAL])), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->type_common.name)), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->decl_minimal.name) : ((tree_class_check
((((tree_class_check (((!(! (((contains_struct_check ((fun),
(TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->decl_minimal.context)) || ((enum tree_code
) (((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->decl_minimal.context))->base.code
) == TRANSLATION_UNIT_DECL) ? ((contains_struct_check ((fun),
(TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->decl_minimal.context) : cp_global_trees
[CPTI_GLOBAL])), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__))->type_common.name)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1009, __FUNCTION__, (IDENTIFIER_NODE)))->base.protected_flag
))
1010 && !is_instantiation_of_constexpr (fun))
1011 {
1012 inform (DECL_SOURCE_LOCATION (fun)((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1012, __FUNCTION__))->decl_minimal.locus)
, "%qD declared here", fun);
1013 return;
1014 }
1015 if (diagnosed == NULLnullptr)
1016 diagnosed = new hash_set<tree>;
1017 if (diagnosed->add (fun))
1018 /* Already explained. */
1019 return;
1020
1021 iloc_sentinel ils = input_location;
1022 if (!lambda_static_thunk_p (fun))
1023 {
1024 /* Diagnostics should completely ignore the static thunk, so leave
1025 input_location set to our caller's location. */
1026 input_location = DECL_SOURCE_LOCATION (fun)((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1026, __FUNCTION__))->decl_minimal.locus)
;
1027 inform (input_location,
1028 "%qD is not usable as a %<constexpr%> function because:", fun);
1029 }
1030 /* First check the declaration. */
1031 if (is_valid_constexpr_fn (fun, true))
1032 {
1033 /* Then if it's OK, the body. */
1034 if (!DECL_DECLARED_CONSTEXPR_P (fun)((contains_struct_check (((tree_check2 (((((enum tree_code) (
fun)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fun)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1034, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fun
)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1034, __FUNCTION__, (VAR_DECL), (FUNCTION_DECL)))), (TS_DECL_COMMON
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1034, __FUNCTION__))->decl_common.lang_flag_8)
1035 && DECL_DEFAULTED_FN (fun)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (fun)->base.code) == TEMPLATE_DECL ?
((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1035, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fun
)), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1035, __FUNCTION__))->decl_common.lang_specific); if (!(
((enum tree_code) (fun)->base.code) == FUNCTION_DECL || ((
(enum tree_code) (fun)->base.code) == TEMPLATE_DECL &&
((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1035, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) nullptr && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fun)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1035, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1035, __FUNCTION__); &lt->u.fn; })->defaulted_p)
)
1036 explain_implicit_non_constexpr (fun);
1037 else
1038 {
1039 if (constexpr_fundef *fd = retrieve_constexpr_fundef (fun))
1040 body = fd->body;
1041 else
1042 body = DECL_SAVED_TREE (fun)((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1042, __FUNCTION__, (FUNCTION_DECL)))->function_decl.saved_tree
)
;
1043 body = massage_constexpr_body (fun, body);
1044 require_potential_rvalue_constant_expression (body);
1045 if (DECL_CONSTRUCTOR_P (fun)((tree_check (((((enum tree_code) (fun)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1045, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fun
)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1045, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
)
1046 cx_check_missing_mem_inits (DECL_CONTEXT (fun)((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1046, __FUNCTION__))->decl_minimal.context)
, body, true);
1047 }
1048 }
1049}
1050
1051/* Objects of this type represent calls to constexpr functions
1052 along with the bindings of parameters to their arguments, for
1053 the purpose of compile time evaluation. */
1054
1055struct GTY((for_user)) constexpr_call {
1056 /* Description of the constexpr function definition. */
1057 constexpr_fundef *fundef;
1058 /* Parameter bindings environment. A TREE_VEC of arguments. */
1059 tree bindings;
1060 /* Result of the call.
1061 NULL means the call is being evaluated.
1062 error_mark_node means that the evaluation was erroneous;
1063 otherwise, the actuall value of the call. */
1064 tree result;
1065 /* The hash of this call; we remember it here to avoid having to
1066 recalculate it when expanding the hash table. */
1067 hashval_t hash;
1068 /* Whether __builtin_is_constant_evaluated() should evaluate to true. */
1069 bool manifestly_const_eval;
1070};
1071
1072struct constexpr_call_hasher : ggc_ptr_hash<constexpr_call>
1073{
1074 static hashval_t hash (constexpr_call *);
1075 static bool equal (constexpr_call *, constexpr_call *);
1076};
1077
1078enum constexpr_switch_state {
1079 /* Used when processing a switch for the first time by cxx_eval_switch_expr
1080 and default: label for that switch has not been seen yet. */
1081 css_default_not_seen,
1082 /* Used when processing a switch for the first time by cxx_eval_switch_expr
1083 and default: label for that switch has been seen already. */
1084 css_default_seen,
1085 /* Used when processing a switch for the second time by
1086 cxx_eval_switch_expr, where default: label should match. */
1087 css_default_processing
1088};
1089
1090/* The constexpr expansion context part which needs one instance per
1091 cxx_eval_outermost_constant_expr invocation. VALUES is a map of values of
1092 variables initialized within the expression. */
1093
1094struct constexpr_global_ctx {
1095 /* Values for any temporaries or local variables within the
1096 constant-expression. */
1097 hash_map<tree,tree> values;
1098 /* Number of cxx_eval_constant_expression calls (except skipped ones,
1099 on simple constants or location wrappers) encountered during current
1100 cxx_eval_outermost_constant_expr call. */
1101 HOST_WIDE_INTlong constexpr_ops_count;
1102 /* Heap VAR_DECLs created during the evaluation of the outermost constant
1103 expression. */
1104 auto_vec<tree, 16> heap_vars;
1105 /* Cleanups that need to be evaluated at the end of CLEANUP_POINT_EXPR. */
1106 vec<tree> *cleanups;
1107 /* Number of heap VAR_DECL deallocations. */
1108 unsigned heap_dealloc_count;
1109 /* Constructor. */
1110 constexpr_global_ctx ()
1111 : constexpr_ops_count (0), cleanups (NULLnullptr), heap_dealloc_count (0) {}
1112};
1113
1114/* The constexpr expansion context. CALL is the current function
1115 expansion, CTOR is the current aggregate initializer, OBJECT is the
1116 object being initialized by CTOR, either a VAR_DECL or a _REF. */
1117
1118struct constexpr_ctx {
1119 /* The part of the context that needs to be unique to the whole
1120 cxx_eval_outermost_constant_expr invocation. */
1121 constexpr_global_ctx *global;
1122 /* The innermost call we're evaluating. */
1123 constexpr_call *call;
1124 /* SAVE_EXPRs and TARGET_EXPR_SLOT vars of TARGET_EXPRs that we've seen
1125 within the current LOOP_EXPR. NULL if we aren't inside a loop. */
1126 vec<tree> *save_exprs;
1127 /* The CONSTRUCTOR we're currently building up for an aggregate
1128 initializer. */
1129 tree ctor;
1130 /* The object we're building the CONSTRUCTOR for. */
1131 tree object;
1132 /* If inside SWITCH_EXPR. */
1133 constexpr_switch_state *css_state;
1134 /* The aggregate initialization context inside which this one is nested. This
1135 is used by lookup_placeholder to resolve PLACEHOLDER_EXPRs. */
1136 const constexpr_ctx *parent;
1137
1138 /* Whether we should error on a non-constant expression or fail quietly.
1139 This flag needs to be here, but some of the others could move to global
1140 if they get larger than a word. */
1141 bool quiet;
1142 /* Whether we are strictly conforming to constant expression rules or
1143 trying harder to get a constant value. */
1144 bool strict;
1145 /* Whether __builtin_is_constant_evaluated () should be true. */
1146 bool manifestly_const_eval;
1147};
1148
1149/* This internal flag controls whether we should avoid doing anything during
1150 constexpr evaluation that would cause extra DECL_UID generation, such as
1151 template instantiation and function body copying. */
1152
1153static bool uid_sensitive_constexpr_evaluation_value;
1154
1155/* An internal counter that keeps track of the number of times
1156 uid_sensitive_constexpr_evaluation_p returned true. */
1157
1158static unsigned uid_sensitive_constexpr_evaluation_true_counter;
1159
1160/* The accessor for uid_sensitive_constexpr_evaluation_value which also
1161 increments the corresponding counter. */
1162
1163static bool
1164uid_sensitive_constexpr_evaluation_p ()
1165{
1166 if (uid_sensitive_constexpr_evaluation_value)
1167 {
1168 ++uid_sensitive_constexpr_evaluation_true_counter;
1169 return true;
1170 }
1171 else
1172 return false;
1173}
1174
1175/* The default constructor for uid_sensitive_constexpr_evaluation_sentinel
1176 enables the internal flag for uid_sensitive_constexpr_evaluation_p
1177 during the lifetime of the sentinel object. Upon its destruction, the
1178 previous value of uid_sensitive_constexpr_evaluation_p is restored. */
1179
1180uid_sensitive_constexpr_evaluation_sentinel
1181::uid_sensitive_constexpr_evaluation_sentinel ()
1182 : ovr (uid_sensitive_constexpr_evaluation_value, true)
1183{
1184}
1185
1186/* The default constructor for uid_sensitive_constexpr_evaluation_checker
1187 records the current number of times that uid_sensitive_constexpr_evaluation_p
1188 has been called and returned true. */
1189
1190uid_sensitive_constexpr_evaluation_checker
1191::uid_sensitive_constexpr_evaluation_checker ()
1192 : saved_counter (uid_sensitive_constexpr_evaluation_true_counter)
1193{
1194}
1195
1196/* Returns true iff uid_sensitive_constexpr_evaluation_p is true, and
1197 some constexpr evaluation was restricted due to u_s_c_e_p being called
1198 and returning true during the lifetime of this checker object. */
1199
1200bool
1201uid_sensitive_constexpr_evaluation_checker::evaluation_restricted_p () const
1202{
1203 return (uid_sensitive_constexpr_evaluation_value
1204 && saved_counter != uid_sensitive_constexpr_evaluation_true_counter);
1205}
1206
1207
1208/* A table of all constexpr calls that have been evaluated by the
1209 compiler in this translation unit. */
1210
1211static GTY (()) hash_table<constexpr_call_hasher> *constexpr_call_table;
1212
1213static tree cxx_eval_constant_expression (const constexpr_ctx *, tree,
1214 bool, bool *, bool *, tree * = NULLnullptr);
1215
1216/* Compute a hash value for a constexpr call representation. */
1217
1218inline hashval_t
1219constexpr_call_hasher::hash (constexpr_call *info)
1220{
1221 return info->hash;
1222}
1223
1224/* Return true if the objects pointed to by P and Q represent calls
1225 to the same constexpr function with the same arguments.
1226 Otherwise, return false. */
1227
1228bool
1229constexpr_call_hasher::equal (constexpr_call *lhs, constexpr_call *rhs)
1230{
1231 if (lhs == rhs)
1232 return true;
1233 if (lhs->hash != rhs->hash)
1234 return false;
1235 if (lhs->manifestly_const_eval != rhs->manifestly_const_eval)
1236 return false;
1237 if (!constexpr_fundef_hasher::equal (lhs->fundef, rhs->fundef))
1238 return false;
1239 return cp_tree_equal (lhs->bindings, rhs->bindings);
1240}
1241
1242/* Initialize the constexpr call table, if needed. */
1243
1244static void
1245maybe_initialize_constexpr_call_table (void)
1246{
1247 if (constexpr_call_table == NULLnullptr)
1248 constexpr_call_table = hash_table<constexpr_call_hasher>::create_ggc (101);
1249}
1250
1251/* During constexpr CALL_EXPR evaluation, to avoid issues with sharing when
1252 a function happens to get called recursively, we unshare the callee
1253 function's body and evaluate this unshared copy instead of evaluating the
1254 original body.
1255
1256 FUNDEF_COPIES_TABLE is a per-function freelist of these unshared function
1257 copies. The underlying data structure of FUNDEF_COPIES_TABLE is a hash_map
1258 that's keyed off of the original FUNCTION_DECL and whose value is a
1259 TREE_LIST of this function's unused copies awaiting reuse.
1260
1261 This is not GC-deletable to avoid GC affecting UID generation. */
1262
1263static GTY(()) decl_tree_map *fundef_copies_table;
1264
1265/* Reuse a copy or create a new unshared copy of the function FUN.
1266 Return this copy. We use a TREE_LIST whose PURPOSE is body, VALUE
1267 is parms, TYPE is result. */
1268
1269static tree
1270get_fundef_copy (constexpr_fundef *fundef)
1271{
1272 tree copy;
1273 bool existed;
1274 tree *slot = &(hash_map_safe_get_or_insert<hm_ggc>
1275 (fundef_copies_table, fundef->decl, &existed, 127));
1276
1277 if (!existed)
1278 {
1279 /* There is no cached function available, or in use. We can use
1280 the function directly. That the slot is now created records
1281 that this function is now in use. */
1282 copy = build_tree_list (fundef->body, fundef->parms);
1283 TREE_TYPE (copy)((contains_struct_check ((copy), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1283, __FUNCTION__))->typed.type)
= fundef->result;
1284 }
1285 else if (*slot == NULL_TREE(tree) nullptr)
1286 {
1287 if (uid_sensitive_constexpr_evaluation_p ())
1288 return NULL_TREE(tree) nullptr;
1289
1290 /* We've already used the function itself, so make a copy. */
1291 copy = build_tree_list (NULLnullptr, NULLnullptr);
1292 tree saved_body = DECL_SAVED_TREE (fundef->decl)((tree_check ((fundef->decl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1292, __FUNCTION__, (FUNCTION_DECL)))->function_decl.saved_tree
)
;
1293 tree saved_parms = DECL_ARGUMENTS (fundef->decl)((tree_check ((fundef->decl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1293, __FUNCTION__, (FUNCTION_DECL)))->function_decl.arguments
)
;
1294 tree saved_result = DECL_RESULT (fundef->decl)((tree_check ((fundef->decl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1294, __FUNCTION__, (FUNCTION_DECL)))->decl_non_common.result
)
;
1295 tree saved_fn = current_function_decl;
1296 DECL_SAVED_TREE (fundef->decl)((tree_check ((fundef->decl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1296, __FUNCTION__, (FUNCTION_DECL)))->function_decl.saved_tree
)
= fundef->body;
1297 DECL_ARGUMENTS (fundef->decl)((tree_check ((fundef->decl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1297, __FUNCTION__, (FUNCTION_DECL)))->function_decl.arguments
)
= fundef->parms;
1298 DECL_RESULT (fundef->decl)((tree_check ((fundef->decl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1298, __FUNCTION__, (FUNCTION_DECL)))->decl_non_common.result
)
= fundef->result;
1299 current_function_decl = fundef->decl;
1300 TREE_PURPOSE (copy)((tree_check ((copy), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1300, __FUNCTION__, (TREE_LIST)))->list.purpose)
= copy_fn (fundef->decl, TREE_VALUE (copy)((tree_check ((copy), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1300, __FUNCTION__, (TREE_LIST)))->list.value)
,
1301 TREE_TYPE (copy)((contains_struct_check ((copy), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1301, __FUNCTION__))->typed.type)
);
1302 current_function_decl = saved_fn;
1303 DECL_RESULT (fundef->decl)((tree_check ((fundef->decl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1303, __FUNCTION__, (FUNCTION_DECL)))->decl_non_common.result
)
= saved_result;
1304 DECL_ARGUMENTS (fundef->decl)((tree_check ((fundef->decl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1304, __FUNCTION__, (FUNCTION_DECL)))->function_decl.arguments
)
= saved_parms;
1305 DECL_SAVED_TREE (fundef->decl)((tree_check ((fundef->decl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1305, __FUNCTION__, (FUNCTION_DECL)))->function_decl.saved_tree
)
= saved_body;
1306 }
1307 else
1308 {
1309 /* We have a cached function available. */
1310 copy = *slot;
1311 *slot = TREE_CHAIN (copy)((contains_struct_check ((copy), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1311, __FUNCTION__))->common.chain)
;
1312 }
1313
1314 return copy;
1315}
1316
1317/* Save the copy COPY of function FUN for later reuse by
1318 get_fundef_copy(). By construction, there will always be an entry
1319 to find. */
1320
1321static void
1322save_fundef_copy (tree fun, tree copy)
1323{
1324 tree *slot = fundef_copies_table->get (fun);
1325 TREE_CHAIN (copy)((contains_struct_check ((copy), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1325, __FUNCTION__))->common.chain)
= *slot;
1326 *slot = copy;
1327}
1328
1329/* We have an expression tree T that represents a call, either CALL_EXPR
1330 or AGGR_INIT_EXPR. Return the Nth argument. */
1331
1332static inline tree
1333get_nth_callarg (tree t, int n)
1334{
1335 switch (TREE_CODE (t)((enum tree_code) (t)->base.code))
1336 {
1337 case CALL_EXPR:
1338 return CALL_EXPR_ARG (t, n)(*((const_cast<tree*> (tree_operand_check (((tree_check
((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1338, __FUNCTION__, (CALL_EXPR)))), ((n) + 3), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1338, __FUNCTION__)))))
;
1339
1340 case AGGR_INIT_EXPR:
1341 return AGGR_INIT_EXPR_ARG (t, n)(*((const_cast<tree*> (tree_operand_check (((tree_check
((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1341, __FUNCTION__, (AGGR_INIT_EXPR)))), ((n) + 3), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1341, __FUNCTION__)))))
;
1342
1343 default:
1344 gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1344, __FUNCTION__))
;
1345 return NULLnullptr;
1346 }
1347}
1348
1349/* Attempt to evaluate T which represents a call to a builtin function.
1350 We assume here that all builtin functions evaluate to scalar types
1351 represented by _CST nodes. */
1352
1353static tree
1354cxx_eval_builtin_function_call (const constexpr_ctx *ctx, tree t, tree fun,
1355 bool lval,
1356 bool *non_constant_p, bool *overflow_p)
1357{
1358 const int nargs = call_expr_nargs (t)(((int)((unsigned long) (*tree_int_cst_elt_check (((tree_class_check
((t), (tcc_vl_exp), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1358, __FUNCTION__))->exp.operands[0]), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1358, __FUNCTION__)))) - 3)
;
1359 tree *args = (tree *) alloca (nargs * sizeof (tree))__builtin_alloca(nargs * sizeof (tree));
1360 tree new_call;
1361 int i;
1362
1363 /* Don't fold __builtin_constant_p within a constexpr function. */
1364 bool bi_const_p = DECL_IS_BUILTIN_CONSTANT_P (fun)(((enum tree_code) (fun)->base.code) == FUNCTION_DECL &&
((built_in_class) (tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1364, __FUNCTION__, (FUNCTION_DECL)))->function_decl.built_in_class
) == BUILT_IN_NORMAL && DECL_FUNCTION_CODE (fun) == BUILT_IN_CONSTANT_P
)
;
1365
1366 /* If we aren't requiring a constant expression, defer __builtin_constant_p
1367 in a constexpr function until we have values for the parameters. */
1368 if (bi_const_p
1369 && !ctx->manifestly_const_eval
1370 && current_function_decl
1371 && DECL_DECLARED_CONSTEXPR_P (current_function_decl)((contains_struct_check (((tree_check2 (((((enum tree_code) (
current_function_decl)->base.code) == TEMPLATE_DECL ? ((struct
tree_template_decl *)(const_cast<union tree_node *> ((
((tree_check ((current_function_decl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1371, __FUNCTION__, (TEMPLATE_DECL))))))))->result : current_function_decl
)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1371, __FUNCTION__, (VAR_DECL), (FUNCTION_DECL)))), (TS_DECL_COMMON
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1371, __FUNCTION__))->decl_common.lang_flag_8)
)
1372 {
1373 *non_constant_p = true;
1374 return t;
1375 }
1376
1377 /* For __builtin_is_constant_evaluated, defer it if not
1378 ctx->manifestly_const_eval (as sometimes we try to constant evaluate
1379 without manifestly_const_eval even expressions or parts thereof which
1380 will later be manifestly const_eval evaluated), otherwise fold it to
1381 true. */
1382 if (fndecl_built_in_p (fun, CP_BUILT_IN_IS_CONSTANT_EVALUATED,
1383 BUILT_IN_FRONTEND))
1384 {
1385 if (!ctx->manifestly_const_eval)
1386 {
1387 *non_constant_p = true;
1388 return t;
1389 }
1390 return boolean_true_nodeglobal_trees[TI_BOOLEAN_TRUE];
1391 }
1392
1393 if (fndecl_built_in_p (fun, CP_BUILT_IN_SOURCE_LOCATION, BUILT_IN_FRONTEND))
1394 {
1395 temp_override<tree> ovr (current_function_decl);
1396 if (ctx->call && ctx->call->fundef)
1397 current_function_decl = ctx->call->fundef->decl;
1398 return fold_builtin_source_location (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))
);
1399 }
1400
1401 int strops = 0;
1402 int strret = 0;
1403 if (fndecl_built_in_p (fun, BUILT_IN_NORMAL))
1404 switch (DECL_FUNCTION_CODE (fun))
1405 {
1406 case BUILT_IN_STRLEN:
1407 case BUILT_IN_STRNLEN:
1408 strops = 1;
1409 break;
1410 case BUILT_IN_MEMCHR:
1411 case BUILT_IN_STRCHR:
1412 case BUILT_IN_STRRCHR:
1413 strops = 1;
1414 strret = 1;
1415 break;
1416 case BUILT_IN_MEMCMP:
1417 case BUILT_IN_STRCMP:
1418 strops = 2;
1419 break;
1420 case BUILT_IN_STRSTR:
1421 strops = 2;
1422 strret = 1;
1423 break;
1424 case BUILT_IN_ASAN_POINTER_COMPARE:
1425 case BUILT_IN_ASAN_POINTER_SUBTRACT:
1426 /* These builtins shall be ignored during constant expression
1427 evaluation. */
1428 return void_nodeglobal_trees[TI_VOID];
1429 default:
1430 break;
1431 }
1432
1433 /* Be permissive for arguments to built-ins; __builtin_constant_p should
1434 return constant false for a non-constant argument. */
1435 constexpr_ctx new_ctx = *ctx;
1436 new_ctx.quiet = true;
1437 for (i = 0; i < nargs; ++i)
1438 {
1439 tree arg = CALL_EXPR_ARG (t, i)(*((const_cast<tree*> (tree_operand_check (((tree_check
((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1439, __FUNCTION__, (CALL_EXPR)))), ((i) + 3), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1439, __FUNCTION__)))))
;
1440 tree oarg = arg;
1441
1442 /* To handle string built-ins we need to pass ADDR_EXPR<STRING_CST> since
1443 expand_builtin doesn't know how to look in the values table. */
1444 bool strop = i < strops;
1445 if (strop)
1446 {
1447 STRIP_NOPS (arg)(arg) = tree_strip_nop_conversions ((const_cast<union tree_node
*> (((arg)))))
;
1448 if (TREE_CODE (arg)((enum tree_code) (arg)->base.code) == ADDR_EXPR)
1449 arg = TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1449, __FUNCTION__)))))
;
1450 else
1451 strop = false;
1452 }
1453
1454 /* If builtin_valid_in_constant_expr_p is true,
1455 potential_constant_expression_1 has not recursed into the arguments
1456 of the builtin, verify it here. */
1457 if (!builtin_valid_in_constant_expr_p (fun)
1458 || potential_constant_expression (arg))
1459 {
1460 bool dummy1 = false, dummy2 = false;
1461 arg = cxx_eval_constant_expression (&new_ctx, arg, false,
1462 &dummy1, &dummy2);
1463 }
1464
1465 if (bi_const_p)
1466 /* For __builtin_constant_p, fold all expressions with constant values
1467 even if they aren't C++ constant-expressions. */
1468 arg = cp_fold_rvalue (arg);
1469 else if (strop)
1470 {
1471 if (TREE_CODE (arg)((enum tree_code) (arg)->base.code) == CONSTRUCTOR)
1472 arg = braced_lists_to_strings (TREE_TYPE (arg)((contains_struct_check ((arg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1472, __FUNCTION__))->typed.type)
, arg);
1473 if (TREE_CODE (arg)((enum tree_code) (arg)->base.code) == STRING_CST)
1474 arg = build_address (arg);
1475 else
1476 arg = oarg;
1477 }
1478
1479 args[i] = arg;
1480 }
1481
1482 bool save_ffbcp = force_folding_builtin_constant_p;
1483 force_folding_builtin_constant_p |= ctx->manifestly_const_eval;
1484 tree save_cur_fn = current_function_decl;
1485 /* Return name of ctx->call->fundef->decl for __builtin_FUNCTION (). */
1486 if (fndecl_built_in_p (fun, BUILT_IN_FUNCTION)
1487 && ctx->call
1488 && ctx->call->fundef)
1489 current_function_decl = ctx->call->fundef->decl;
1490 if (fndecl_built_in_p (fun,
1491 CP_BUILT_IN_IS_POINTER_INTERCONVERTIBLE_WITH_CLASS,
1492 BUILT_IN_FRONTEND))
1493 {
1494 location_t 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))
;
1495 if (nargs >= 1)
1496 VERIFY_CONSTANT (args[0])do { if (verify_constant ((args[0]), ctx->quiet, non_constant_p
, overflow_p)) return t; } while (0)
;
1497 new_call
1498 = fold_builtin_is_pointer_inverconvertible_with_class (loc, nargs,
1499 args);
1500 }
1501 else if (fndecl_built_in_p (fun,
1502 CP_BUILT_IN_IS_CORRESPONDING_MEMBER,
1503 BUILT_IN_FRONTEND))
1504 {
1505 location_t 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))
;
1506 if (nargs >= 2)
1507 {
1508 VERIFY_CONSTANT (args[0])do { if (verify_constant ((args[0]), ctx->quiet, non_constant_p
, overflow_p)) return t; } while (0)
;
1509 VERIFY_CONSTANT (args[1])do { if (verify_constant ((args[1]), ctx->quiet, non_constant_p
, overflow_p)) return t; } while (0)
;
1510 }
1511 new_call = fold_builtin_is_corresponding_member (loc, nargs, args);
1512 }
1513 else
1514 new_call = fold_builtin_call_array (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))
, TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1514, __FUNCTION__))->typed.type)
,
1515 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/cp/constexpr.c"
, 1515, __FUNCTION__, (CALL_EXPR)))), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1515, __FUNCTION__)))))
, nargs, args);
1516 current_function_decl = save_cur_fn;
1517 force_folding_builtin_constant_p = save_ffbcp;
1518 if (new_call == NULLnullptr)
1519 {
1520 if (!*non_constant_p && !ctx->quiet)
1521 {
1522 /* Do not allow__builtin_unreachable in constexpr function.
1523 The __builtin_unreachable call with BUILTINS_LOCATION
1524 comes from cp_maybe_instrument_return. */
1525 if (fndecl_built_in_p (fun, BUILT_IN_UNREACHABLE)
1526 && 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))
== BUILTINS_LOCATION((location_t) 1))
1527 error ("%<constexpr%> call flows off the end of the function");
1528 else
1529 {
1530 new_call = build_call_array_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))
, TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1530, __FUNCTION__))->typed.type)
,
1531 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/cp/constexpr.c"
, 1531, __FUNCTION__, (CALL_EXPR)))), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1531, __FUNCTION__)))))
, nargs, args);
1532 error ("%q+E is not a constant expression", new_call);
1533 }
1534 }
1535 *non_constant_p = true;
1536 return t;
1537 }
1538
1539 if (!potential_constant_expression (new_call))
1540 {
1541 if (!*non_constant_p && !ctx->quiet)
1542 error ("%q+E is not a constant expression", new_call);
1543 *non_constant_p = true;
1544 return t;
1545 }
1546
1547 if (strret)
1548 {
1549 /* memchr returns a pointer into the first argument, but we replaced the
1550 argument above with a STRING_CST; put it back it now. */
1551 tree op = CALL_EXPR_ARG (t, strret-1)(*((const_cast<tree*> (tree_operand_check (((tree_check
((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1551, __FUNCTION__, (CALL_EXPR)))), ((strret-1) + 3), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1551, __FUNCTION__)))))
;
1552 STRIP_NOPS (new_call)(new_call) = tree_strip_nop_conversions ((const_cast<union
tree_node *> (((new_call)))))
;
1553 if (TREE_CODE (new_call)((enum tree_code) (new_call)->base.code) == POINTER_PLUS_EXPR)
1554 TREE_OPERAND (new_call, 0)(*((const_cast<tree*> (tree_operand_check ((new_call), (
0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1554, __FUNCTION__)))))
= op;
1555 else if (TREE_CODE (new_call)((enum tree_code) (new_call)->base.code) == ADDR_EXPR)
1556 new_call = op;
1557 }
1558
1559 return cxx_eval_constant_expression (&new_ctx, new_call, lval,
1560 non_constant_p, overflow_p);
1561}
1562
1563/* TEMP is the constant value of a temporary object of type TYPE. Adjust
1564 the type of the value to match. */
1565
1566static tree
1567adjust_temp_type (tree type, tree temp)
1568{
1569 if (same_type_p (TREE_TYPE (temp), type)comptypes ((((contains_struct_check ((temp), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1569, __FUNCTION__))->typed.type)), (type), 0)
)
1570 return temp;
1571 /* Avoid wrapping an aggregate value in a NOP_EXPR. */
1572 if (TREE_CODE (temp)((enum tree_code) (temp)->base.code) == CONSTRUCTOR)
1573 {
1574 /* build_constructor wouldn't retain various CONSTRUCTOR flags. */
1575 tree t = copy_node (temp);
1576 TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1576, __FUNCTION__))->typed.type)
= type;
1577 return t;
1578 }
1579 if (TREE_CODE (temp)((enum tree_code) (temp)->base.code) == EMPTY_CLASS_EXPR)
1580 return build0 (EMPTY_CLASS_EXPR, type);
1581 gcc_assert (scalarish_type_p (type))((void)(!(scalarish_type_p (type)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1581, __FUNCTION__), 0 : 0))
;
1582 /* Now we know we're dealing with a scalar, and a prvalue of non-class
1583 type is cv-unqualified. */
1584 return cp_fold_convert (cv_unqualified (type), temp);
1585}
1586
1587/* If T is a CONSTRUCTOR, return an unshared copy of T and any
1588 sub-CONSTRUCTORs. Otherwise return T.
1589
1590 We use this whenever we initialize an object as a whole, whether it's a
1591 parameter, a local variable, or a subobject, so that subsequent
1592 modifications don't affect other places where it was used. */
1593
1594tree
1595unshare_constructor (tree t MEM_STAT_DECL)
1596{
1597 if (!t || TREE_CODE (t)((enum tree_code) (t)->base.code) != CONSTRUCTOR)
1598 return t;
1599 auto_vec <tree*, 4> ptrs;
1600 ptrs.safe_push (&t);
1601 while (!ptrs.is_empty ())
1602 {
1603 tree *p = ptrs.pop ();
1604 tree n = copy_node (*p PASS_MEM_STAT);
1605 CONSTRUCTOR_ELTS (n)((tree_check ((n), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1605, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
= vec_safe_copy (CONSTRUCTOR_ELTS (*p)((tree_check ((*p), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1605, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
PASS_MEM_STAT);
1606 *p = n;
1607 vec<constructor_elt, va_gc> *v = CONSTRUCTOR_ELTS (n)((tree_check ((n), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1607, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
;
1608 constructor_elt *ce;
1609 for (HOST_WIDE_INTlong i = 0; vec_safe_iterate (v, i, &ce); ++i)
1610 if (ce->value && TREE_CODE (ce->value)((enum tree_code) (ce->value)->base.code) == CONSTRUCTOR)
1611 ptrs.safe_push (&ce->value);
1612 }
1613 return t;
1614}
1615
1616/* If T is a CONSTRUCTOR, ggc_free T and any sub-CONSTRUCTORs. */
1617
1618static void
1619free_constructor (tree t)
1620{
1621 if (!t || TREE_CODE (t)((enum tree_code) (t)->base.code) != CONSTRUCTOR)
1622 return;
1623 releasing_vec ctors;
1624 vec_safe_push (ctors, t);
1625 while (!ctors->is_empty ())
1626 {
1627 tree c = ctors->pop ();
1628 if (vec<constructor_elt, va_gc> *elts = CONSTRUCTOR_ELTS (c)((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1628, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
)
1629 {
1630 constructor_elt *ce;
1631 for (HOST_WIDE_INTlong i = 0; vec_safe_iterate (elts, i, &ce); ++i)
1632 if (TREE_CODE (ce->value)((enum tree_code) (ce->value)->base.code) == CONSTRUCTOR)
1633 vec_safe_push (ctors, ce->value);
1634 ggc_free (elts);
1635 }
1636 ggc_free (c);
1637 }
1638}
1639
1640/* Helper function of cxx_bind_parameters_in_call. Return non-NULL
1641 if *TP is address of a static variable (or part of it) currently being
1642 constructed or of a heap artificial variable. */
1643
1644static tree
1645addr_of_non_const_var (tree *tp, int *walk_subtrees, void *data)
1646{
1647 if (TREE_CODE (*tp)((enum tree_code) (*tp)->base.code) == ADDR_EXPR)
1648 if (tree var = get_base_address (TREE_OPERAND (*tp, 0)(*((const_cast<tree*> (tree_operand_check ((*tp), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1648, __FUNCTION__)))))
))
1649 if (VAR_P (var)(((enum tree_code) (var)->base.code) == VAR_DECL) && TREE_STATIC (var)((var)->base.static_flag))
1650 {
1651 if (DECL_NAME (var)((contains_struct_check ((var), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1651, __FUNCTION__))->decl_minimal.name)
== heap_uninit_identifiercp_global_trees[CPTI_HEAP_UNINIT_IDENTIFIER]
1652 || DECL_NAME (var)((contains_struct_check ((var), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1652, __FUNCTION__))->decl_minimal.name)
== heap_identifiercp_global_trees[CPTI_HEAP_IDENTIFIER]
1653 || DECL_NAME (var)((contains_struct_check ((var), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1653, __FUNCTION__))->decl_minimal.name)
== heap_vec_uninit_identifiercp_global_trees[CPTI_HEAP_VEC_UNINIT_IDENTIFIER]
1654 || DECL_NAME (var)((contains_struct_check ((var), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1654, __FUNCTION__))->decl_minimal.name)
== heap_vec_identifiercp_global_trees[CPTI_HEAP_VEC_IDENTIFIER])
1655 return var;
1656
1657 constexpr_global_ctx *global = (constexpr_global_ctx *) data;
1658 if (global->values.get (var))
1659 return var;
1660 }
1661 if (TYPE_P (*tp)(tree_code_type[(int) (((enum tree_code) (*tp)->base.code)
)] == tcc_type)
)
1662 *walk_subtrees = false;
1663 return NULL_TREE(tree) nullptr;
1664}
1665
1666/* Subroutine of cxx_eval_call_expression.
1667 We are processing a call expression (either CALL_EXPR or
1668 AGGR_INIT_EXPR) in the context of CTX. Evaluate
1669 all arguments and bind their values to correspondings
1670 parameters, making up the NEW_CALL context. */
1671
1672static tree
1673cxx_bind_parameters_in_call (const constexpr_ctx *ctx, tree t, tree fun,
1674 bool *non_constant_p, bool *overflow_p,
1675 bool *non_constant_args)
1676{
1677 const int nargs = call_expr_nargs (t)(((int)((unsigned long) (*tree_int_cst_elt_check (((tree_class_check
((t), (tcc_vl_exp), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1677, __FUNCTION__))->exp.operands[0]), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1677, __FUNCTION__)))) - 3)
;
1678 tree parms = DECL_ARGUMENTS (fun)((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1678, __FUNCTION__, (FUNCTION_DECL)))->function_decl.arguments
)
;
1679 int i;
1680 /* We don't record ellipsis args below. */
1681 int nparms = list_length (parms);
1682 int nbinds = nargs < nparms ? nargs : nparms;
1683 tree binds = make_tree_vec (nbinds);
1684 for (i = 0; i < nargs; ++i)
1685 {
1686 tree x, arg;
1687 tree type = parms ? TREE_TYPE (parms)((contains_struct_check ((parms), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1687, __FUNCTION__))->typed.type)
: void_type_nodeglobal_trees[TI_VOID_TYPE];
1688 if (parms && DECL_BY_REFERENCE (parms)((tree_check3 ((parms), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1688, __FUNCTION__, (VAR_DECL), (PARM_DECL), (RESULT_DECL))
)->decl_common.decl_by_reference_flag)
)
1689 type = TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1689, __FUNCTION__))->typed.type)
;
1690 x = get_nth_callarg (t, i);
1691 /* For member function, the first argument is a pointer to the implied
1692 object. For a constructor, it might still be a dummy object, in
1693 which case we get the real argument from ctx. */
1694 if (i == 0 && DECL_CONSTRUCTOR_P (fun)((tree_check (((((enum tree_code) (fun)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1694, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fun
)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1694, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
1695 && is_dummy_object (x))
1696 {
1697 x = ctx->object;
1698 x = build_address (x);
1699 }
1700 if (TREE_ADDRESSABLE (type)((type)->base.addressable_flag))
1701 /* Undo convert_for_arg_passing work here. */
1702 x = convert_from_reference (x);
1703 /* Normally we would strip a TARGET_EXPR in an initialization context
1704 such as this, but here we do the elision differently: we keep the
1705 TARGET_EXPR, and use its CONSTRUCTOR as the value of the parm. */
1706 arg = cxx_eval_constant_expression (ctx, x, /*lval=*/false,
1707 non_constant_p, overflow_p);
1708 /* Don't VERIFY_CONSTANT here. */
1709 if (*non_constant_p && ctx->quiet)
1710 break;
1711 /* Just discard ellipsis args after checking their constantitude. */
1712 if (!parms)
1713 continue;
1714
1715 if (!*non_constant_p)
1716 {
1717 /* Make sure the binding has the same type as the parm. But
1718 only for constant args. */
1719 if (!TYPE_REF_P (type)(((enum tree_code) (type)->base.code) == REFERENCE_TYPE))
1720 arg = adjust_temp_type (type, arg);
1721 if (!TREE_CONSTANT (arg)((non_type_check ((arg), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1721, __FUNCTION__))->base.constant_flag)
)
1722 *non_constant_args = true;
1723 else if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)(((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1723, __FUNCTION__))->type_common.lang_flag_4))
)
1724 /* The destructor needs to see any modifications the callee makes
1725 to the argument. */
1726 *non_constant_args = true;
1727 /* If arg is or contains address of a heap artificial variable or
1728 of a static variable being constructed, avoid caching the
1729 function call, as those variables might be modified by the
1730 function, or might be modified by the callers in between
1731 the cached function and just read by the function. */
1732 else if (!*non_constant_args
1733 && cp_walk_tree (&arg, addr_of_non_const_var, ctx->global,walk_tree_1 (&arg, addr_of_non_const_var, ctx->global,
nullptr, cp_walk_subtrees)
1734 NULL)walk_tree_1 (&arg, addr_of_non_const_var, ctx->global,
nullptr, cp_walk_subtrees)
)
1735 *non_constant_args = true;
1736
1737 /* For virtual calls, adjust the this argument, so that it is
1738 the object on which the method is called, rather than
1739 one of its bases. */
1740 if (i == 0 && DECL_VIRTUAL_P (fun)((contains_struct_check ((fun), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1740, __FUNCTION__))->decl_common.virtual_flag)
)
1741 {
1742 tree addr = arg;
1743 STRIP_NOPS (addr)(addr) = tree_strip_nop_conversions ((const_cast<union tree_node
*> (((addr)))))
;
1744 if (TREE_CODE (addr)((enum tree_code) (addr)->base.code) == ADDR_EXPR)
1745 {
1746 tree obj = TREE_OPERAND (addr, 0)(*((const_cast<tree*> (tree_operand_check ((addr), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1746, __FUNCTION__)))))
;
1747 while (TREE_CODE (obj)((enum tree_code) (obj)->base.code) == COMPONENT_REF
1748 && DECL_FIELD_IS_BASE (TREE_OPERAND (obj, 1))((contains_struct_check (((tree_check (((*((const_cast<tree
*> (tree_operand_check ((obj), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1748, __FUNCTION__)))))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1748, __FUNCTION__, (FIELD_DECL)))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1748, __FUNCTION__))->decl_common.lang_flag_6)
1749 && !same_type_ignoring_top_level_qualifiers_p
1750 (TREE_TYPE (obj)((contains_struct_check ((obj), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1750, __FUNCTION__))->typed.type)
, DECL_CONTEXT (fun)((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1750, __FUNCTION__))->decl_minimal.context)
))
1751 obj = TREE_OPERAND (obj, 0)(*((const_cast<tree*> (tree_operand_check ((obj), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1751, __FUNCTION__)))))
;
1752 if (obj != TREE_OPERAND (addr, 0)(*((const_cast<tree*> (tree_operand_check ((addr), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1752, __FUNCTION__)))))
)
1753 arg = build_fold_addr_expr_with_type (obj,build_fold_addr_expr_with_type_loc (((location_t) 0), (obj), (
(contains_struct_check ((arg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1754, __FUNCTION__))->typed.type))
1754 TREE_TYPE (arg))build_fold_addr_expr_with_type_loc (((location_t) 0), (obj), (
(contains_struct_check ((arg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1754, __FUNCTION__))->typed.type))
;
1755 }
1756 }
1757 TREE_VEC_ELT (binds, i)(*((const_cast<tree *> (tree_vec_elt_check ((binds), (i
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1757, __FUNCTION__)))))
= arg;
1758 }
1759 parms = TREE_CHAIN (parms)((contains_struct_check ((parms), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1759, __FUNCTION__))->common.chain)
;
1760 }
1761
1762 return binds;
1763}
1764
1765/* Variables and functions to manage constexpr call expansion context.
1766 These do not need to be marked for PCH or GC. */
1767
1768/* FIXME remember and print actual constant arguments. */
1769static vec<tree> call_stack;
1770static int call_stack_tick;
1771static int last_cx_error_tick;
1772
1773static int
1774push_cx_call_context (tree call)
1775{
1776 ++call_stack_tick;
1777 if (!EXPR_HAS_LOCATION (call)(((IS_ADHOC_LOC (((((call)) && ((tree_code_type[(int)
(((enum tree_code) ((call))->base.code))]) >= tcc_reference
&& (tree_code_type[(int) (((enum tree_code) ((call))
->base.code))]) <= tcc_expression)) ? (call)->exp.locus
: ((location_t) 0)))) ? get_location_from_adhoc_loc (line_table
, ((((call)) && ((tree_code_type[(int) (((enum tree_code
) ((call))->base.code))]) >= tcc_reference && (
tree_code_type[(int) (((enum tree_code) ((call))->base.code
))]) <= tcc_expression)) ? (call)->exp.locus : ((location_t
) 0))) : (((((call)) && ((tree_code_type[(int) (((enum
tree_code) ((call))->base.code))]) >= tcc_reference &&
(tree_code_type[(int) (((enum tree_code) ((call))->base.code
))]) <= tcc_expression)) ? (call)->exp.locus : ((location_t
) 0)))) != ((location_t) 0))
)
1778 SET_EXPR_LOCATION (call, input_location)(expr_check (((call)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1778, __FUNCTION__))->exp.locus = (input_location)
;
1779 call_stack.safe_push (call);
1780 int len = call_stack.length ();
1781 if (len > max_constexpr_depthglobal_options.x_max_constexpr_depth)
1782 return false;
1783 return len;
1784}
1785
1786static void
1787pop_cx_call_context (void)
1788{
1789 ++call_stack_tick;
1790 call_stack.pop ();
1791}
1792
1793vec<tree>
1794cx_error_context (void)
1795{
1796 vec<tree> r = vNULL;
1797 if (call_stack_tick != last_cx_error_tick
1798 && !call_stack.is_empty ())
1799 r = call_stack;
1800 last_cx_error_tick = call_stack_tick;
1801 return r;
1802}
1803
1804/* Evaluate a call T to a GCC internal function when possible and return
1805 the evaluated result or, under the control of CTX, give an error, set
1806 NON_CONSTANT_P, and return the unevaluated call T otherwise. */
1807
1808static tree
1809cxx_eval_internal_function (const constexpr_ctx *ctx, tree t,
1810 bool lval,
1811 bool *non_constant_p, bool *overflow_p)
1812{
1813 enum tree_code opcode = ERROR_MARK;
1814
1815 switch (CALL_EXPR_IFN (t)((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1815, __FUNCTION__, (CALL_EXPR)))->base.u.ifn)
)
1816 {
1817 case IFN_UBSAN_NULL:
1818 case IFN_UBSAN_BOUNDS:
1819 case IFN_UBSAN_VPTR:
1820 case IFN_FALLTHROUGH:
1821 return void_nodeglobal_trees[TI_VOID];
1822
1823 case IFN_ADD_OVERFLOW:
1824 opcode = PLUS_EXPR;
1825 break;
1826 case IFN_SUB_OVERFLOW:
1827 opcode = MINUS_EXPR;
1828 break;
1829 case IFN_MUL_OVERFLOW:
1830 opcode = MULT_EXPR;
1831 break;
1832
1833 case IFN_LAUNDER:
1834 return cxx_eval_constant_expression (ctx, 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/cp/constexpr.c"
, 1834, __FUNCTION__, (CALL_EXPR)))), ((0) + 3), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1834, __FUNCTION__)))))
,
1835 false, non_constant_p, overflow_p);
1836
1837 case IFN_VEC_CONVERT:
1838 {
1839 tree arg = cxx_eval_constant_expression (ctx, 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/cp/constexpr.c"
, 1839, __FUNCTION__, (CALL_EXPR)))), ((0) + 3), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1839, __FUNCTION__)))))
,
1840 false, non_constant_p,
1841 overflow_p);
1842 if (TREE_CODE (arg)((enum tree_code) (arg)->base.code) == VECTOR_CST)
1843 return fold_const_call (CFN_VEC_CONVERT, TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1843, __FUNCTION__))->typed.type)
, arg);
1844 else
1845 {
1846 *non_constant_p = true;
1847 return t;
1848 }
1849 }
1850
1851 default:
1852 if (!ctx->quiet)
1853 error_at (cp_expr_loc_or_input_loc (t),
1854 "call to internal function %qE", t);
1855 *non_constant_p = true;
1856 return t;
1857 }
1858
1859 /* Evaluate constant arguments using OPCODE and return a complex
1860 number containing the result and the overflow bit. */
1861 tree arg0 = cxx_eval_constant_expression (ctx, 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/cp/constexpr.c"
, 1861, __FUNCTION__, (CALL_EXPR)))), ((0) + 3), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1861, __FUNCTION__)))))
, lval,
1862 non_constant_p, overflow_p);
1863 tree arg1 = cxx_eval_constant_expression (ctx, CALL_EXPR_ARG (t, 1)(*((const_cast<tree*> (tree_operand_check (((tree_check
((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1863, __FUNCTION__, (CALL_EXPR)))), ((1) + 3), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1863, __FUNCTION__)))))
, lval,
1864 non_constant_p, overflow_p);
1865
1866 if (TREE_CODE (arg0)((enum tree_code) (arg0)->base.code) == INTEGER_CST && TREE_CODE (arg1)((enum tree_code) (arg1)->base.code) == INTEGER_CST)
1867 {
1868 location_t loc = cp_expr_loc_or_input_loc (t);
1869 tree type = TREE_TYPE (TREE_TYPE (t))((contains_struct_check ((((contains_struct_check ((t), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1869, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1869, __FUNCTION__))->typed.type)
;
1870 tree result = fold_binary_loc (loc, opcode, type,
1871 fold_convert_loc (loc, type, arg0),
1872 fold_convert_loc (loc, type, arg1));
1873 tree ovf
1874 = build_int_cst (type, arith_overflowed_p (opcode, type, arg0, arg1));
1875 /* Reset TREE_OVERFLOW to avoid warnings for the overflow. */
1876 if (TREE_OVERFLOW (result)((tree_class_check ((result), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1876, __FUNCTION__))->base.public_flag)
)
1877 TREE_OVERFLOW (result)((tree_class_check ((result), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1877, __FUNCTION__))->base.public_flag)
= 0;
1878
1879 return build_complex (TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1879, __FUNCTION__))->typed.type)
, result, ovf);
1880 }
1881
1882 *non_constant_p = true;
1883 return t;
1884}
1885
1886/* Clean CONSTRUCTOR_NO_CLEARING from CTOR and its sub-aggregates. */
1887
1888static void
1889clear_no_implicit_zero (tree ctor)
1890{
1891 if (CONSTRUCTOR_NO_CLEARING (ctor)((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1891, __FUNCTION__, (CONSTRUCTOR)))->base.public_flag)
)
1892 {
1893 CONSTRUCTOR_NO_CLEARING (ctor)((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1893, __FUNCTION__, (CONSTRUCTOR)))->base.public_flag)
= false;
1894 for (auto &e: CONSTRUCTOR_ELTS (ctor)((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1894, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
)
1895 if (TREE_CODE (e.value)((enum tree_code) (e.value)->base.code) == CONSTRUCTOR)
1896 clear_no_implicit_zero (e.value);
1897 }
1898}
1899
1900/* Complain about a const object OBJ being modified in a constant expression.
1901 EXPR is the MODIFY_EXPR expression performing the modification. */
1902
1903static void
1904modifying_const_object_error (tree expr, tree obj)
1905{
1906 location_t loc = cp_expr_loc_or_input_loc (expr);
1907 auto_diagnostic_group d;
1908 error_at (loc, "modifying a const object %qE is not allowed in "
1909 "a constant expression", TREE_OPERAND (expr, 0)(*((const_cast<tree*> (tree_operand_check ((expr), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1909, __FUNCTION__)))))
);
1910 inform (location_of (obj), "originally declared %<const%> here");
1911}
1912
1913/* Return true if FNDECL is a replaceable global allocation function that
1914 should be useable during constant expression evaluation. */
1915
1916static inline bool
1917cxx_replaceable_global_alloc_fn (tree fndecl)
1918{
1919 return (cxx_dialect >= cxx20
1920 && IDENTIFIER_NEWDEL_OP_P (DECL_NAME (fndecl))(((((tree_not_check2 (((tree_check ((((contains_struct_check (
(fndecl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1920, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1920, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1920, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_2)) & (!((tree_not_check2 (((tree_check ((((contains_struct_check
((fndecl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1920, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1920, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1920, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_1))) && ((&ovl_op_info[((tree_not_check2
(((tree_check ((((contains_struct_check ((fndecl), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1920, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1920, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1920, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0)][((tree_check ((((contains_struct_check ((fndecl
), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1920, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1920, __FUNCTION__, (IDENTIFIER_NODE)))->base.u.bits.address_space
)])->flags) & OVL_OP_FLAG_ALLOC)
1921 && CP_DECL_CONTEXT (fndecl)(!(! (((contains_struct_check ((fndecl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1921, __FUNCTION__))->decl_minimal.context)) || ((enum tree_code
) (((contains_struct_check ((fndecl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1921, __FUNCTION__))->decl_minimal.context))->base.code
) == TRANSLATION_UNIT_DECL) ? ((contains_struct_check ((fndecl
), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1921, __FUNCTION__))->decl_minimal.context) : cp_global_trees
[CPTI_GLOBAL])
== global_namespacecp_global_trees[CPTI_GLOBAL]
1922 && (DECL_IS_REPLACEABLE_OPERATOR_NEW_P (fndecl)((((tree_check ((fndecl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1922, __FUNCTION__, (FUNCTION_DECL)))->function_decl.decl_type
) == OPERATOR_NEW) && ((tree_check ((fndecl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1922, __FUNCTION__, (FUNCTION_DECL)))->function_decl.replaceable_operator
))
1923 || DECL_IS_OPERATOR_DELETE_P (fndecl)(((tree_check ((fndecl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1923, __FUNCTION__, (FUNCTION_DECL)))->function_decl.decl_type
) == OPERATOR_DELETE)
));
1924}
1925
1926/* Return true if FNDECL is a placement new function that should be
1927 useable during constant expression evaluation of std::construct_at. */
1928
1929static inline bool
1930cxx_placement_new_fn (tree fndecl)
1931{
1932 if (cxx_dialect >= cxx20
1933 && IDENTIFIER_NEW_OP_P (DECL_NAME (fndecl))(((((tree_not_check2 (((tree_check ((((contains_struct_check (
(fndecl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1933, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1933, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1933, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_2)) & (!((tree_not_check2 (((tree_check ((((contains_struct_check
((fndecl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1933, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1933, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1933, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_1))) && (((&ovl_op_info[((tree_not_check2
(((tree_check ((((contains_struct_check ((fndecl), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1933, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1933, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1933, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0)][((tree_check ((((contains_struct_check ((fndecl
), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1933, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1933, __FUNCTION__, (IDENTIFIER_NODE)))->base.u.bits.address_space
)])->flags) & (OVL_OP_FLAG_ALLOC | OVL_OP_FLAG_DELETE)
) == OVL_OP_FLAG_ALLOC)
1934 && CP_DECL_CONTEXT (fndecl)(!(! (((contains_struct_check ((fndecl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1934, __FUNCTION__))->decl_minimal.context)) || ((enum tree_code
) (((contains_struct_check ((fndecl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1934, __FUNCTION__))->decl_minimal.context))->base.code
) == TRANSLATION_UNIT_DECL) ? ((contains_struct_check ((fndecl
), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1934, __FUNCTION__))->decl_minimal.context) : cp_global_trees
[CPTI_GLOBAL])
== global_namespacecp_global_trees[CPTI_GLOBAL]
1935 && !DECL_IS_REPLACEABLE_OPERATOR_NEW_P (fndecl)((((tree_check ((fndecl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1935, __FUNCTION__, (FUNCTION_DECL)))->function_decl.decl_type
) == OPERATOR_NEW) && ((tree_check ((fndecl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1935, __FUNCTION__, (FUNCTION_DECL)))->function_decl.replaceable_operator
))
1936 && TREE_CODE (TREE_TYPE (fndecl))((enum tree_code) (((contains_struct_check ((fndecl), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1936, __FUNCTION__))->typed.type))->base.code)
== FUNCTION_TYPE)
1937 {
1938 tree first_arg = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (fndecl)))((contains_struct_check ((((tree_check2 ((((contains_struct_check
((fndecl), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1938, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1938, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values)), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1938, __FUNCTION__))->common.chain)
;
1939 if (TREE_VALUE (first_arg)((tree_check ((first_arg), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1939, __FUNCTION__, (TREE_LIST)))->list.value)
== ptr_type_nodeglobal_trees[TI_PTR_TYPE]
1940 && TREE_CHAIN (first_arg)((contains_struct_check ((first_arg), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1940, __FUNCTION__))->common.chain)
== void_list_nodeglobal_trees[TI_VOID_LIST_NODE])
1941 return true;
1942 }
1943 return false;
1944}
1945
1946/* Return true if FNDECL is std::construct_at. */
1947
1948static inline bool
1949is_std_construct_at (tree fndecl)
1950{
1951 if (!decl_in_std_namespace_p (fndecl))
1952 return false;
1953
1954 tree name = DECL_NAME (fndecl)((contains_struct_check ((fndecl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1954, __FUNCTION__))->decl_minimal.name)
;
1955 return name && id_equal (name, "construct_at");
1956}
1957
1958/* Overload for the above taking constexpr_call*. */
1959
1960static inline bool
1961is_std_construct_at (const constexpr_call *call)
1962{
1963 return (call
1964 && call->fundef
1965 && is_std_construct_at (call->fundef->decl));
1966}
1967
1968/* Return true if FNDECL is std::allocator<T>::{,de}allocate. */
1969
1970static inline bool
1971is_std_allocator_allocate (tree fndecl)
1972{
1973 tree name = DECL_NAME (fndecl)((contains_struct_check ((fndecl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1973, __FUNCTION__))->decl_minimal.name)
;
1974 if (name == NULL_TREE(tree) nullptr
1975 || !(id_equal (name, "allocate") || id_equal (name, "deallocate")))
1976 return false;
1977
1978 tree ctx = DECL_CONTEXT (fndecl)((contains_struct_check ((fndecl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1978, __FUNCTION__))->decl_minimal.context)
;
1979 if (ctx == NULL_TREE(tree) nullptr || !CLASS_TYPE_P (ctx)(((((enum tree_code) (ctx)->base.code)) == RECORD_TYPE || (
((enum tree_code) (ctx)->base.code)) == UNION_TYPE) &&
((tree_class_check ((ctx), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1979, __FUNCTION__))->type_common.lang_flag_5))
|| !TYPE_MAIN_DECL (ctx)((((contains_struct_check (((tree_class_check ((((tree_class_check
((ctx), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1979, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1979, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1979, __FUNCTION__))->common.chain)))
)
1980 return false;
1981
1982 tree decl = TYPE_MAIN_DECL (ctx)((((contains_struct_check (((tree_class_check ((((tree_class_check
((ctx), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1982, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1982, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1982, __FUNCTION__))->common.chain)))
;
1983 name = DECL_NAME (decl)((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 1983, __FUNCTION__))->decl_minimal.name)
;
1984 if (name == NULL_TREE(tree) nullptr || !id_equal (name, "allocator"))
1985 return false;
1986
1987 return decl_in_std_namespace_p (decl);
1988}
1989
1990/* Overload for the above taking constexpr_call*. */
1991
1992static inline bool
1993is_std_allocator_allocate (const constexpr_call *call)
1994{
1995 return (call
1996 && call->fundef
1997 && is_std_allocator_allocate (call->fundef->decl));
1998}
1999
2000/* Return true if FNDECL is __dynamic_cast. */
2001
2002static inline bool
2003cxx_dynamic_cast_fn_p (tree fndecl)
2004{
2005 return (cxx_dialect >= cxx20
2006 && id_equal (DECL_NAME (fndecl)((contains_struct_check ((fndecl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2006, __FUNCTION__))->decl_minimal.name)
, "__dynamic_cast")
2007 && CP_DECL_CONTEXT (fndecl)(!(! (((contains_struct_check ((fndecl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2007, __FUNCTION__))->decl_minimal.context)) || ((enum tree_code
) (((contains_struct_check ((fndecl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2007, __FUNCTION__))->decl_minimal.context))->base.code
) == TRANSLATION_UNIT_DECL) ? ((contains_struct_check ((fndecl
), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2007, __FUNCTION__))->decl_minimal.context) : cp_global_trees
[CPTI_GLOBAL])
== global_namespacecp_global_trees[CPTI_GLOBAL]);
2008}
2009
2010/* Often, we have an expression in the form of address + offset, e.g.
2011 "&_ZTV1A + 16". Extract the object from it, i.e. "_ZTV1A". */
2012
2013static tree
2014extract_obj_from_addr_offset (tree expr)
2015{
2016 if (TREE_CODE (expr)((enum tree_code) (expr)->base.code) == POINTER_PLUS_EXPR)
2017 expr = TREE_OPERAND (expr, 0)(*((const_cast<tree*> (tree_operand_check ((expr), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2017, __FUNCTION__)))))
;
2018 STRIP_NOPS (expr)(expr) = tree_strip_nop_conversions ((const_cast<union tree_node
*> (((expr)))))
;
2019 if (TREE_CODE (expr)((enum tree_code) (expr)->base.code) == ADDR_EXPR)
2020 expr = TREE_OPERAND (expr, 0)(*((const_cast<tree*> (tree_operand_check ((expr), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2020, __FUNCTION__)))))
;
2021 return expr;
2022}
2023
2024/* Given a PATH like
2025
2026 g.D.2181.D.2154.D.2102.D.2093
2027
2028 find a component with type TYPE. Return NULL_TREE if not found, and
2029 error_mark_node if the component is not accessible. If STOP is non-null,
2030 this function will return NULL_TREE if STOP is found before TYPE. */
2031
2032static tree
2033get_component_with_type (tree path, tree type, tree stop)
2034{
2035 while (true)
2036 {
2037 if (same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (path)((contains_struct_check ((path), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2037, __FUNCTION__))->typed.type)
, type))
2038 /* Found it. */
2039 return path;
2040 else if (stop
2041 && (same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (path)((contains_struct_check ((path), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2041, __FUNCTION__))->typed.type)
,
2042 stop)))
2043 return NULL_TREE(tree) nullptr;
2044 else if (TREE_CODE (path)((enum tree_code) (path)->base.code) == COMPONENT_REF
2045 && DECL_FIELD_IS_BASE (TREE_OPERAND (path, 1))((contains_struct_check (((tree_check (((*((const_cast<tree
*> (tree_operand_check ((path), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2045, __FUNCTION__)))))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2045, __FUNCTION__, (FIELD_DECL)))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2045, __FUNCTION__))->decl_common.lang_flag_6)
)
2046 {
2047 /* We need to check that the component we're accessing is in fact
2048 accessible. */
2049 if (TREE_PRIVATE (TREE_OPERAND (path, 1))(((*((const_cast<tree*> (tree_operand_check ((path), (1
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2049, __FUNCTION__))))))->base.private_flag)
2050 || TREE_PROTECTED (TREE_OPERAND (path, 1))(((*((const_cast<tree*> (tree_operand_check ((path), (1
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2050, __FUNCTION__))))))->base.protected_flag)
)
2051 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2052 path = TREE_OPERAND (path, 0)(*((const_cast<tree*> (tree_operand_check ((path), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2052, __FUNCTION__)))))
;
2053 }
2054 else
2055 return NULL_TREE(tree) nullptr;
2056 }
2057}
2058
2059/* Evaluate a call to __dynamic_cast (permitted by P1327R1).
2060
2061 The declaration of __dynamic_cast is:
2062
2063 void* __dynamic_cast (const void* __src_ptr,
2064 const __class_type_info* __src_type,
2065 const __class_type_info* __dst_type,
2066 ptrdiff_t __src2dst);
2067
2068 where src2dst has the following possible values
2069
2070 >-1: src_type is a unique public non-virtual base of dst_type
2071 dst_ptr + src2dst == src_ptr
2072 -1: unspecified relationship
2073 -2: src_type is not a public base of dst_type
2074 -3: src_type is a multiple public non-virtual base of dst_type
2075
2076 Since literal types can't have virtual bases, we only expect hint >=0,
2077 -2, or -3. */
2078
2079static tree
2080cxx_eval_dynamic_cast_fn (const constexpr_ctx *ctx, tree call,
2081 bool *non_constant_p, bool *overflow_p)
2082{
2083 /* T will be something like
2084 __dynamic_cast ((B*) b, &_ZTI1B, &_ZTI1D, 8)
2085 dismantle it. */
2086 gcc_assert (call_expr_nargs (call) == 4)((void)(!((((int)((unsigned long) (*tree_int_cst_elt_check ((
(tree_class_check ((call), (tcc_vl_exp), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2086, __FUNCTION__))->exp.operands[0]), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2086, __FUNCTION__)))) - 3) == 4) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2086, __FUNCTION__), 0 : 0))
;
2087 tsubst_flags_t complain = ctx->quiet ? tf_none : tf_warning_or_error;
2088 tree obj = CALL_EXPR_ARG (call, 0)(*((const_cast<tree*> (tree_operand_check (((tree_check
((call), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2088, __FUNCTION__, (CALL_EXPR)))), ((0) + 3), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2088, __FUNCTION__)))))
;
2089 tree type = CALL_EXPR_ARG (call, 2)(*((const_cast<tree*> (tree_operand_check (((tree_check
((call), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2089, __FUNCTION__, (CALL_EXPR)))), ((2) + 3), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2089, __FUNCTION__)))))
;
2090 HOST_WIDE_INTlong hint = int_cst_value (CALL_EXPR_ARG (call, 3)(*((const_cast<tree*> (tree_operand_check (((tree_check
((call), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2090, __FUNCTION__, (CALL_EXPR)))), ((3) + 3), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2090, __FUNCTION__)))))
);
2091 location_t loc = cp_expr_loc_or_input_loc (call);
2092
2093 /* Get the target type of the dynamic_cast. */
2094 gcc_assert (TREE_CODE (type) == ADDR_EXPR)((void)(!(((enum tree_code) (type)->base.code) == ADDR_EXPR
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2094, __FUNCTION__), 0 : 0))
;
2095 type = TREE_OPERAND (type, 0)(*((const_cast<tree*> (tree_operand_check ((type), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2095, __FUNCTION__)))))
;
2096 type = TREE_TYPE (DECL_NAME (type))((contains_struct_check ((((contains_struct_check ((type), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2096, __FUNCTION__))->decl_minimal.name)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2096, __FUNCTION__))->typed.type)
;
2097
2098 /* TYPE can only be either T* or T&. We can't know which of these it
2099 is by looking at TYPE, but OBJ will be "(T*) x" in the first case,
2100 and something like "(T*)(T&)(T*) x" in the second case. */
2101 bool reference_p = false;
2102 while (CONVERT_EXPR_P (obj)((((enum tree_code) (obj)->base.code)) == NOP_EXPR || (((enum
tree_code) (obj)->base.code)) == CONVERT_EXPR)
|| TREE_CODE (obj)((enum tree_code) (obj)->base.code) == SAVE_EXPR)
2103 {
2104 reference_p |= TYPE_REF_P (TREE_TYPE (obj))(((enum tree_code) (((contains_struct_check ((obj), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2104, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
)
;
2105 obj = TREE_OPERAND (obj, 0)(*((const_cast<tree*> (tree_operand_check ((obj), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2105, __FUNCTION__)))))
;
2106 }
2107
2108 /* Evaluate the object so that we know its dynamic type. */
2109 obj = cxx_eval_constant_expression (ctx, obj, /*lval*/false, non_constant_p,
2110 overflow_p);
2111 if (*non_constant_p)
2112 return call;
2113
2114 /* We expect OBJ to be in form of &d.D.2102 when HINT == 0,
2115 but when HINT is > 0, it can also be something like
2116 &d.D.2102 + 18446744073709551608, which includes the BINFO_OFFSET. */
2117 obj = extract_obj_from_addr_offset (obj);
2118 const tree objtype = TREE_TYPE (obj)((contains_struct_check ((obj), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2118, __FUNCTION__))->typed.type)
;
2119 /* If OBJ doesn't refer to a base field, we're done. */
2120 if (tree t = (TREE_CODE (obj)((enum tree_code) (obj)->base.code) == COMPONENT_REF
2121 ? TREE_OPERAND (obj, 1)(*((const_cast<tree*> (tree_operand_check ((obj), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2121, __FUNCTION__)))))
: obj))
2122 if (TREE_CODE (t)((enum tree_code) (t)->base.code) != FIELD_DECL || !DECL_FIELD_IS_BASE (t)((contains_struct_check (((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2122, __FUNCTION__, (FIELD_DECL)))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2122, __FUNCTION__))->decl_common.lang_flag_6)
)
2123 {
2124 if (reference_p)
2125 {
2126 if (!ctx->quiet)
2127 {
2128 error_at (loc, "reference %<dynamic_cast%> failed");
2129 inform (loc, "dynamic type %qT of its operand does "
2130 "not have a base class of type %qT",
2131 objtype, type);
2132 }
2133 *non_constant_p = true;
2134 }
2135 return integer_zero_nodeglobal_trees[TI_INTEGER_ZERO];
2136 }
2137
2138 /* [class.cdtor] When a dynamic_cast is used in a constructor ...
2139 or in a destructor ... if the operand of the dynamic_cast refers
2140 to the object under construction or destruction, this object is
2141 considered to be a most derived object that has the type of the
2142 constructor or destructor's class. */
2143 tree vtable = build_vfield_ref (obj, objtype);
2144 vtable = cxx_eval_constant_expression (ctx, vtable, /*lval*/false,
2145 non_constant_p, overflow_p);
2146 if (*non_constant_p)
2147 return call;
2148 /* With -fsanitize=vptr, we initialize all vtable pointers to null,
2149 so it's possible that we got a null pointer now. */
2150 if (integer_zerop (vtable))
2151 {
2152 if (!ctx->quiet)
2153 error_at (loc, "virtual table pointer is used uninitialized");
2154 *non_constant_p = true;
2155 return integer_zero_nodeglobal_trees[TI_INTEGER_ZERO];
2156 }
2157 /* VTABLE will be &_ZTV1A + 16 or similar, get _ZTV1A. */
2158 vtable = extract_obj_from_addr_offset (vtable);
2159 const tree mdtype = DECL_CONTEXT (vtable)((contains_struct_check ((vtable), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2159, __FUNCTION__))->decl_minimal.context)
;
2160
2161 /* Given dynamic_cast<T>(v),
2162
2163 [expr.dynamic.cast] If C is the class type to which T points or refers,
2164 the runtime check logically executes as follows:
2165
2166 If, in the most derived object pointed (referred) to by v, v points
2167 (refers) to a public base class subobject of a C object, and if only
2168 one object of type C is derived from the subobject pointed (referred)
2169 to by v the result points (refers) to that C object.
2170
2171 In this case, HINT >= 0 or -3. */
2172 if (hint >= 0 || hint == -3)
2173 {
2174 /* Look for a component with type TYPE. */
2175 tree t = get_component_with_type (obj, type, mdtype);
2176 /* If not accessible, give an error. */
2177 if (t == error_mark_nodeglobal_trees[TI_ERROR_MARK])
2178 {
2179 if (reference_p)
2180 {
2181 if (!ctx->quiet)
2182 {
2183 error_at (loc, "reference %<dynamic_cast%> failed");
2184 inform (loc, "static type %qT of its operand is a "
2185 "non-public base class of dynamic type %qT",
2186 objtype, type);
2187
2188 }
2189 *non_constant_p = true;
2190 }
2191 return integer_zero_nodeglobal_trees[TI_INTEGER_ZERO];
2192 }
2193 else if (t)
2194 /* The result points to the TYPE object. */
2195 return cp_build_addr_expr (t, complain);
2196 /* Else, TYPE was not found, because the HINT turned out to be wrong.
2197 Fall through to the normal processing. */
2198 }
2199
2200 /* Otherwise, if v points (refers) to a public base class subobject of the
2201 most derived object, and the type of the most derived object has a base
2202 class, of type C, that is unambiguous and public, the result points
2203 (refers) to the C subobject of the most derived object.
2204
2205 But it can also be an invalid case. */
2206
2207 /* Get the most derived object. */
2208 obj = get_component_with_type (obj, mdtype, NULL_TREE(tree) nullptr);
2209 if (obj == error_mark_nodeglobal_trees[TI_ERROR_MARK])
2210 {
2211 if (reference_p)
2212 {
2213 if (!ctx->quiet)
2214 {
2215 error_at (loc, "reference %<dynamic_cast%> failed");
2216 inform (loc, "static type %qT of its operand is a non-public"
2217 " base class of dynamic type %qT", objtype, mdtype);
2218 }
2219 *non_constant_p = true;
2220 }
2221 return integer_zero_nodeglobal_trees[TI_INTEGER_ZERO];
2222 }
2223 else
2224 gcc_assert (obj)((void)(!(obj) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2224, __FUNCTION__), 0 : 0))
;
2225
2226 /* Check that the type of the most derived object has a base class
2227 of type TYPE that is unambiguous and public. */
2228 base_kind b_kind;
2229 tree binfo = lookup_base (mdtype, type, ba_check, &b_kind, tf_none);
2230 if (!binfo || binfo == error_mark_nodeglobal_trees[TI_ERROR_MARK])
2231 {
2232 if (reference_p)
2233 {
2234 if (!ctx->quiet)
2235 {
2236 error_at (loc, "reference %<dynamic_cast%> failed");
2237 if (b_kind == bk_ambig)
2238 inform (loc, "%qT is an ambiguous base class of dynamic "
2239 "type %qT of its operand", type, mdtype);
2240 else
2241 inform (loc, "dynamic type %qT of its operand does not "
2242 "have an unambiguous public base class %qT",
2243 mdtype, type);
2244 }
2245 *non_constant_p = true;
2246 }
2247 return integer_zero_nodeglobal_trees[TI_INTEGER_ZERO];
2248 }
2249 /* If so, return the TYPE subobject of the most derived object. */
2250 obj = convert_to_base_statically (obj, binfo);
2251 return cp_build_addr_expr (obj, complain);
2252}
2253
2254/* Data structure used by replace_result_decl and replace_result_decl_r. */
2255
2256struct replace_result_decl_data
2257{
2258 /* The RESULT_DECL we want to replace. */
2259 tree decl;
2260 /* The replacement for DECL. */
2261 tree replacement;
2262 /* Whether we've performed any replacements. */
2263 bool changed;
2264};
2265
2266/* Helper function for replace_result_decl, called through cp_walk_tree. */
2267
2268static tree
2269replace_result_decl_r (tree *tp, int *walk_subtrees, void *data)
2270{
2271 replace_result_decl_data *d = (replace_result_decl_data *) data;
2272
2273 if (*tp == d->decl)
2274 {
2275 *tp = unshare_expr (d->replacement);
2276 d->changed = true;
2277 *walk_subtrees = 0;
2278 }
2279 else if (TYPE_P (*tp)(tree_code_type[(int) (((enum tree_code) (*tp)->base.code)
)] == tcc_type)
)
2280 *walk_subtrees = 0;
2281
2282 return NULL_TREE(tree) nullptr;
2283}
2284
2285/* Replace every occurrence of DECL, a RESULT_DECL, with (an unshared copy of)
2286 REPLACEMENT within the reduced constant expression *TP. Returns true iff a
2287 replacement was performed. */
2288
2289static bool
2290replace_result_decl (tree *tp, tree decl, tree replacement)
2291{
2292 gcc_checking_assert (TREE_CODE (decl) == RESULT_DECL((void)(!(((enum tree_code) (decl)->base.code) == RESULT_DECL
&& (same_type_ignoring_top_level_qualifiers_p (((contains_struct_check
((decl), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2294, __FUNCTION__))->typed.type), ((contains_struct_check
((replacement), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2294, __FUNCTION__))->typed.type)))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2294, __FUNCTION__), 0 : 0))
2293 && (same_type_ignoring_top_level_qualifiers_p((void)(!(((enum tree_code) (decl)->base.code) == RESULT_DECL
&& (same_type_ignoring_top_level_qualifiers_p (((contains_struct_check
((decl), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2294, __FUNCTION__))->typed.type), ((contains_struct_check
((replacement), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2294, __FUNCTION__))->typed.type)))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2294, __FUNCTION__), 0 : 0))
2294 (TREE_TYPE (decl), TREE_TYPE (replacement))))((void)(!(((enum tree_code) (decl)->base.code) == RESULT_DECL
&& (same_type_ignoring_top_level_qualifiers_p (((contains_struct_check
((decl), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2294, __FUNCTION__))->typed.type), ((contains_struct_check
((replacement), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2294, __FUNCTION__))->typed.type)))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2294, __FUNCTION__), 0 : 0))
;
2295 replace_result_decl_data data = { decl, replacement, false };
2296 cp_walk_tree_without_duplicates (tp, replace_result_decl_r, &data)walk_tree_without_duplicates_1 (tp, replace_result_decl_r, &
data, cp_walk_subtrees)
;
2297 return data.changed;
2298}
2299
2300/* Evaluate the call T to virtual function thunk THUNK_FNDECL. */
2301
2302static tree
2303cxx_eval_thunk_call (const constexpr_ctx *ctx, tree t, tree thunk_fndecl,
2304 bool lval,
2305 bool *non_constant_p, bool *overflow_p)
2306{
2307 tree function = THUNK_TARGET (thunk_fndecl)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (thunk_fndecl)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((thunk_fndecl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2307, __FUNCTION__, (TEMPLATE_DECL))))))))->result : thunk_fndecl
)), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2307, __FUNCTION__))->decl_common.lang_specific); if (!(
((enum tree_code) (thunk_fndecl)->base.code) == FUNCTION_DECL
|| (((enum tree_code) (thunk_fndecl)->base.code) == TEMPLATE_DECL
&& ((struct tree_template_decl *)(const_cast<union
tree_node *> ((((tree_check ((thunk_fndecl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2307, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) nullptr && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((thunk_fndecl
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2307, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2307, __FUNCTION__); &lt->u.fn; })->befriending_classes
)
;
2308
2309 if (THUNK_VIRTUAL_OFFSET (thunk_fndecl)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((tree_check ((thunk_fndecl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2309, __FUNCTION__, (FUNCTION_DECL)))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2309, __FUNCTION__))->decl_common.lang_specific); if (!(
(((enum tree_code) ((tree_check ((thunk_fndecl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2309, __FUNCTION__, (FUNCTION_DECL))))->base.code) == VAR_DECL
|| ((enum tree_code) ((tree_check ((thunk_fndecl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2309, __FUNCTION__, (FUNCTION_DECL))))->base.code) == FUNCTION_DECL
) || ((enum tree_code) ((tree_check ((thunk_fndecl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2309, __FUNCTION__, (FUNCTION_DECL))))->base.code) == FIELD_DECL
|| ((enum tree_code) ((tree_check ((thunk_fndecl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2309, __FUNCTION__, (FUNCTION_DECL))))->base.code) == CONST_DECL
|| ((enum tree_code) ((tree_check ((thunk_fndecl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2309, __FUNCTION__, (FUNCTION_DECL))))->base.code) == TYPE_DECL
|| ((enum tree_code) ((tree_check ((thunk_fndecl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2309, __FUNCTION__, (FUNCTION_DECL))))->base.code) == TEMPLATE_DECL
|| ((enum tree_code) ((tree_check ((thunk_fndecl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2309, __FUNCTION__, (FUNCTION_DECL))))->base.code) == USING_DECL
|| ((enum tree_code) ((tree_check ((thunk_fndecl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2309, __FUNCTION__, (FUNCTION_DECL))))->base.code) == CONCEPT_DECL
)) lang_check_failed ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2309, __FUNCTION__); &lt->u.min; })->access)
)
2310 {
2311 if (!ctx->quiet)
2312 {
2313 if (!DECL_DECLARED_CONSTEXPR_P (function)((contains_struct_check (((tree_check2 (((((enum tree_code) (
function)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((function
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2313, __FUNCTION__, (TEMPLATE_DECL))))))))->result : function
)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2313, __FUNCTION__, (VAR_DECL), (FUNCTION_DECL)))), (TS_DECL_COMMON
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2313, __FUNCTION__))->decl_common.lang_flag_8)
)
2314 {
2315 error ("call to non-%<constexpr%> function %qD", function);
2316 explain_invalid_constexpr_fn (function);
2317 }
2318 else
2319 /* virtual_offset is only set for virtual bases, which make the
2320 class non-literal, so we don't need to handle it here. */
2321 error ("calling constexpr member function %qD through virtual "
2322 "base subobject", function);
2323 }
2324 *non_constant_p = true;
2325 return t;
2326 }
2327
2328 tree new_call = copy_node (t);
2329 CALL_EXPR_FN (new_call)(*((const_cast<tree*> (tree_operand_check (((tree_check
((new_call), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2329, __FUNCTION__, (CALL_EXPR)))), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2329, __FUNCTION__)))))
= function;
2330 TREE_TYPE (new_call)((contains_struct_check ((new_call), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2330, __FUNCTION__))->typed.type)
= TREE_TYPE (TREE_TYPE (function))((contains_struct_check ((((contains_struct_check ((function)
, (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2330, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2330, __FUNCTION__))->typed.type)
;
2331
2332 tree offset = size_int (THUNK_FIXED_OFFSET (thunk_fndecl))size_int_kind ((((contains_struct_check ((__extension__ ({ __typeof
(thunk_fndecl) const __t = (thunk_fndecl); if (((enum tree_code
) (__t)->base.code) != FUNCTION_DECL || !__t->decl_common
.lang_specific || !__t->decl_common.lang_specific->u.fn
.thunk_p) tree_check_failed (__t, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2332, __FUNCTION__, 0); __t; })), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2332, __FUNCTION__))->decl_common.lang_specific)->u.fn
.u5.fixed_offset), stk_sizetype)
;
2333
2334 if (DECL_THIS_THUNK_P (thunk_fndecl)((((enum tree_code) (thunk_fndecl)->base.code) == FUNCTION_DECL
&& ((contains_struct_check ((thunk_fndecl), (TS_DECL_COMMON
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2334, __FUNCTION__))->decl_common.lang_specific) &&
__extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (thunk_fndecl)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((thunk_fndecl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2334, __FUNCTION__, (TEMPLATE_DECL))))))))->result : thunk_fndecl
)), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2334, __FUNCTION__))->decl_common.lang_specific); if (!(
((enum tree_code) (thunk_fndecl)->base.code) == FUNCTION_DECL
|| (((enum tree_code) (thunk_fndecl)->base.code) == TEMPLATE_DECL
&& ((struct tree_template_decl *)(const_cast<union
tree_node *> ((((tree_check ((thunk_fndecl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2334, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) nullptr && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((thunk_fndecl
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2334, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2334, __FUNCTION__); &lt->u.fn; })->thunk_p) &&
__extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (thunk_fndecl)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((thunk_fndecl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2334, __FUNCTION__, (TEMPLATE_DECL))))))))->result : thunk_fndecl
)), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2334, __FUNCTION__))->decl_common.lang_specific); if (!(
((enum tree_code) (thunk_fndecl)->base.code) == FUNCTION_DECL
|| (((enum tree_code) (thunk_fndecl)->base.code) == TEMPLATE_DECL
&& ((struct tree_template_decl *)(const_cast<union
tree_node *> ((((tree_check ((thunk_fndecl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2334, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) nullptr && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((thunk_fndecl
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2334, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2334, __FUNCTION__); &lt->u.fn; })->this_thunk_p)
)
2335 {
2336 /* 'this'-adjusting thunk. */
2337 tree this_arg = 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/cp/constexpr.c"
, 2337, __FUNCTION__, (CALL_EXPR)))), ((0) + 3), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2337, __FUNCTION__)))))
;
2338 this_arg = build2 (POINTER_PLUS_EXPR, TREE_TYPE (this_arg)((contains_struct_check ((this_arg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2338, __FUNCTION__))->typed.type)
,
2339 this_arg, offset);
2340 CALL_EXPR_ARG (new_call, 0)(*((const_cast<tree*> (tree_operand_check (((tree_check
((new_call), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2340, __FUNCTION__, (CALL_EXPR)))), ((0) + 3), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2340, __FUNCTION__)))))
= this_arg;
2341 }
2342 else
2343 /* Return-adjusting thunk. */
2344 new_call = build2 (POINTER_PLUS_EXPR, TREE_TYPE (new_call)((contains_struct_check ((new_call), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2344, __FUNCTION__))->typed.type)
,
2345 new_call, offset);
2346
2347 return cxx_eval_constant_expression (ctx, new_call, lval,
2348 non_constant_p, overflow_p);
2349}
2350
2351/* If OBJECT is of const class type, evaluate it to a CONSTRUCTOR and set
2352 its TREE_READONLY flag according to READONLY_P. Used for constexpr
2353 'tors to detect modifying const objects in a constexpr context. */
2354
2355static void
2356cxx_set_object_constness (const constexpr_ctx *ctx, tree object,
2357 bool readonly_p, bool *non_constant_p,
2358 bool *overflow_p)
2359{
2360 if (CLASS_TYPE_P (TREE_TYPE (object))(((((enum tree_code) (((contains_struct_check ((object), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2360, __FUNCTION__))->typed.type))->base.code)) == RECORD_TYPE
|| (((enum tree_code) (((contains_struct_check ((object), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2360, __FUNCTION__))->typed.type))->base.code)) == UNION_TYPE
) && ((tree_class_check ((((contains_struct_check ((object
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2360, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2360, __FUNCTION__))->type_common.lang_flag_5))
2361 && CP_TYPE_CONST_P (TREE_TYPE (object))((cp_type_quals (((contains_struct_check ((object), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2361, __FUNCTION__))->typed.type)) & TYPE_QUAL_CONST
) != 0)
)
2362 {
2363 /* Subobjects might not be stored in ctx->global->values but we
2364 can get its CONSTRUCTOR by evaluating *this. */
2365 tree e = cxx_eval_constant_expression (ctx, object, /*lval*/false,
2366 non_constant_p, overflow_p);
2367 if (TREE_CODE (e)((enum tree_code) (e)->base.code) == CONSTRUCTOR && !*non_constant_p)
2368 TREE_READONLY (e)((non_type_check ((e), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2368, __FUNCTION__))->base.readonly_flag)
= readonly_p;
2369 }
2370}
2371
2372/* Subroutine of cxx_eval_constant_expression.
2373 Evaluate the call expression tree T in the context of OLD_CALL expression
2374 evaluation. */
2375
2376static tree
2377cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
2378 bool lval,
2379 bool *non_constant_p, bool *overflow_p)
2380{
2381 /* Handle concept checks separately. */
2382 if (concept_check_p (t))
2383 return evaluate_concept_check (t);
2384
2385 location_t loc = cp_expr_loc_or_input_loc (t);
2386 tree fun = get_function_named_in_call (t);
2387 constexpr_call new_call
2388 = { NULLnullptr, NULLnullptr, NULLnullptr, 0, ctx->manifestly_const_eval };
2389 int depth_ok;
2390
2391 if (fun == NULL_TREE(tree) nullptr)
2392 return cxx_eval_internal_function (ctx, t, lval,
2393 non_constant_p, overflow_p);
2394
2395 if (TREE_CODE (fun)((enum tree_code) (fun)->base.code) != FUNCTION_DECL)
2396 {
2397 /* Might be a constexpr function pointer. */
2398 fun = cxx_eval_constant_expression (ctx, fun,
2399 /*lval*/false, non_constant_p,
2400 overflow_p);
2401 STRIP_NOPS (fun)(fun) = tree_strip_nop_conversions ((const_cast<union tree_node
*> (((fun)))))
;
2402 if (TREE_CODE (fun)((enum tree_code) (fun)->base.code) == ADDR_EXPR)
2403 fun = TREE_OPERAND (fun, 0)(*((const_cast<tree*> (tree_operand_check ((fun), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2403, __FUNCTION__)))))
;
2404 /* For TARGET_VTABLE_USES_DESCRIPTORS targets, there is no
2405 indirection, the called expression is a pointer into the
2406 virtual table which should contain FDESC_EXPR. Extract the
2407 FUNCTION_DECL from there. */
2408 else if (TARGET_VTABLE_USES_DESCRIPTORS0
2409 && TREE_CODE (fun)((enum tree_code) (fun)->base.code) == POINTER_PLUS_EXPR
2410 && TREE_CODE (TREE_OPERAND (fun, 0))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check
((fun), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2410, __FUNCTION__))))))->base.code)
== ADDR_EXPR
2411 && TREE_CODE (TREE_OPERAND (fun, 1))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check
((fun), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2411, __FUNCTION__))))))->base.code)
== INTEGER_CST)
2412 {
2413 tree d = TREE_OPERAND (TREE_OPERAND (fun, 0), 0)(*((const_cast<tree*> (tree_operand_check (((*((const_cast
<tree*> (tree_operand_check ((fun), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2413, __FUNCTION__)))))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2413, __FUNCTION__)))))
;
2414 if (VAR_P (d)(((enum tree_code) (d)->base.code) == VAR_DECL)
2415 && DECL_VTABLE_OR_VTT_P (d)((contains_struct_check (((tree_check ((d), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2415, __FUNCTION__, (VAR_DECL)))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2415, __FUNCTION__))->decl_common.virtual_flag)
2416 && TREE_CODE (TREE_TYPE (d))((enum tree_code) (((contains_struct_check ((d), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2416, __FUNCTION__))->typed.type))->base.code)
== ARRAY_TYPE
2417 && TREE_TYPE (TREE_TYPE (d))((contains_struct_check ((((contains_struct_check ((d), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2417, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2417, __FUNCTION__))->typed.type)
== vtable_entry_typecp_global_trees[CPTI_VTABLE_ENTRY_TYPE]
2418 && DECL_INITIAL (d)((contains_struct_check ((d), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2418, __FUNCTION__))->decl_common.initial)
2419 && TREE_CODE (DECL_INITIAL (d))((enum tree_code) (((contains_struct_check ((d), (TS_DECL_COMMON
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2419, __FUNCTION__))->decl_common.initial))->base.code
)
== CONSTRUCTOR)
2420 {
2421 tree i = int_const_binop (TRUNC_DIV_EXPR, TREE_OPERAND (fun, 1)(*((const_cast<tree*> (tree_operand_check ((fun), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2421, __FUNCTION__)))))
,
2422 TYPE_SIZE_UNIT (vtable_entry_type)((tree_class_check ((cp_global_trees[CPTI_VTABLE_ENTRY_TYPE])
, (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2422, __FUNCTION__))->type_common.size_unit)
);
2423 HOST_WIDE_INTlong idx = find_array_ctor_elt (DECL_INITIAL (d)((contains_struct_check ((d), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2423, __FUNCTION__))->decl_common.initial)
, i);
2424 if (idx >= 0)
2425 {
2426 tree fdesc
2427 = (*CONSTRUCTOR_ELTS (DECL_INITIAL (d))((tree_check ((((contains_struct_check ((d), (TS_DECL_COMMON)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2427, __FUNCTION__))->decl_common.initial)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2427, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
)[idx].value;
2428 if (TREE_CODE (fdesc)((enum tree_code) (fdesc)->base.code) == FDESC_EXPR
2429 && integer_zerop (TREE_OPERAND (fdesc, 1)(*((const_cast<tree*> (tree_operand_check ((fdesc), (1)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2429, __FUNCTION__)))))
))
2430 fun = TREE_OPERAND (fdesc, 0)(*((const_cast<tree*> (tree_operand_check ((fdesc), (0)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2430, __FUNCTION__)))))
;
2431 }
2432 }
2433 }
2434 }
2435 if (TREE_CODE (fun)((enum tree_code) (fun)->base.code) != FUNCTION_DECL)
2436 {
2437 if (!ctx->quiet && !*non_constant_p)
2438 error_at (loc, "expression %qE does not designate a %<constexpr%> "
2439 "function", fun);
2440 *non_constant_p = true;
2441 return t;
2442 }
2443 if (DECL_CLONED_FUNCTION_P (fun)(((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2443, __FUNCTION__))->decl_minimal.name) && ((!(
(tree_not_check2 (((tree_check ((((contains_struct_check ((fun
), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2443, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2443, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2443, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_2)) & ((tree_not_check2 (((tree_check ((((contains_struct_check
((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2443, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2443, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2443, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_1)) && !((((contains_struct_check ((fun), (
TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2443, __FUNCTION__))->decl_minimal.name) == cp_global_trees
[CPTI_CTOR_IDENTIFIER]) || (((contains_struct_check ((fun), (
TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2443, __FUNCTION__))->decl_minimal.name) == cp_global_trees
[CPTI_DTOR_IDENTIFIER])))
&& !DECL_DELETING_DESTRUCTOR_P (fun)(((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2443, __FUNCTION__))->decl_minimal.name) == cp_global_trees
[CPTI_DELETING_DTOR_IDENTIFIER])
)
2444 fun = DECL_CLONED_FUNCTION (fun)(((contains_struct_check (((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2444, __FUNCTION__, (FUNCTION_DECL)))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2444, __FUNCTION__))->decl_common.lang_specific)->u.fn
.u5.cloned_function)
;
2445
2446 if (is_ubsan_builtin_p (fun))
2447 return void_nodeglobal_trees[TI_VOID];
2448
2449 if (fndecl_built_in_p (fun))
2450 return cxx_eval_builtin_function_call (ctx, t, fun,
2451 lval, non_constant_p, overflow_p);
2452 if (DECL_THUNK_P (fun)(((enum tree_code) (fun)->base.code) == FUNCTION_DECL &&
((contains_struct_check ((fun), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2452, __FUNCTION__))->decl_common.lang_specific) &&
__extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (fun)->base.code) == TEMPLATE_DECL ?
((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2452, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fun
)), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2452, __FUNCTION__))->decl_common.lang_specific); if (!(
((enum tree_code) (fun)->base.code) == FUNCTION_DECL || ((
(enum tree_code) (fun)->base.code) == TEMPLATE_DECL &&
((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2452, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) nullptr && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fun)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2452, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2452, __FUNCTION__); &lt->u.fn; })->thunk_p)
)
2453 return cxx_eval_thunk_call (ctx, t, fun, lval, non_constant_p, overflow_p);
2454 if (!maybe_constexpr_fn (fun))
2455 {
2456 if (TREE_CODE (t)((enum tree_code) (t)->base.code) == CALL_EXPR
2457 && cxx_replaceable_global_alloc_fn (fun)
2458 && (CALL_FROM_NEW_OR_DELETE_P (t)((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2458, __FUNCTION__, (CALL_EXPR)))->base.protected_flag)
2459 || is_std_allocator_allocate (ctx->call)))
2460 {
2461 const int nargs = call_expr_nargs (t)(((int)((unsigned long) (*tree_int_cst_elt_check (((tree_class_check
((t), (tcc_vl_exp), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2461, __FUNCTION__))->exp.operands[0]), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2461, __FUNCTION__)))) - 3)
;
2462 tree arg0 = NULL_TREE(tree) nullptr;
2463 for (int i = 0; i < nargs; ++i)
2464 {
2465 tree arg = CALL_EXPR_ARG (t, i)(*((const_cast<tree*> (tree_operand_check (((tree_check
((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2465, __FUNCTION__, (CALL_EXPR)))), ((i) + 3), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2465, __FUNCTION__)))))
;
2466 arg = cxx_eval_constant_expression (ctx, arg, false,
2467 non_constant_p, overflow_p);
2468 VERIFY_CONSTANT (arg)do { if (verify_constant ((arg), ctx->quiet, non_constant_p
, overflow_p)) return t; } while (0)
;
2469 if (i == 0)
2470 arg0 = arg;
2471 }
2472 gcc_assert (arg0)((void)(!(arg0) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2472, __FUNCTION__), 0 : 0))
;
2473 if (IDENTIFIER_NEW_OP_P (DECL_NAME (fun))(((((tree_not_check2 (((tree_check ((((contains_struct_check (
(fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2473, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2473, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2473, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_2)) & (!((tree_not_check2 (((tree_check ((((contains_struct_check
((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2473, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2473, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2473, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_1))) && (((&ovl_op_info[((tree_not_check2
(((tree_check ((((contains_struct_check ((fun), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2473, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2473, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2473, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0)][((tree_check ((((contains_struct_check ((fun),
(TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2473, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2473, __FUNCTION__, (IDENTIFIER_NODE)))->base.u.bits.address_space
)])->flags) & (OVL_OP_FLAG_ALLOC | OVL_OP_FLAG_DELETE)
) == OVL_OP_FLAG_ALLOC)
)
2474 {
2475 tree type = build_array_type_nelts (char_type_nodeinteger_types[itk_char],
2476 tree_to_uhwi (arg0));
2477 tree var = build_decl (loc, VAR_DECL,
2478 (IDENTIFIER_OVL_OP_FLAGS (DECL_NAME (fun))((&ovl_op_info[((tree_not_check2 (((tree_check ((((contains_struct_check
((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2478, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2478, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2478, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0)][((tree_check ((((contains_struct_check ((fun),
(TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2478, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2478, __FUNCTION__, (IDENTIFIER_NODE)))->base.u.bits.address_space
)])->flags)
2479 & OVL_OP_FLAG_VEC)
2480 ? heap_vec_uninit_identifiercp_global_trees[CPTI_HEAP_VEC_UNINIT_IDENTIFIER]
2481 : heap_uninit_identifiercp_global_trees[CPTI_HEAP_UNINIT_IDENTIFIER],
2482 type);
2483 DECL_ARTIFICIAL (var)((contains_struct_check ((var), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2483, __FUNCTION__))->decl_common.artificial_flag)
= 1;
2484 TREE_STATIC (var)((var)->base.static_flag) = 1;
2485 // Temporarily register the artificial var in varpool,
2486 // so that comparisons of its address against NULL are folded
2487 // through nonzero_address even with
2488 // -fno-delete-null-pointer-checks or that comparison of
2489 // addresses of different heap artificial vars is folded too.
2490 // See PR98988 and PR99031.
2491 varpool_node::finalize_decl (var);
2492 ctx->global->heap_vars.safe_push (var);
2493 ctx->global->values.put (var, NULL_TREE(tree) nullptr);
2494 return fold_convert (ptr_type_node, build_address (var))fold_convert_loc (((location_t) 0), global_trees[TI_PTR_TYPE]
, build_address (var))
;
2495 }
2496 else
2497 {
2498 STRIP_NOPS (arg0)(arg0) = tree_strip_nop_conversions ((const_cast<union tree_node
*> (((arg0)))))
;
2499 if (TREE_CODE (arg0)((enum tree_code) (arg0)->base.code) == ADDR_EXPR
2500 && VAR_P (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/cp/constexpr.c"
, 2500, __FUNCTION__))))))->base.code) == VAR_DECL)
)
2501 {
2502 tree var = TREE_OPERAND (arg0, 0)(*((const_cast<tree*> (tree_operand_check ((arg0), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2502, __FUNCTION__)))))
;
2503 if (DECL_NAME (var)((contains_struct_check ((var), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2503, __FUNCTION__))->decl_minimal.name)
== heap_uninit_identifiercp_global_trees[CPTI_HEAP_UNINIT_IDENTIFIER]
2504 || DECL_NAME (var)((contains_struct_check ((var), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2504, __FUNCTION__))->decl_minimal.name)
== heap_identifiercp_global_trees[CPTI_HEAP_IDENTIFIER])
2505 {
2506 if (IDENTIFIER_OVL_OP_FLAGS (DECL_NAME (fun))((&ovl_op_info[((tree_not_check2 (((tree_check ((((contains_struct_check
((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2506, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2506, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2506, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0)][((tree_check ((((contains_struct_check ((fun),
(TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2506, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2506, __FUNCTION__, (IDENTIFIER_NODE)))->base.u.bits.address_space
)])->flags)
2507 & OVL_OP_FLAG_VEC)
2508 {
2509 if (!ctx->quiet)
2510 {
2511 error_at (loc, "array deallocation of object "
2512 "allocated with non-array "
2513 "allocation");
2514 inform (DECL_SOURCE_LOCATION (var)((contains_struct_check ((var), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2514, __FUNCTION__))->decl_minimal.locus)
,
2515 "allocation performed here");
2516 }
2517 *non_constant_p = true;
2518 return t;
2519 }
2520 DECL_NAME (var)((contains_struct_check ((var), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2520, __FUNCTION__))->decl_minimal.name)
= heap_deleted_identifiercp_global_trees[CPTI_HEAP_DELETED_IDENTIFIER];
2521 ctx->global->values.remove (var);
2522 ctx->global->heap_dealloc_count++;
2523 return void_nodeglobal_trees[TI_VOID];
2524 }
2525 else if (DECL_NAME (var)((contains_struct_check ((var), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2525, __FUNCTION__))->decl_minimal.name)
== heap_vec_uninit_identifiercp_global_trees[CPTI_HEAP_VEC_UNINIT_IDENTIFIER]
2526 || DECL_NAME (var)((contains_struct_check ((var), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2526, __FUNCTION__))->decl_minimal.name)
== heap_vec_identifiercp_global_trees[CPTI_HEAP_VEC_IDENTIFIER])
2527 {
2528 if ((IDENTIFIER_OVL_OP_FLAGS (DECL_NAME (fun))((&ovl_op_info[((tree_not_check2 (((tree_check ((((contains_struct_check
((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2528, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2528, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2528, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0)][((tree_check ((((contains_struct_check ((fun),
(TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2528, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2528, __FUNCTION__, (IDENTIFIER_NODE)))->base.u.bits.address_space
)])->flags)
2529 & OVL_OP_FLAG_VEC) == 0)
2530 {
2531 if (!ctx->quiet)
2532 {
2533 error_at (loc, "non-array deallocation of "
2534 "object allocated with array "
2535 "allocation");
2536 inform (DECL_SOURCE_LOCATION (var)((contains_struct_check ((var), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2536, __FUNCTION__))->decl_minimal.locus)
,
2537 "allocation performed here");
2538 }
2539 *non_constant_p = true;
2540 return t;
2541 }
2542 DECL_NAME (var)((contains_struct_check ((var), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2542, __FUNCTION__))->decl_minimal.name)
= heap_deleted_identifiercp_global_trees[CPTI_HEAP_DELETED_IDENTIFIER];
2543 ctx->global->values.remove (var);
2544 ctx->global->heap_dealloc_count++;
2545 return void_nodeglobal_trees[TI_VOID];
2546 }
2547 else if (DECL_NAME (var)((contains_struct_check ((var), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2547, __FUNCTION__))->decl_minimal.name)
== heap_deleted_identifiercp_global_trees[CPTI_HEAP_DELETED_IDENTIFIER])
2548 {
2549 if (!ctx->quiet)
2550 error_at (loc, "deallocation of already deallocated "
2551 "storage");
2552 *non_constant_p = true;
2553 return t;
2554 }
2555 }
2556 if (!ctx->quiet)
2557 error_at (loc, "deallocation of storage that was "
2558 "not previously allocated");
2559 *non_constant_p = true;
2560 return t;
2561 }
2562 }
2563 /* Allow placement new in std::construct_at, just return the second
2564 argument. */
2565 if (TREE_CODE (t)((enum tree_code) (t)->base.code) == CALL_EXPR
2566 && cxx_placement_new_fn (fun)
2567 && is_std_construct_at (ctx->call))
2568 {
2569 const int nargs = call_expr_nargs (t)(((int)((unsigned long) (*tree_int_cst_elt_check (((tree_class_check
((t), (tcc_vl_exp), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2569, __FUNCTION__))->exp.operands[0]), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2569, __FUNCTION__)))) - 3)
;
2570 tree arg1 = NULL_TREE(tree) nullptr;
2571 for (int i = 0; i < nargs; ++i)
2572 {
2573 tree arg = CALL_EXPR_ARG (t, i)(*((const_cast<tree*> (tree_operand_check (((tree_check
((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2573, __FUNCTION__, (CALL_EXPR)))), ((i) + 3), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2573, __FUNCTION__)))))
;
2574 arg = cxx_eval_constant_expression (ctx, arg, false,
2575 non_constant_p, overflow_p);
2576 if (i == 1)
2577 arg1 = arg;
2578 else
2579 VERIFY_CONSTANT (arg)do { if (verify_constant ((arg), ctx->quiet, non_constant_p
, overflow_p)) return t; } while (0)
;
2580 }
2581 gcc_assert (arg1)((void)(!(arg1) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2581, __FUNCTION__), 0 : 0))
;
2582 return arg1;
2583 }
2584 else if (cxx_dynamic_cast_fn_p (fun))
2585 return cxx_eval_dynamic_cast_fn (ctx, t, non_constant_p, overflow_p);
2586
2587 if (!ctx->quiet)
2588 {
2589 if (!lambda_static_thunk_p (fun))
2590 error_at (loc, "call to non-%<constexpr%> function %qD", fun);
2591 explain_invalid_constexpr_fn (fun);
2592 }
2593 *non_constant_p = true;
2594 return t;
2595 }
2596
2597 constexpr_ctx new_ctx = *ctx;
2598 if (DECL_CONSTRUCTOR_P (fun)((tree_check (((((enum tree_code) (fun)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2598, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fun
)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2598, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
&& !ctx->object
2599 && TREE_CODE (t)((enum tree_code) (t)->base.code) == AGGR_INIT_EXPR)
2600 {
2601 /* We want to have an initialization target for an AGGR_INIT_EXPR.
2602 If we don't already have one in CTX, use the AGGR_INIT_EXPR_SLOT. */
2603 new_ctx.object = AGGR_INIT_EXPR_SLOT (t)(*((const_cast<tree*> (tree_operand_check (((tree_check
((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2603, __FUNCTION__, (AGGR_INIT_EXPR)))), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2603, __FUNCTION__)))))
;
2604 tree ctor = new_ctx.ctor = build_constructor (DECL_CONTEXT (fun)((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2604, __FUNCTION__))->decl_minimal.context)
, NULLnullptr);
2605 CONSTRUCTOR_NO_CLEARING (ctor)((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2605, __FUNCTION__, (CONSTRUCTOR)))->base.public_flag)
= true;
2606 ctx->global->values.put (new_ctx.object, ctor);
2607 ctx = &new_ctx;
2608 }
2609
2610 /* Shortcut trivial constructor/op=. */
2611 if (trivial_fn_p (fun))
2612 {
2613 tree init = NULL_TREE(tree) nullptr;
2614 if (call_expr_nargs (t)(((int)((unsigned long) (*tree_int_cst_elt_check (((tree_class_check
((t), (tcc_vl_exp), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2614, __FUNCTION__))->exp.operands[0]), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2614, __FUNCTION__)))) - 3)
== 2)
2615 init = convert_from_reference (get_nth_callarg (t, 1));
2616 else if (TREE_CODE (t)((enum tree_code) (t)->base.code) == AGGR_INIT_EXPR
2617 && AGGR_INIT_ZERO_FIRST (t)((tree_not_check2 (((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2617, __FUNCTION__, (AGGR_INIT_EXPR)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2617, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_2)
)
2618 init = build_zero_init (DECL_CONTEXT (fun)((contains_struct_check ((fun), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2618, __FUNCTION__))->decl_minimal.context)
, NULL_TREE(tree) nullptr, false);
2619 if (init)
2620 {
2621 tree op = get_nth_callarg (t, 0);
2622 if (is_dummy_object (op))
2623 op = ctx->object;
2624 else
2625 op = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (op))((contains_struct_check ((((contains_struct_check ((op), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2625, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2625, __FUNCTION__))->typed.type)
, op);
2626 tree set = build2 (MODIFY_EXPR, TREE_TYPE (op)((contains_struct_check ((op), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2626, __FUNCTION__))->typed.type)
, op, init);
2627 new_ctx.call = &new_call;
2628 return cxx_eval_constant_expression (&new_ctx, set, lval,
2629 non_constant_p, overflow_p);
2630 }
2631 }
2632
2633 bool non_constant_args = false;
2634 new_call.bindings
2635 = cxx_bind_parameters_in_call (ctx, t, fun, non_constant_p,
2636 overflow_p, &non_constant_args);
2637
2638 /* We build up the bindings list before we know whether we already have this
2639 call cached. If we don't end up saving these bindings, ggc_free them when
2640 this function exits. */
2641 class free_bindings
2642 {
2643 tree *bindings;
2644 public:
2645 free_bindings (tree &b): bindings (&b) { }
2646 ~free_bindings () { if (bindings) ggc_free (*bindings); }
2647 void preserve () { bindings = NULLnullptr; }
2648 } fb (new_call.bindings);
2649
2650 if (*non_constant_p)
2651 return t;
2652
2653 /* We can't defer instantiating the function any longer. */
2654 if (!DECL_INITIAL (fun)((contains_struct_check ((fun), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2654, __FUNCTION__))->decl_common.initial)
2655 && DECL_TEMPLOID_INSTANTIATION (fun)(((((contains_struct_check ((fun), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2655, __FUNCTION__))->decl_common.lang_specific)->u.base
.use_template) & 1) || (((contains_struct_check ((fun), (
TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2655, __FUNCTION__))->decl_common.lang_specific) &&
(((contains_struct_check ((template_info_decl_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2655, __FUNCTION__)), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2655, __FUNCTION__))->decl_common.lang_specific) ->u.
min.template_info) && !(((contains_struct_check ((fun
), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2655, __FUNCTION__))->decl_common.lang_specific)->u.base
.use_template)))
2656 && !uid_sensitive_constexpr_evaluation_p ())
2657 {
2658 location_t save_loc = input_location;
2659 input_location = loc;
2660 ++function_depth;
2661 if (ctx->manifestly_const_eval)
2662 FNDECL_MANIFESTLY_CONST_EVALUATED (fun)((tree_not_check2 (((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2662, __FUNCTION__, (FUNCTION_DECL)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2662, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_4)
= true;
2663 instantiate_decl (fun, /*defer_ok*/false, /*expl_inst*/false);
2664 --function_depth;
2665 input_location = save_loc;
2666 }
2667
2668 /* If in direct recursive call, optimize definition search. */
2669 if (ctx && ctx->call && ctx->call->fundef && ctx->call->fundef->decl == fun)
2670 new_call.fundef = ctx->call->fundef;
2671 else
2672 {
2673 new_call.fundef = retrieve_constexpr_fundef (fun);
2674 if (new_call.fundef == NULLnullptr || new_call.fundef->body == NULLnullptr
2675 || new_call.fundef->result == error_mark_nodeglobal_trees[TI_ERROR_MARK]
2676 || fun == current_function_decl)
2677 {
2678 if (!ctx->quiet)
2679 {
2680 /* We need to check for current_function_decl here in case we're
2681 being called during cp_fold_function, because at that point
2682 DECL_INITIAL is set properly and we have a fundef but we
2683 haven't lowered invisirefs yet (c++/70344). */
2684 if (DECL_INITIAL (fun)((contains_struct_check ((fun), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2684, __FUNCTION__))->decl_common.initial)
== error_mark_nodeglobal_trees[TI_ERROR_MARK]
2685 || fun == current_function_decl)
2686 error_at (loc, "%qD called in a constant expression before its "
2687 "definition is complete", fun);
2688 else if (DECL_INITIAL (fun)((contains_struct_check ((fun), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2688, __FUNCTION__))->decl_common.initial)
)
2689 {
2690 /* The definition of fun was somehow unsuitable. But pretend
2691 that lambda static thunks don't exist. */
2692 if (!lambda_static_thunk_p (fun))
2693 error_at (loc, "%qD called in a constant expression", fun);
2694 explain_invalid_constexpr_fn (fun);
2695 }
2696 else
2697 error_at (loc, "%qD used before its definition", fun);
2698 }
2699 *non_constant_p = true;
2700 return t;
2701 }
2702 }
2703
2704 depth_ok = push_cx_call_context (t);
2705
2706 /* Remember the object we are constructing or destructing. */
2707 tree new_obj = NULL_TREE(tree) nullptr;
2708 if (DECL_CONSTRUCTOR_P (fun)((tree_check (((((enum tree_code) (fun)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2708, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fun
)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2708, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
|| DECL_DESTRUCTOR_P (fun)((tree_check (((((enum tree_code) (fun)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2708, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fun
)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2708, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_destructor
)
)
2709 {
2710 /* In a cdtor, it should be the first `this' argument.
2711 At this point it has already been evaluated in the call
2712 to cxx_bind_parameters_in_call. */
2713 new_obj = TREE_VEC_ELT (new_call.bindings, 0)(*((const_cast<tree *> (tree_vec_elt_check ((new_call.bindings
), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2713, __FUNCTION__)))))
;
2714 STRIP_NOPS (new_obj)(new_obj) = tree_strip_nop_conversions ((const_cast<union tree_node
*> (((new_obj)))))
;
2715 if (TREE_CODE (new_obj)((enum tree_code) (new_obj)->base.code) == ADDR_EXPR)
2716 new_obj = TREE_OPERAND (new_obj, 0)(*((const_cast<tree*> (tree_operand_check ((new_obj), (
0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2716, __FUNCTION__)))))
;
2717
2718 if (ctx->call && ctx->call->fundef
2719 && DECL_CONSTRUCTOR_P (ctx->call->fundef->decl)((tree_check (((((enum tree_code) (ctx->call->fundef->
decl)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((ctx->
call->fundef->decl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2719, __FUNCTION__, (TEMPLATE_DECL))))))))->result : ctx
->call->fundef->decl)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2719, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
)
2720 {
2721 tree cur_obj = TREE_VEC_ELT (ctx->call->bindings, 0)(*((const_cast<tree *> (tree_vec_elt_check ((ctx->call
->bindings), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2721, __FUNCTION__)))))
;
2722 STRIP_NOPS (cur_obj)(cur_obj) = tree_strip_nop_conversions ((const_cast<union tree_node
*> (((cur_obj)))))
;
2723 if (TREE_CODE (cur_obj)((enum tree_code) (cur_obj)->base.code) == ADDR_EXPR)
2724 cur_obj = TREE_OPERAND (cur_obj, 0)(*((const_cast<tree*> (tree_operand_check ((cur_obj), (
0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2724, __FUNCTION__)))))
;
2725 if (new_obj == cur_obj)
2726 /* We're calling the target constructor of a delegating
2727 constructor, or accessing a base subobject through a
2728 NOP_EXPR as part of a call to a base constructor, so
2729 there is no new (sub)object. */
2730 new_obj = NULL_TREE(tree) nullptr;
2731 }
2732 }
2733
2734 tree result = NULL_TREE(tree) nullptr;
2735
2736 constexpr_call *entry = NULLnullptr;
2737 if (depth_ok && !non_constant_args && ctx->strict)
2738 {
2739 new_call.hash = constexpr_fundef_hasher::hash (new_call.fundef);
2740 new_call.hash
2741 = iterative_hash_template_arg (new_call.bindings, new_call.hash);
2742 new_call.hash
2743 = iterative_hash_object (ctx->manifestly_const_eval, new_call.hash)iterative_hash (&ctx->manifestly_const_eval, sizeof (ctx
->manifestly_const_eval), new_call.hash)
;
2744
2745 /* If we have seen this call before, we are done. */
2746 maybe_initialize_constexpr_call_table ();
2747 constexpr_call **slot
2748 = constexpr_call_table->find_slot (&new_call, INSERT);
2749 entry = *slot;
2750 if (entry == NULLnullptr)
2751 {
2752 /* Only cache up to constexpr_cache_depth to limit memory use. */
2753 if (depth_ok < constexpr_cache_depthglobal_options.x_constexpr_cache_depth)
2754 {
2755 /* We need to keep a pointer to the entry, not just the slot, as
2756 the slot can move during evaluation of the body. */
2757 *slot = entry = ggc_alloc<constexpr_call> ();
2758 *entry = new_call;
2759 fb.preserve ();
2760 }
2761 }
2762 /* Calls that are in progress have their result set to NULL, so that we
2763 can detect circular dependencies. Now that we only cache up to
2764 constexpr_cache_depth this won't catch circular dependencies that
2765 start deeper, but they'll hit the recursion or ops limit. */
2766 else if (entry->result == NULLnullptr)
2767 {
2768 if (!ctx->quiet)
2769 error ("call has circular dependency");
2770 *non_constant_p = true;
2771 entry->result = result = error_mark_nodeglobal_trees[TI_ERROR_MARK];
2772 }
2773 else
2774 result = entry->result;
2775 }
2776
2777 if (!depth_ok)
2778 {
2779 if (!ctx->quiet)
2780 error ("%<constexpr%> evaluation depth exceeds maximum of %d (use "
2781 "%<-fconstexpr-depth=%> to increase the maximum)",
2782 max_constexpr_depthglobal_options.x_max_constexpr_depth);
2783 *non_constant_p = true;
2784 result = error_mark_nodeglobal_trees[TI_ERROR_MARK];
2785 }
2786 else
2787 {
2788 bool cacheable = true;
2789 if (result && result != error_mark_nodeglobal_trees[TI_ERROR_MARK])
2790 /* OK */;
2791 else if (!DECL_SAVED_TREE (fun)((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2791, __FUNCTION__, (FUNCTION_DECL)))->function_decl.saved_tree
)
)
2792 {
2793 /* When at_eof >= 2, cgraph has started throwing away
2794 DECL_SAVED_TREE, so fail quietly. FIXME we get here because of
2795 late code generation for VEC_INIT_EXPR, which needs to be
2796 completely reconsidered. */
2797 gcc_assert (at_eof >= 2 && ctx->quiet)((void)(!(at_eof >= 2 && ctx->quiet) ? fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2797, __FUNCTION__), 0 : 0))
;
2798 *non_constant_p = true;
2799 }
2800 else if (tree copy = get_fundef_copy (new_call.fundef))
2801 {
2802 tree body, parms, res;
2803 releasing_vec ctors;
2804
2805 /* Reuse or create a new unshared copy of this function's body. */
2806 body = TREE_PURPOSE (copy)((tree_check ((copy), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2806, __FUNCTION__, (TREE_LIST)))->list.purpose)
;
2807 parms = TREE_VALUE (copy)((tree_check ((copy), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2807, __FUNCTION__, (TREE_LIST)))->list.value)
;
2808 res = TREE_TYPE (copy)((contains_struct_check ((copy), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2808, __FUNCTION__))->typed.type)
;
2809
2810 /* Associate the bindings with the remapped parms. */
2811 tree bound = new_call.bindings;
2812 tree remapped = parms;
2813 for (int i = 0; i < TREE_VEC_LENGTH (bound)((tree_check ((bound), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2813, __FUNCTION__, (TREE_VEC)))->base.u.length)
; ++i)
2814 {
2815 tree arg = TREE_VEC_ELT (bound, i)(*((const_cast<tree *> (tree_vec_elt_check ((bound), (i
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2815, __FUNCTION__)))))
;
2816 if (entry)
2817 {
2818 /* Unshare args going into the hash table to separate them
2819 from the caller's context, for better GC and to avoid
2820 problems with verify_gimple. */
2821 arg = unshare_expr_without_location (arg);
2822 TREE_VEC_ELT (bound, i)(*((const_cast<tree *> (tree_vec_elt_check ((bound), (i
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2822, __FUNCTION__)))))
= arg;
2823
2824 /* And then unshare again so the callee doesn't change the
2825 argument values in the hash table. XXX Could we unshare
2826 lazily in cxx_eval_store_expression? */
2827 arg = unshare_constructor (arg);
2828 if (TREE_CODE (arg)((enum tree_code) (arg)->base.code) == CONSTRUCTOR)
2829 vec_safe_push (ctors, arg);
2830 }
2831 ctx->global->values.put (remapped, arg);
2832 remapped = DECL_CHAIN (remapped)(((contains_struct_check (((contains_struct_check ((remapped)
, (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2832, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2832, __FUNCTION__))->common.chain))
;
2833 }
2834 /* Add the RESULT_DECL to the values map, too. */
2835 gcc_assert (!DECL_BY_REFERENCE (res))((void)(!(!((tree_check3 ((res), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2835, __FUNCTION__, (VAR_DECL), (PARM_DECL), (RESULT_DECL))
)->decl_common.decl_by_reference_flag)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2835, __FUNCTION__), 0 : 0))
;
2836 ctx->global->values.put (res, NULL_TREE(tree) nullptr);
2837
2838 /* Track the callee's evaluated SAVE_EXPRs and TARGET_EXPRs so that
2839 we can forget their values after the call. */
2840 constexpr_ctx ctx_with_save_exprs = *ctx;
2841 auto_vec<tree, 10> save_exprs;
2842 ctx_with_save_exprs.save_exprs = &save_exprs;
2843 ctx_with_save_exprs.call = &new_call;
2844 unsigned save_heap_alloc_count = ctx->global->heap_vars.length ();
2845 unsigned save_heap_dealloc_count = ctx->global->heap_dealloc_count;
2846
2847 /* If this is a constexpr destructor, the object's const and volatile
2848 semantics are no longer in effect; see [class.dtor]p5. */
2849 if (new_obj && DECL_DESTRUCTOR_P (fun)((tree_check (((((enum tree_code) (fun)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2849, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fun
)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2849, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_destructor
)
)
2850 cxx_set_object_constness (ctx, new_obj, /*readonly_p=*/false,
2851 non_constant_p, overflow_p);
2852
2853 tree jump_target = NULL_TREE(tree) nullptr;
2854 cxx_eval_constant_expression (&ctx_with_save_exprs, body,
2855 lval, non_constant_p, overflow_p,
2856 &jump_target);
2857
2858 if (DECL_CONSTRUCTOR_P (fun)((tree_check (((((enum tree_code) (fun)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2858, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fun
)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2858, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
)
2859 {
2860 /* This can be null for a subobject constructor call, in
2861 which case what we care about is the initialization
2862 side-effects rather than the value. We could get at the
2863 value by evaluating *this, but we don't bother; there's
2864 no need to put such a call in the hash table. */
2865 result = lval ? ctx->object : ctx->ctor;
2866
2867 /* If we've just evaluated a subobject constructor call for an
2868 empty union member, it might not have produced a side effect
2869 that actually activated the union member. So produce such a
2870 side effect now to ensure the union appears initialized. */
2871 if (!result && new_obj
2872 && TREE_CODE (new_obj)((enum tree_code) (new_obj)->base.code) == COMPONENT_REF
2873 && TREE_CODE (TREE_TYPE((enum tree_code) (((contains_struct_check (((*((const_cast<
tree*> (tree_operand_check ((new_obj), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2874, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2874, __FUNCTION__))->typed.type))->base.code)
2874 (TREE_OPERAND (new_obj, 0)))((enum tree_code) (((contains_struct_check (((*((const_cast<
tree*> (tree_operand_check ((new_obj), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2874, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2874, __FUNCTION__))->typed.type))->base.code)
== UNION_TYPE
2875 && is_really_empty_class (TREE_TYPE (new_obj)((contains_struct_check ((new_obj), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2875, __FUNCTION__))->typed.type)
,
2876 /*ignore_vptr*/false))
2877 {
2878 tree activate = build2 (MODIFY_EXPR, TREE_TYPE (new_obj)((contains_struct_check ((new_obj), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2878, __FUNCTION__))->typed.type)
,
2879 new_obj,
2880 build_constructor (TREE_TYPE (new_obj)((contains_struct_check ((new_obj), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2880, __FUNCTION__))->typed.type)
,
2881 NULLnullptr));
2882 cxx_eval_constant_expression (ctx, activate, lval,
2883 non_constant_p, overflow_p);
2884 ggc_free (activate);
2885 }
2886 }
2887 else if (VOID_TYPE_P (TREE_TYPE (res))(((enum tree_code) (((contains_struct_check ((res), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2887, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE
)
)
2888 result = void_nodeglobal_trees[TI_VOID];
2889 else
2890 {
2891 result = *ctx->global->values.get (res);
2892 if (result == NULL_TREE(tree) nullptr && !*non_constant_p)
2893 {
2894 if (!ctx->quiet)
2895 error ("%<constexpr%> call flows off the end "
2896 "of the function");
2897 *non_constant_p = true;
2898 }
2899 }
2900
2901 /* At this point, the object's constructor will have run, so
2902 the object is no longer under construction, and its possible
2903 'const' semantics now apply. Make a note of this fact by
2904 marking the CONSTRUCTOR TREE_READONLY. */
2905 if (new_obj && DECL_CONSTRUCTOR_P (fun)((tree_check (((((enum tree_code) (fun)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2905, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fun
)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2905, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
)
2906 cxx_set_object_constness (ctx, new_obj, /*readonly_p=*/true,
2907 non_constant_p, overflow_p);
2908
2909 /* Forget the saved values of the callee's SAVE_EXPRs and
2910 TARGET_EXPRs. */
2911 for (tree save_expr : save_exprs)
2912 ctx->global->values.remove (save_expr);
2913
2914 /* Remove the parms/result from the values map. Is it worth
2915 bothering to do this when the map itself is only live for
2916 one constexpr evaluation? If so, maybe also clear out
2917 other vars from call, maybe in BIND_EXPR handling? */
2918 ctx->global->values.remove (res);
2919 for (tree parm = parms; parm; parm = TREE_CHAIN (parm)((contains_struct_check ((parm), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2919, __FUNCTION__))->common.chain)
)
2920 ctx->global->values.remove (parm);
2921
2922 /* Free any parameter CONSTRUCTORs we aren't returning directly. */
2923 while (!ctors->is_empty ())
2924 {
2925 tree c = ctors->pop ();
2926 if (c != result)
2927 free_constructor (c);
2928 }
2929
2930 /* Make the unshared function copy we used available for re-use. */
2931 save_fundef_copy (fun, copy);
2932
2933 /* If the call allocated some heap object that hasn't been
2934 deallocated during the call, or if it deallocated some heap
2935 object it has not allocated, the call isn't really stateless
2936 for the constexpr evaluation and should not be cached.
2937 It is fine if the call allocates something and deallocates it
2938 too. */
2939 if (entry
2940 && (save_heap_alloc_count != ctx->global->heap_vars.length ()
2941 || (save_heap_dealloc_count
2942 != ctx->global->heap_dealloc_count)))
2943 {
2944 tree heap_var;
2945 unsigned int i;
2946 if ((ctx->global->heap_vars.length ()
2947 - ctx->global->heap_dealloc_count)
2948 != save_heap_alloc_count - save_heap_dealloc_count)
2949 cacheable = false;
2950 else
2951 FOR_EACH_VEC_ELT_FROM (ctx->global->heap_vars, i, heap_var,for (i = (save_heap_alloc_count); (ctx->global->heap_vars
).iterate ((i), &(heap_var)); ++(i))
2952 save_heap_alloc_count)for (i = (save_heap_alloc_count); (ctx->global->heap_vars
).iterate ((i), &(heap_var)); ++(i))
2953 if (DECL_NAME (heap_var)((contains_struct_check ((heap_var), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2953, __FUNCTION__))->decl_minimal.name)
!= heap_deleted_identifiercp_global_trees[CPTI_HEAP_DELETED_IDENTIFIER])
2954 {
2955 cacheable = false;
2956 break;
2957 }
2958 }
2959
2960 /* Rewrite all occurrences of the function's RESULT_DECL with the
2961 current object under construction. */
2962 if (!*non_constant_p && ctx->object
2963 && CLASS_TYPE_P (TREE_TYPE (res))(((((enum tree_code) (((contains_struct_check ((res), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2963, __FUNCTION__))->typed.type))->base.code)) == RECORD_TYPE
|| (((enum tree_code) (((contains_struct_check ((res), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2963, __FUNCTION__))->typed.type))->base.code)) == UNION_TYPE
) && ((tree_class_check ((((contains_struct_check ((res
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2963, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2963, __FUNCTION__))->type_common.lang_flag_5))
2964 && !is_empty_class (TREE_TYPE (res)((contains_struct_check ((res), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2964, __FUNCTION__))->typed.type)
))
2965 if (replace_result_decl (&result, res, ctx->object))
2966 cacheable = false;
2967 }
2968 else
2969 /* Couldn't get a function copy to evaluate. */
2970 *non_constant_p = true;
2971
2972 if (result == error_mark_nodeglobal_trees[TI_ERROR_MARK])
2973 *non_constant_p = true;
2974 if (*non_constant_p || *overflow_p)
2975 result = error_mark_nodeglobal_trees[TI_ERROR_MARK];
2976 else if (!result)
2977 result = void_nodeglobal_trees[TI_VOID];
2978 if (entry)
2979 entry->result = cacheable ? result : error_mark_nodeglobal_trees[TI_ERROR_MARK];
2980 }
2981
2982 /* The result of a constexpr function must be completely initialized.
2983
2984 However, in C++20, a constexpr constructor doesn't necessarily have
2985 to initialize all the fields, so we don't clear CONSTRUCTOR_NO_CLEARING
2986 in order to detect reading an unitialized object in constexpr instead
2987 of value-initializing it. (reduced_constant_expression_p is expected to
2988 take care of clearing the flag.) */
2989 if (TREE_CODE (result)((enum tree_code) (result)->base.code) == CONSTRUCTOR
2990 && (cxx_dialect < cxx20
2991 || !DECL_CONSTRUCTOR_P (fun)((tree_check (((((enum tree_code) (fun)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2991, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fun
)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 2991, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
))
2992 clear_no_implicit_zero (result);
2993
2994 pop_cx_call_context ();
2995 return result;
2996}
2997
2998/* Return true if T is a valid constant initializer. If a CONSTRUCTOR
2999 initializes all the members, the CONSTRUCTOR_NO_CLEARING flag will be
3000 cleared.
3001 FIXME speed this up, it's taking 16% of compile time on sieve testcase. */
3002
3003bool
3004reduced_constant_expression_p (tree t)
3005{
3006 if (t == NULL_TREE(tree) nullptr)
3007 return false;
3008
3009 switch (TREE_CODE (t)((enum tree_code) (t)->base.code))
3010 {
3011 case PTRMEM_CST:
3012 /* Even if we can't lower this yet, it's constant. */
3013 return true;
3014
3015 case CONSTRUCTOR:
3016 /* And we need to handle PTRMEM_CST wrapped in a CONSTRUCTOR. */
3017 tree field;
3018 if (CONSTRUCTOR_NO_CLEARING (t)((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3018, __FUNCTION__, (CONSTRUCTOR)))->base.public_flag)
)
3019 {
3020 if (TREE_CODE (TREE_TYPE (t))((enum tree_code) (((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3020, __FUNCTION__))->typed.type))->base.code)
== VECTOR_TYPE)
3021 /* An initialized vector would have a VECTOR_CST. */
3022 return false;
3023 else if (cxx_dialect >= cxx20
3024 && TREE_CODE (TREE_TYPE (t))((enum tree_code) (((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3024, __FUNCTION__))->typed.type))->base.code)
== ARRAY_TYPE)
3025 {
3026 /* There must be a valid constant initializer at every array
3027 index. */
3028 tree min = TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (t)))((tree_check5 ((((tree_check ((((contains_struct_check ((t), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3028, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3028, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3028, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE
), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.minval
)
;
3029 tree max = TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (t)))((tree_check5 ((((tree_check ((((contains_struct_check ((t), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3029, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3029, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3029, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE
), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval
)
;
3030 tree cursor = min;
3031 for (auto &e: CONSTRUCTOR_ELTS (t)((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3031, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
)
3032 {
3033 if (!reduced_constant_expression_p (e.value))
3034 return false;
3035 if (array_index_cmp (cursor, e.index) != 0)
3036 return false;
3037 if (TREE_CODE (e.index)((enum tree_code) (e.index)->base.code) == RANGE_EXPR)
3038 cursor = TREE_OPERAND (e.index, 1)(*((const_cast<tree*> (tree_operand_check ((e.index), (
1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3038, __FUNCTION__)))))
;
3039 cursor = int_const_binop (PLUS_EXPR, cursor, size_one_nodeglobal_trees[TI_SIZE_ONE]);
3040 }
3041 if (find_array_ctor_elt (t, max) == -1)
3042 return false;
3043 goto ok;
3044 }
3045 else if (cxx_dialect >= cxx20
3046 && TREE_CODE (TREE_TYPE (t))((enum tree_code) (((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3046, __FUNCTION__))->typed.type))->base.code)
== UNION_TYPE)
3047 {
3048 if (CONSTRUCTOR_NELTS (t)(vec_safe_length (((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3048, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
== 0)
3049 /* An initialized union has a constructor element. */
3050 return false;
3051 /* And it only initializes one member. */
3052 field = NULL_TREE(tree) nullptr;
3053 }
3054 else
3055 field = next_initializable_field (TYPE_FIELDS (TREE_TYPE (t))((tree_check3 ((((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3055, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3055, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)
);
3056 }
3057 else
3058 field = NULL_TREE(tree) nullptr;
3059 for (auto &e: CONSTRUCTOR_ELTS (t)((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3059, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
)
3060 {
3061 /* If VAL is null, we're in the middle of initializing this
3062 element. */
3063 if (!reduced_constant_expression_p (e.value))
3064 return false;
3065 /* Empty class field may or may not have an initializer. */
3066 for (; field && e.index != field;
3067 field = next_initializable_field (DECL_CHAIN (field)(((contains_struct_check (((contains_struct_check ((field), (
TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3067, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3067, __FUNCTION__))->common.chain))
))
3068 if (!is_really_empty_class (TREE_TYPE (field)((contains_struct_check ((field), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3068, __FUNCTION__))->typed.type)
,
3069 /*ignore_vptr*/false))
3070 return false;
3071 if (field)
3072 field = next_initializable_field (DECL_CHAIN (field)(((contains_struct_check (((contains_struct_check ((field), (
TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3072, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3072, __FUNCTION__))->common.chain))
);
3073 }
3074 /* There could be a non-empty field at the end. */
3075 for (; field; field = next_initializable_field (DECL_CHAIN (field)(((contains_struct_check (((contains_struct_check ((field), (
TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3075, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3075, __FUNCTION__))->common.chain))
))
3076 if (!is_really_empty_class (TREE_TYPE (field)((contains_struct_check ((field), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3076, __FUNCTION__))->typed.type)
, /*ignore_vptr*/false))
3077 return false;
3078ok:
3079 if (CONSTRUCTOR_NO_CLEARING (t)((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3079, __FUNCTION__, (CONSTRUCTOR)))->base.public_flag)
)
3080 /* All the fields are initialized. */
3081 CONSTRUCTOR_NO_CLEARING (t)((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3081, __FUNCTION__, (CONSTRUCTOR)))->base.public_flag)
= false;
3082 return true;
3083
3084 default:
3085 /* FIXME are we calling this too much? */
3086 return initializer_constant_valid_p (t, TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3086, __FUNCTION__))->typed.type)
) != NULL_TREE(tree) nullptr;
3087 }
3088}
3089
3090/* Some expressions may have constant operands but are not constant
3091 themselves, such as 1/0. Call this function to check for that
3092 condition.
3093
3094 We only call this in places that require an arithmetic constant, not in
3095 places where we might have a non-constant expression that can be a
3096 component of a constant expression, such as the address of a constexpr
3097 variable that might be dereferenced later. */
3098
3099static bool
3100verify_constant (tree t, bool allow_non_constant, bool *non_constant_p,
3101 bool *overflow_p)
3102{
3103 if (!*non_constant_p && !reduced_constant_expression_p (t)
3104 && t != void_nodeglobal_trees[TI_VOID])
3105 {
3106 if (!allow_non_constant)
3107 error ("%q+E is not a constant expression", t);
3108 *non_constant_p = true;
3109 }
3110 if (TREE_OVERFLOW_P (t)((tree_code_type[(int) (((enum tree_code) (t)->base.code))
] == tcc_constant) && ((tree_class_check ((t), (tcc_constant
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3110, __FUNCTION__))->base.public_flag))
)
3111 {
3112 if (!allow_non_constant)
3113 {
3114 permerror (input_location, "overflow in constant expression");
3115 /* If we're being permissive (and are in an enforcing
3116 context), ignore the overflow. */
3117 if (flag_permissiveglobal_options.x_flag_permissive)
3118 return *non_constant_p;
3119 }
3120 *overflow_p = true;
3121 }
3122 return *non_constant_p;
3123}
3124
3125/* Check whether the shift operation with code CODE and type TYPE on LHS
3126 and RHS is undefined. If it is, give an error with an explanation,
3127 and return true; return false otherwise. */
3128
3129static bool
3130cxx_eval_check_shift_p (location_t loc, const constexpr_ctx *ctx,
3131 enum tree_code code, tree type, tree lhs, tree rhs)
3132{
3133 if ((code != LSHIFT_EXPR && code != RSHIFT_EXPR)
3134 || TREE_CODE (lhs)((enum tree_code) (lhs)->base.code) != INTEGER_CST
3135 || TREE_CODE (rhs)((enum tree_code) (rhs)->base.code) != INTEGER_CST)
3136 return false;
3137
3138 tree lhstype = TREE_TYPE (lhs)((contains_struct_check ((lhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3138, __FUNCTION__))->typed.type)
;
3139 unsigned HOST_WIDE_INTlong uprec = TYPE_PRECISION (TREE_TYPE (lhs))((tree_class_check ((((contains_struct_check ((lhs), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3139, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3139, __FUNCTION__))->type_common.precision)
;
3140
3141 /* [expr.shift] The behavior is undefined if the right operand
3142 is negative, or greater than or equal to the length in bits
3143 of the promoted left operand. */
3144 if (tree_int_cst_sgn (rhs) == -1)
3145 {
3146 if (!ctx->quiet)
3147 permerror (loc, "right operand of shift expression %q+E is negative",
3148 build2_loc (loc, code, type, lhs, rhs));
3149 return (!flag_permissiveglobal_options.x_flag_permissive || ctx->quiet);
3150 }
3151 if (compare_tree_int (rhs, uprec) >= 0)
3152 {
3153 if (!ctx->quiet)
3154 permerror (loc, "right operand of shift expression %q+E is greater "
3155 "than or equal to the precision %wu of the left operand",
3156 build2_loc (loc, code, type, lhs, rhs), uprec);
3157 return (!flag_permissiveglobal_options.x_flag_permissive || ctx->quiet);
3158 }
3159
3160 /* The value of E1 << E2 is E1 left-shifted E2 bit positions; [...]
3161 if E1 has a signed type and non-negative value, and E1x2^E2 is
3162 representable in the corresponding unsigned type of the result type,
3163 then that value, converted to the result type, is the resulting value;
3164 otherwise, the behavior is undefined.
3165 For C++20:
3166 The value of E1 << E2 is the unique value congruent to E1 x 2^E2 modulo
3167 2^N, where N is the range exponent of the type of the result. */
3168 if (code == LSHIFT_EXPR
3169 && !TYPE_UNSIGNED (lhstype)((tree_class_check ((lhstype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3169, __FUNCTION__))->base.u.bits.unsigned_flag)
3170 && cxx_dialect >= cxx11
3171 && cxx_dialect < cxx20)
3172 {
3173 if (tree_int_cst_sgn (lhs) == -1)
3174 {
3175 if (!ctx->quiet)
3176 permerror (loc,
3177 "left operand of shift expression %q+E is negative",
3178 build2_loc (loc, code, type, lhs, rhs));
3179 return (!flag_permissiveglobal_options.x_flag_permissive || ctx->quiet);
3180 }
3181 /* For signed x << y the following:
3182 (unsigned) x >> ((prec (lhs) - 1) - y)
3183 if > 1, is undefined. The right-hand side of this formula
3184 is the highest bit of the LHS that can be set (starting from 0),
3185 so that the shift doesn't overflow. We then right-shift the LHS
3186 to see whether any other bit is set making the original shift
3187 undefined -- the result is not representable in the corresponding
3188 unsigned type. */
3189 tree t = build_int_cst (unsigned_type_nodeinteger_types[itk_unsigned_int], uprec - 1);
3190 t = fold_build2 (MINUS_EXPR, unsigned_type_node, t, rhs)fold_build2_loc (((location_t) 0), MINUS_EXPR, integer_types[
itk_unsigned_int], t, rhs )
;
3191 tree ulhs = fold_convert (unsigned_type_for (lhstype), lhs)fold_convert_loc (((location_t) 0), unsigned_type_for (lhstype
), lhs)
;
3192 t = fold_build2 (RSHIFT_EXPR, TREE_TYPE (ulhs), ulhs, t)fold_build2_loc (((location_t) 0), RSHIFT_EXPR, ((contains_struct_check
((ulhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3192, __FUNCTION__))->typed.type), ulhs, t )
;
3193 if (tree_int_cst_lt (integer_one_nodeglobal_trees[TI_INTEGER_ONE], t))
3194 {
3195 if (!ctx->quiet)
3196 permerror (loc, "shift expression %q+E overflows",
3197 build2_loc (loc, code, type, lhs, rhs));
3198 return (!flag_permissiveglobal_options.x_flag_permissive || ctx->quiet);
3199 }
3200 }
3201 return false;
3202}
3203
3204/* Subroutine of cxx_eval_constant_expression.
3205 Attempt to reduce the unary expression tree T to a compile time value.
3206 If successful, return the value. Otherwise issue a diagnostic
3207 and return error_mark_node. */
3208
3209static tree
3210cxx_eval_unary_expression (const constexpr_ctx *ctx, tree t,
3211 bool /*lval*/,
3212 bool *non_constant_p, bool *overflow_p)
3213{
3214 tree r;
3215 tree orig_arg = TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3215, __FUNCTION__)))))
;
3216 tree arg = cxx_eval_constant_expression (ctx, orig_arg, /*lval*/false,
3217 non_constant_p, overflow_p);
3218 VERIFY_CONSTANT (arg)do { if (verify_constant ((arg), ctx->quiet, non_constant_p
, overflow_p)) return t; } while (0)
;
3219 location_t 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))
;
3220 enum tree_code code = TREE_CODE (t)((enum tree_code) (t)->base.code);
3221 tree type = TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3221, __FUNCTION__))->typed.type)
;
3222 r = fold_unary_loc (loc, code, type, arg);
3223 if (r == NULL_TREE(tree) nullptr)
3224 {
3225 if (arg == orig_arg)
3226 r = t;
3227 else
3228 r = build1_loc (loc, code, type, arg);
3229 }
3230 VERIFY_CONSTANT (r)do { if (verify_constant ((r), ctx->quiet, non_constant_p,
overflow_p)) return t; } while (0)
;
3231 return r;
3232}
3233
3234/* Helper function for cxx_eval_binary_expression. Try to optimize
3235 original POINTER_PLUS_EXPR T, LHS p+ RHS, return NULL_TREE if the
3236 generic folding should be used. */
3237
3238static tree
3239cxx_fold_pointer_plus_expression (const constexpr_ctx *ctx, tree t,
3240 tree lhs, tree rhs, bool *non_constant_p,
3241 bool *overflow_p)
3242{
3243 STRIP_NOPS (lhs)(lhs) = tree_strip_nop_conversions ((const_cast<union tree_node
*> (((lhs)))))
;
3244 if (TREE_CODE (lhs)((enum tree_code) (lhs)->base.code) != ADDR_EXPR)
3245 return NULL_TREE(tree) nullptr;
3246
3247 lhs = TREE_OPERAND (lhs, 0)(*((const_cast<tree*> (tree_operand_check ((lhs), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3247, __FUNCTION__)))))
;
3248
3249 /* &A[i] p+ j => &A[i + j] */
3250 if (TREE_CODE (lhs)((enum tree_code) (lhs)->base.code) == ARRAY_REF
3251 && TREE_CODE (TREE_OPERAND (lhs, 1))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check
((lhs), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3251, __FUNCTION__))))))->base.code)
== INTEGER_CST
3252 && TREE_CODE (rhs)((enum tree_code) (rhs)->base.code) == INTEGER_CST
3253 && TYPE_SIZE_UNIT (TREE_TYPE (lhs))((tree_class_check ((((contains_struct_check ((lhs), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3253, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3253, __FUNCTION__))->type_common.size_unit)
3254 && TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (lhs)))((enum tree_code) (((tree_class_check ((((contains_struct_check
((lhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3254, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3254, __FUNCTION__))->type_common.size_unit))->base.code
)
== INTEGER_CST)
3255 {
3256 tree orig_type = TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3256, __FUNCTION__))->typed.type)
;
3257 location_t 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))
;
3258 tree type = TREE_TYPE (lhs)((contains_struct_check ((lhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3258, __FUNCTION__))->typed.type)
;
3259
3260 t = fold_convert_loc (loc, ssizetypesizetype_tab[(int) stk_ssizetype], TREE_OPERAND (lhs, 1)(*((const_cast<tree*> (tree_operand_check ((lhs), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3260, __FUNCTION__)))))
);
3261 tree nelts = array_type_nelts_top (TREE_TYPE (TREE_OPERAND (lhs, 0))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check
((lhs), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3261, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3261, __FUNCTION__))->typed.type)
);
3262 nelts = cxx_eval_constant_expression (ctx, nelts, false, non_constant_p,
3263 overflow_p);
3264 if (*non_constant_p)
3265 return NULL_TREE(tree) nullptr;
3266 /* Don't fold an out-of-bound access. */
3267 if (!tree_int_cst_le (t, nelts))
3268 return NULL_TREE(tree) nullptr;
3269 rhs = cp_fold_convert (ssizetypesizetype_tab[(int) stk_ssizetype], rhs);
3270 /* Don't fold if rhs can't be divided exactly by TYPE_SIZE_UNIT.
3271 constexpr int A[1]; ... (char *)&A[0] + 1 */
3272 if (!integer_zerop (fold_build2_loc (loc, TRUNC_MOD_EXPR, sizetypesizetype_tab[(int) stk_sizetype],
3273 rhs, TYPE_SIZE_UNIT (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3273, __FUNCTION__))->type_common.size_unit)
)))
3274 return NULL_TREE(tree) nullptr;
3275 /* Make sure to treat the second operand of POINTER_PLUS_EXPR
3276 as signed. */
3277 rhs = fold_build2_loc (loc, EXACT_DIV_EXPR, ssizetypesizetype_tab[(int) stk_ssizetype], rhs,
3278 TYPE_SIZE_UNIT (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3278, __FUNCTION__))->type_common.size_unit)
);
3279 t = size_binop_loc (loc, PLUS_EXPR, rhs, t);
3280 t = build4_loc (loc, ARRAY_REF, type, TREE_OPERAND (lhs, 0)(*((const_cast<tree*> (tree_operand_check ((lhs), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3280, __FUNCTION__)))))
,
3281 t, NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr);
3282 t = cp_build_addr_expr (t, tf_warning_or_error);
3283 t = cp_fold_convert (orig_type, t);
3284 return cxx_eval_constant_expression (ctx, t, /*lval*/false,
3285 non_constant_p, overflow_p);
3286 }
3287
3288 return NULL_TREE(tree) nullptr;
3289}
3290
3291/* Subroutine of cxx_eval_constant_expression.
3292 Like cxx_eval_unary_expression, except for binary expressions. */
3293
3294static tree
3295cxx_eval_binary_expression (const constexpr_ctx *ctx, tree t,
3296 bool lval,
3297 bool *non_constant_p, bool *overflow_p)
3298{
3299 tree r = NULL_TREE(tree) nullptr;
3300 tree orig_lhs = TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3300, __FUNCTION__)))))
;
3301 tree orig_rhs = TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3301, __FUNCTION__)))))
;
3302 tree lhs, rhs;
3303 lhs = cxx_eval_constant_expression (ctx, orig_lhs, /*lval*/false,
3304 non_constant_p, overflow_p);
3305 /* Don't VERIFY_CONSTANT here, it's unnecessary and will break pointer
3306 subtraction. */
3307 if (*non_constant_p)
3308 return t;
3309 rhs = cxx_eval_constant_expression (ctx, orig_rhs, /*lval*/false,
3310 non_constant_p, overflow_p);
3311 if (*non_constant_p)
3312 return t;
3313
3314 location_t 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))
;
3315 enum tree_code code = TREE_CODE (t)((enum tree_code) (t)->base.code);
3316 tree type = TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3316, __FUNCTION__))->typed.type)
;
3317
3318 if (code == EQ_EXPR || code == NE_EXPR)
3319 {
3320 bool is_code_eq = (code == EQ_EXPR);
3321
3322 if (TREE_CODE (lhs)((enum tree_code) (lhs)->base.code) == PTRMEM_CST
3323 && TREE_CODE (rhs)((enum tree_code) (rhs)->base.code) == PTRMEM_CST)
3324 {
3325 tree lmem = PTRMEM_CST_MEMBER (lhs)(((ptrmem_cst_t)(tree_check ((lhs), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3325, __FUNCTION__, (PTRMEM_CST))))->member)
;
3326 tree rmem = PTRMEM_CST_MEMBER (rhs)(((ptrmem_cst_t)(tree_check ((rhs), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3326, __FUNCTION__, (PTRMEM_CST))))->member)
;
3327 bool eq;
3328 if (TREE_CODE (lmem)((enum tree_code) (lmem)->base.code) == TREE_CODE (rmem)((enum tree_code) (rmem)->base.code)
3329 && TREE_CODE (lmem)((enum tree_code) (lmem)->base.code) == FIELD_DECL
3330 && TREE_CODE (DECL_CONTEXT (lmem))((enum tree_code) (((contains_struct_check ((lmem), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3330, __FUNCTION__))->decl_minimal.context))->base.code
)
== UNION_TYPE
3331 && same_type_p (DECL_CONTEXT (lmem),comptypes ((((contains_struct_check ((lmem), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3331, __FUNCTION__))->decl_minimal.context)), (((contains_struct_check
((rmem), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3332, __FUNCTION__))->decl_minimal.context)), 0)
3332 DECL_CONTEXT (rmem))comptypes ((((contains_struct_check ((lmem), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3331, __FUNCTION__))->decl_minimal.context)), (((contains_struct_check
((rmem), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3332, __FUNCTION__))->decl_minimal.context)), 0)
)
3333 /* If both refer to (possibly different) members of the same union
3334 (12.3), they compare equal. */
3335 eq = true;
3336 else
3337 eq = cp_tree_equal (lhs, rhs);
3338 r = constant_boolean_node (eq == is_code_eq, type);
3339 }
3340 else if ((TREE_CODE (lhs)((enum tree_code) (lhs)->base.code) == PTRMEM_CST
3341 || TREE_CODE (rhs)((enum tree_code) (rhs)->base.code) == PTRMEM_CST)
3342 && (null_member_pointer_value_p (lhs)
3343 || null_member_pointer_value_p (rhs)))
3344 r = constant_boolean_node (!is_code_eq, type);
3345 else if (TREE_CODE (lhs)((enum tree_code) (lhs)->base.code) == PTRMEM_CST)
3346 lhs = cplus_expand_constant (lhs);
3347 else if (TREE_CODE (rhs)((enum tree_code) (rhs)->base.code) == PTRMEM_CST)
3348 rhs = cplus_expand_constant (rhs);
3349 }
3350 if (code == POINTER_PLUS_EXPR && !*non_constant_p
3351 && integer_zerop (lhs) && !integer_zerop (rhs))
3352 {
3353 if (!ctx->quiet)
3354 error ("arithmetic involving a null pointer in %qE", lhs);
3355 *non_constant_p = true;
3356 return t;
3357 }
3358 else if (code == POINTER_PLUS_EXPR)
3359 r = cxx_fold_pointer_plus_expression (ctx, t, lhs, rhs, non_constant_p,
3360 overflow_p);
3361 else if (code == SPACESHIP_EXPR)
3362 {
3363 r = genericize_spaceship (loc, type, lhs, rhs);
3364 return cxx_eval_constant_expression (ctx, r, lval, non_constant_p,
3365 overflow_p);
3366 }
3367
3368 if (r == NULL_TREE(tree) nullptr)
3369 r = fold_binary_loc (loc, code, type, lhs, rhs);
3370
3371 if (r == NULL_TREE(tree) nullptr
3372 && (code == LSHIFT_EXPR || code == RSHIFT_EXPR)
3373 && TREE_CODE (lhs)((enum tree_code) (lhs)->base.code) == INTEGER_CST
3374 && TREE_CODE (rhs)((enum tree_code) (rhs)->base.code) == INTEGER_CST
3375 && wi::neg_p (wi::to_wide (rhs)))
3376 {
3377 /* For diagnostics and -fpermissive emulate previous behavior of
3378 handling shifts by negative amount. */
3379 tree nrhs = const_unop (NEGATE_EXPR, TREE_TYPE (rhs)((contains_struct_check ((rhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3379, __FUNCTION__))->typed.type)
, rhs);
3380 if (nrhs)
3381 r = fold_binary_loc (loc,
3382 code == LSHIFT_EXPR ? RSHIFT_EXPR : LSHIFT_EXPR,
3383 type, lhs, nrhs);
3384 }
3385
3386 if (r == NULL_TREE(tree) nullptr)
3387 {
3388 if (lhs == orig_lhs && rhs == orig_rhs)
3389 r = t;
3390 else
3391 r = build2_loc (loc, code, type, lhs, rhs);
3392 }
3393 else if (cxx_eval_check_shift_p (loc, ctx, code, type, lhs, rhs))
3394 *non_constant_p = true;
3395 /* Don't VERIFY_CONSTANT if this might be dealing with a pointer to
3396 a local array in a constexpr function. */
3397 bool ptr = INDIRECT_TYPE_P (TREE_TYPE (lhs))((((enum tree_code) (((contains_struct_check ((lhs), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3397, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE
) || (((enum tree_code) (((contains_struct_check ((lhs), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3397, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
))
;
3398 if (!ptr)
3399 VERIFY_CONSTANT (r)do { if (verify_constant ((r), ctx->quiet, non_constant_p,
overflow_p)) return t; } while (0)
;
3400 return r;
3401}
3402
3403/* Subroutine of cxx_eval_constant_expression.
3404 Attempt to evaluate condition expressions. Dead branches are not
3405 looked into. */
3406
3407static tree
3408cxx_eval_conditional_expression (const constexpr_ctx *ctx, tree t,
3409 bool lval,
3410 bool *non_constant_p, bool *overflow_p,
3411 tree *jump_target)
3412{
3413 tree val = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3413, __FUNCTION__)))))
,
3414 /*lval*/false,
3415 non_constant_p, overflow_p);
3416 VERIFY_CONSTANT (val)do { if (verify_constant ((val), ctx->quiet, non_constant_p
, overflow_p)) return t; } while (0)
;
3417 if (TREE_CODE (t)((enum tree_code) (t)->base.code) == IF_STMT && IF_STMT_CONSTEVAL_P (t)((tree_not_check2 (((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3417, __FUNCTION__, (IF_STMT)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3417, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_2)
)
3418 {
3419 /* Evaluate the condition as if it was
3420 if (__builtin_is_constant_evaluated ()), i.e. defer it if not
3421 ctx->manifestly_const_eval (as sometimes we try to constant evaluate
3422 without manifestly_const_eval even expressions or parts thereof which
3423 will later be manifestly const_eval evaluated), otherwise fold it to
3424 true. */
3425 if (ctx->manifestly_const_eval)
3426 val = boolean_true_nodeglobal_trees[TI_BOOLEAN_TRUE];
3427 else
3428 {
3429 *non_constant_p = true;
3430 return t;
3431 }
3432 }
3433 /* Don't VERIFY_CONSTANT the other operands. */
3434 if (integer_zerop (val))
3435 val = TREE_OPERAND (t, 2)(*((const_cast<tree*> (tree_operand_check ((t), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3435, __FUNCTION__)))))
;
3436 else
3437 val = TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3437, __FUNCTION__)))))
;
3438 if (TREE_CODE (t)((enum tree_code) (t)->base.code) == IF_STMT && !val)
3439 val = void_nodeglobal_trees[TI_VOID];
3440 return cxx_eval_constant_expression (ctx, val, lval, non_constant_p,
3441 overflow_p, jump_target);
3442}
3443
3444/* Subroutine of cxx_eval_constant_expression.
3445 Attempt to evaluate vector condition expressions. Unlike
3446 cxx_eval_conditional_expression, VEC_COND_EXPR acts like a normal
3447 ternary arithmetics operation, where all 3 arguments have to be
3448 evaluated as constants and then folding computes the result from
3449 them. */
3450
3451static tree
3452cxx_eval_vector_conditional_expression (const constexpr_ctx *ctx, tree t,
3453 bool *non_constant_p, bool *overflow_p)
3454{
3455 tree arg1 = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3455, __FUNCTION__)))))
,
3456 /*lval*/false,
3457 non_constant_p, overflow_p);
3458 VERIFY_CONSTANT (arg1)do { if (verify_constant ((arg1), ctx->quiet, non_constant_p
, overflow_p)) return t; } while (0)
;
3459 tree arg2 = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3459, __FUNCTION__)))))
,
3460 /*lval*/false,
3461 non_constant_p, overflow_p);
3462 VERIFY_CONSTANT (arg2)do { if (verify_constant ((arg2), ctx->quiet, non_constant_p
, overflow_p)) return t; } while (0)
;
3463 tree arg3 = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 2)(*((const_cast<tree*> (tree_operand_check ((t), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3463, __FUNCTION__)))))
,
3464 /*lval*/false,
3465 non_constant_p, overflow_p);
3466 VERIFY_CONSTANT (arg3)do { if (verify_constant ((arg3), ctx->quiet, non_constant_p
, overflow_p)) return t; } while (0)
;
3467 location_t 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))
;
3468 tree type = TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3468, __FUNCTION__))->typed.type)
;
3469 tree r = fold_ternary_loc (loc, VEC_COND_EXPR, type, arg1, arg2, arg3);
3470 if (r == NULL_TREE(tree) nullptr)
3471 {
3472 if (arg1 == TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3472, __FUNCTION__)))))
3473 && arg2 == TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3473, __FUNCTION__)))))
3474 && arg3 == TREE_OPERAND (t, 2)(*((const_cast<tree*> (tree_operand_check ((t), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3474, __FUNCTION__)))))
)
3475 r = t;
3476 else
3477 r = build3_loc (loc, VEC_COND_EXPR, type, arg1, arg2, arg3);
3478 }
3479 VERIFY_CONSTANT (r)do { if (verify_constant ((r), ctx->quiet, non_constant_p,
overflow_p)) return t; } while (0)
;
3480 return r;
3481}
3482
3483/* Returns less than, equal to, or greater than zero if KEY is found to be
3484 less than, to match, or to be greater than the constructor_elt's INDEX. */
3485
3486static int
3487array_index_cmp (tree key, tree index)
3488{
3489 gcc_assert (TREE_CODE (key) == INTEGER_CST)((void)(!(((enum tree_code) (key)->base.code) == INTEGER_CST
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3489, __FUNCTION__), 0 : 0))
;
3490
3491 switch (TREE_CODE (index)((enum tree_code) (index)->base.code))
3492 {
3493 case INTEGER_CST:
3494 return tree_int_cst_compare (key, index);
3495 case RANGE_EXPR:
3496 {
3497 tree lo = TREE_OPERAND (index, 0)(*((const_cast<tree*> (tree_operand_check ((index), (0)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3497, __FUNCTION__)))))
;
3498 tree hi = TREE_OPERAND (index, 1)(*((const_cast<tree*> (tree_operand_check ((index), (1)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3498, __FUNCTION__)))))
;
3499 if (tree_int_cst_lt (key, lo))
3500 return -1;
3501 else if (tree_int_cst_lt (hi, key))
3502 return 1;
3503 else
3504 return 0;
3505 }
3506 default:
3507 gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3507, __FUNCTION__))
;
3508 }
3509}
3510
3511/* Returns the index of the constructor_elt of ARY which matches DINDEX, or -1
3512 if none. If INSERT is true, insert a matching element rather than fail. */
3513
3514static HOST_WIDE_INTlong
3515find_array_ctor_elt (tree ary, tree dindex, bool insert)
3516{
3517 if (tree_int_cst_sgn (dindex) < 0)
3518 return -1;
3519
3520 unsigned HOST_WIDE_INTlong i = tree_to_uhwi (dindex);
3521 vec<constructor_elt, va_gc> *elts = CONSTRUCTOR_ELTS (ary)((tree_check ((ary), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3521, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
;
3522 unsigned HOST_WIDE_INTlong len = vec_safe_length (elts);
3523
3524 unsigned HOST_WIDE_INTlong end = len;
3525 unsigned HOST_WIDE_INTlong begin = 0;
3526
3527 /* If the last element of the CONSTRUCTOR has its own index, we can assume
3528 that the same is true of the other elements and index directly. */
3529 if (end > 0)
3530 {
3531 tree cindex = (*elts)[end - 1].index;
3532 if (cindex == NULL_TREE(tree) nullptr)
3533 {
3534 /* Verify that if the last index is missing, all indexes
3535 are missing. */
3536 if (flag_checkingglobal_options.x_flag_checking)
3537 for (unsigned int j = 0; j < len - 1; ++j)
3538 gcc_assert ((*elts)[j].index == NULL_TREE)((void)(!((*elts)[j].index == (tree) nullptr) ? fancy_abort (
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3538, __FUNCTION__), 0 : 0))
;
3539 if (i < end)
3540 return i;
3541 else
3542 {
3543 begin = end;
3544 if (i == end)
3545 /* If the element is to be added right at the end,
3546 make sure it is added with cleared index too. */
3547 dindex = NULL_TREE(tree) nullptr;
3548 else if (insert)
3549 /* Otherwise, in order not to break the assumption
3550 that CONSTRUCTOR either has all indexes or none,
3551 we need to add indexes to all elements. */
3552 for (unsigned int j = 0; j < len; ++j)
3553 (*elts)[j].index = build_int_cst (TREE_TYPE (dindex)((contains_struct_check ((dindex), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3553, __FUNCTION__))->typed.type)
, j);
3554 }
3555 }
3556 else if (TREE_CODE (cindex)((enum tree_code) (cindex)->base.code) == INTEGER_CST
3557 && compare_tree_int (cindex, end - 1) == 0)
3558 {
3559 if (i < end)
3560 return i;
3561 else
3562 begin = end;
3563 }
3564 }
3565
3566 /* Otherwise, find a matching index by means of a binary search. */
3567 while (begin != end)
3568 {
3569 unsigned HOST_WIDE_INTlong middle = (begin + end) / 2;
3570 constructor_elt &elt = (*elts)[middle];
3571 tree idx = elt.index;
3572
3573 int cmp = array_index_cmp (dindex, idx);
3574 if (cmp < 0)
3575 end = middle;
3576 else if (cmp > 0)
3577 begin = middle + 1;
3578 else
3579 {
3580 if (insert && TREE_CODE (idx)((enum tree_code) (idx)->base.code) == RANGE_EXPR)
3581 {
3582 /* We need to split the range. */
3583 constructor_elt e;
3584 tree lo = TREE_OPERAND (idx, 0)(*((const_cast<tree*> (tree_operand_check ((idx), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3584, __FUNCTION__)))))
;
3585 tree hi = TREE_OPERAND (idx, 1)(*((const_cast<tree*> (tree_operand_check ((idx), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3585, __FUNCTION__)))))
;
3586 tree value = elt.value;
3587 dindex = fold_convert (sizetype, dindex)fold_convert_loc (((location_t) 0), sizetype_tab[(int) stk_sizetype
], dindex)
;
3588 if (tree_int_cst_lt (lo, dindex))
3589 {
3590 /* There are still some lower elts; shorten the range. */
3591 tree new_hi = int_const_binop (MINUS_EXPR, dindex,
3592 size_one_nodeglobal_trees[TI_SIZE_ONE]);
3593 if (tree_int_cst_equal (lo, new_hi))
3594 /* Only one element left, no longer a range. */
3595 elt.index = lo;
3596 else
3597 TREE_OPERAND (idx, 1)(*((const_cast<tree*> (tree_operand_check ((idx), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3597, __FUNCTION__)))))
= new_hi;
3598 /* Append the element we want to insert. */
3599 ++middle;
3600 e.index = dindex;
3601 e.value = unshare_constructor (value);
3602 vec_safe_insert (CONSTRUCTOR_ELTS (ary)((tree_check ((ary), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3602, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
, middle, e);
3603 }
3604 else
3605 /* No lower elts, the range elt is now ours. */
3606 elt.index = dindex;
3607
3608 if (tree_int_cst_lt (dindex, hi))
3609 {
3610 /* There are still some higher elts; append a range. */
3611 tree new_lo = int_const_binop (PLUS_EXPR, dindex,
3612 size_one_nodeglobal_trees[TI_SIZE_ONE]);
3613 if (tree_int_cst_equal (new_lo, hi))
3614 e.index = hi;
3615 else
3616 e.index = build2 (RANGE_EXPR, sizetypesizetype_tab[(int) stk_sizetype], new_lo, hi);
3617 e.value = unshare_constructor (value);
3618 vec_safe_insert (CONSTRUCTOR_ELTS (ary)((tree_check ((ary), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3618, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
, middle + 1, e);
3619 }
3620 }
3621 return middle;
3622 }
3623 }
3624
3625 if (insert)
3626 {
3627 constructor_elt e = { dindex, NULL_TREE(tree) nullptr };
3628 vec_safe_insert (CONSTRUCTOR_ELTS (ary)((tree_check ((ary), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3628, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
, end, e);
3629 return end;
3630 }
3631
3632 return -1;
3633}
3634
3635/* Return a pointer to the constructor_elt of CTOR which matches INDEX. If no
3636 matching constructor_elt exists, then add one to CTOR.
3637
3638 As an optimization, if POS_HINT is non-negative then it is used as a guess
3639 for the (integer) index of the matching constructor_elt within CTOR. */
3640
3641static constructor_elt *
3642get_or_insert_ctor_field (tree ctor, tree index, int pos_hint = -1)
3643{
3644 /* Check the hint first. */
3645 if (pos_hint >= 0 && (unsigned)pos_hint < CONSTRUCTOR_NELTS (ctor)(vec_safe_length (((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3645, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
3646 && CONSTRUCTOR_ELT (ctor, pos_hint)(&(*((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3646, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
pos_hint])
->index == index)
3647 return CONSTRUCTOR_ELT (ctor, pos_hint)(&(*((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3647, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
pos_hint])
;
3648
3649 tree type = TREE_TYPE (ctor)((contains_struct_check ((ctor), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3649, __FUNCTION__))->typed.type)
;
3650 if (TREE_CODE (type)((enum tree_code) (type)->base.code) == VECTOR_TYPE && index == NULL_TREE(tree) nullptr)
3651 {
3652 CONSTRUCTOR_APPEND_ELT (CONSTRUCTOR_ELTS (ctor), index, NULL_TREE)do { constructor_elt _ce___ = {index, (tree) nullptr}; vec_safe_push
((((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3652, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)),
_ce___); } while (0)
;
3653 return &CONSTRUCTOR_ELTS (ctor)((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3653, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
->last();
3654 }
3655 else if (TREE_CODE (type)((enum tree_code) (type)->base.code) == ARRAY_TYPE || TREE_CODE (type)((enum tree_code) (type)->base.code) == VECTOR_TYPE)
3656 {
3657 if (TREE_CODE (index)((enum tree_code) (index)->base.code) == RANGE_EXPR)
3658 {
3659 /* Support for RANGE_EXPR index lookups is currently limited to
3660 accessing an existing element via POS_HINT, or appending a new
3661 element to the end of CTOR. ??? Support for other access
3662 patterns may also be needed. */
3663 vec<constructor_elt, va_gc> *elts = CONSTRUCTOR_ELTS (ctor)((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3663, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
;
3664 if (vec_safe_length (elts))
3665 {
3666 tree lo = TREE_OPERAND (index, 0)(*((const_cast<tree*> (tree_operand_check ((index), (0)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3666, __FUNCTION__)))))
;
3667 gcc_assert (array_index_cmp (elts->last().index, lo) < 0)((void)(!(array_index_cmp (elts->last().index, lo) < 0)
? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3667, __FUNCTION__), 0 : 0))
;
3668 }
3669 CONSTRUCTOR_APPEND_ELT (elts, index, NULL_TREE)do { constructor_elt _ce___ = {index, (tree) nullptr}; vec_safe_push
((elts), _ce___); } while (0)
;
3670 return &elts->last();
3671 }
3672
3673 HOST_WIDE_INTlong i = find_array_ctor_elt (ctor, index, /*insert*/true);
3674 gcc_assert (i >= 0)((void)(!(i >= 0) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3674, __FUNCTION__), 0 : 0))
;
3675 constructor_elt *cep = CONSTRUCTOR_ELT (ctor, i)(&(*((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3675, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
i])
;
3676 gcc_assert (cep->index == NULL_TREE((void)(!(cep->index == (tree) nullptr || ((enum tree_code
) (cep->index)->base.code) != RANGE_EXPR) ? fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3677, __FUNCTION__), 0 : 0))
3677 || TREE_CODE (cep->index) != RANGE_EXPR)((void)(!(cep->index == (tree) nullptr || ((enum tree_code
) (cep->index)->base.code) != RANGE_EXPR) ? fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3677, __FUNCTION__), 0 : 0))
;
3678 return cep;
3679 }
3680 else
3681 {
3682 gcc_assert (TREE_CODE (index) == FIELD_DECL((void)(!(((enum tree_code) (index)->base.code) == FIELD_DECL
&& (same_type_ignoring_top_level_qualifiers_p (((contains_struct_check
((index), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3684, __FUNCTION__))->decl_minimal.context), ((contains_struct_check
((ctor), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3684, __FUNCTION__))->typed.type)))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3684, __FUNCTION__), 0 : 0))
3683 && (same_type_ignoring_top_level_qualifiers_p((void)(!(((enum tree_code) (index)->base.code) == FIELD_DECL
&& (same_type_ignoring_top_level_qualifiers_p (((contains_struct_check
((index), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3684, __FUNCTION__))->decl_minimal.context), ((contains_struct_check
((ctor), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3684, __FUNCTION__))->typed.type)))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3684, __FUNCTION__), 0 : 0))
3684 (DECL_CONTEXT (index), TREE_TYPE (ctor))))((void)(!(((enum tree_code) (index)->base.code) == FIELD_DECL
&& (same_type_ignoring_top_level_qualifiers_p (((contains_struct_check
((index), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3684, __FUNCTION__))->decl_minimal.context), ((contains_struct_check
((ctor), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3684, __FUNCTION__))->typed.type)))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3684, __FUNCTION__), 0 : 0))
;
3685
3686 /* We must keep the CONSTRUCTOR's ELTS in FIELD order.
3687 Usually we meet initializers in that order, but it is
3688 possible for base types to be placed not in program
3689 order. */
3690 tree fields = TYPE_FIELDS (DECL_CONTEXT (index))((tree_check3 ((((contains_struct_check ((index), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3690, __FUNCTION__))->decl_minimal.context)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3690, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)
;
3691 unsigned HOST_WIDE_INTlong idx = 0;
3692 constructor_elt *cep = NULLnullptr;
3693
3694 /* Check if we're changing the active member of a union. */
3695 if (TREE_CODE (type)((enum tree_code) (type)->base.code) == UNION_TYPE && CONSTRUCTOR_NELTS (ctor)(vec_safe_length (((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3695, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
3696 && CONSTRUCTOR_ELT (ctor, 0)(&(*((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3696, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
0])
->index != index)
3697 vec_safe_truncate (CONSTRUCTOR_ELTS (ctor)((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3697, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
, 0);
3698 /* If the bit offset of INDEX is larger than that of the last
3699 constructor_elt, then we can just immediately append a new
3700 constructor_elt to the end of CTOR. */
3701 else if (CONSTRUCTOR_NELTS (ctor)(vec_safe_length (((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3701, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
3702 && tree_int_cst_compare (bit_position (index),
3703 bit_position (CONSTRUCTOR_ELTS (ctor)((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3703, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
3704 ->last().index)) > 0)
3705 {
3706 idx = CONSTRUCTOR_NELTS (ctor)(vec_safe_length (((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3706, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
;
3707 goto insert;
3708 }
3709
3710 /* Otherwise, we need to iterate over CTOR to find or insert INDEX
3711 appropriately. */
3712
3713 for (; vec_safe_iterate (CONSTRUCTOR_ELTS (ctor)((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3713, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
, idx, &cep);
3714 idx++, fields = DECL_CHAIN (fields)(((contains_struct_check (((contains_struct_check ((fields), (
TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3714, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3714, __FUNCTION__))->common.chain))
)
3715 {
3716 if (index == cep->index)
3717 goto found;
3718
3719 /* The field we're initializing must be on the field
3720 list. Look to see if it is present before the
3721 field the current ELT initializes. */
3722 for (; fields != cep->index; fields = DECL_CHAIN (fields)(((contains_struct_check (((contains_struct_check ((fields), (
TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3722, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3722, __FUNCTION__))->common.chain))
)
3723 if (index == fields)
3724 goto insert;
3725 }
3726 /* We fell off the end of the CONSTRUCTOR, so insert a new
3727 entry at the end. */
3728
3729 insert:
3730 {
3731 constructor_elt ce = { index, NULL_TREE(tree) nullptr };
3732
3733 vec_safe_insert (CONSTRUCTOR_ELTS (ctor)((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3733, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
, idx, ce);
3734 cep = CONSTRUCTOR_ELT (ctor, idx)(&(*((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3734, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
idx])
;
3735 }
3736 found:;
3737
3738 return cep;
3739 }
3740}
3741
3742/* Under the control of CTX, issue a detailed diagnostic for
3743 an out-of-bounds subscript INDEX into the expression ARRAY. */
3744
3745static void
3746diag_array_subscript (location_t loc, const constexpr_ctx *ctx, tree array, tree index)
3747{
3748 if (!ctx->quiet)
3749 {
3750 tree arraytype = TREE_TYPE (array)((contains_struct_check ((array), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3750, __FUNCTION__))->typed.type)
;
3751
3752 /* Convert the unsigned array subscript to a signed integer to avoid
3753 printing huge numbers for small negative values. */
3754 tree sidx = fold_convert (ssizetype, index)fold_convert_loc (((location_t) 0), sizetype_tab[(int) stk_ssizetype
], index)
;
3755 STRIP_ANY_LOCATION_WRAPPER (array)(array) = tree_strip_any_location_wrapper ((const_cast<union
tree_node *> (((array)))))
;
3756 if (DECL_P (array)(tree_code_type[(int) (((enum tree_code) (array)->base.code
))] == tcc_declaration)
)
3757 {
3758 if (TYPE_DOMAIN (arraytype)((tree_check ((arraytype), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3758, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
)
)
3759 error_at (loc, "array subscript value %qE is outside the bounds "
3760 "of array %qD of type %qT", sidx, array, arraytype);
3761 else
3762 error_at (loc, "nonzero array subscript %qE is used with array %qD of "
3763 "type %qT with unknown bounds", sidx, array, arraytype);
3764 inform (DECL_SOURCE_LOCATION (array)((contains_struct_check ((array), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3764, __FUNCTION__))->decl_minimal.locus)
, "declared here");
3765 }
3766 else if (TYPE_DOMAIN (arraytype)((tree_check ((arraytype), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3766, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
)
)
3767 error_at (loc, "array subscript value %qE is outside the bounds "
3768 "of array type %qT", sidx, arraytype);
3769 else
3770 error_at (loc, "nonzero array subscript %qE is used with array of type %qT "
3771 "with unknown bounds", sidx, arraytype);
3772 }
3773}
3774
3775/* Return the number of elements for TYPE (which is an ARRAY_TYPE or
3776 a VECTOR_TYPE). */
3777
3778static tree
3779get_array_or_vector_nelts (const constexpr_ctx *ctx, tree type,
3780 bool *non_constant_p, bool *overflow_p)
3781{
3782 tree nelts;
3783 if (TREE_CODE (type)((enum tree_code) (type)->base.code) == ARRAY_TYPE)
3784 {
3785 if (TYPE_DOMAIN (type)((tree_check ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3785, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
)
)
3786 nelts = array_type_nelts_top (type);
3787 else
3788 nelts = size_zero_nodeglobal_trees[TI_SIZE_ZERO];
3789 }
3790 else if (VECTOR_TYPE_P (type)(((enum tree_code) (type)->base.code) == VECTOR_TYPE))
3791 nelts = size_int (TYPE_VECTOR_SUBPARTS (type))size_int_kind (TYPE_VECTOR_SUBPARTS (type), stk_sizetype);
3792 else
3793 gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3793, __FUNCTION__))
;
3794
3795 /* For VLAs, the number of elements won't be an integer constant. */
3796 nelts = cxx_eval_constant_expression (ctx, nelts, false,
3797 non_constant_p, overflow_p);
3798 return nelts;
3799}
3800
3801/* Extract element INDEX consisting of CHARS_PER_ELT chars from
3802 STRING_CST STRING. */
3803
3804static tree
3805extract_string_elt (tree string, unsigned chars_per_elt, unsigned index)
3806{
3807 tree type = cv_unqualified (TREE_TYPE (TREE_TYPE (string))((contains_struct_check ((((contains_struct_check ((string), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3807, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3807, __FUNCTION__))->typed.type)
);
3808 tree r;
3809
3810 if (chars_per_elt == 1)
3811 r = build_int_cst (type, TREE_STRING_POINTER (string)((const char *)((tree_check ((string), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3811, __FUNCTION__, (STRING_CST)))->string.str))
[index]);
3812 else
3813 {
3814 const unsigned char *ptr
3815 = ((const unsigned char *)TREE_STRING_POINTER (string)((const char *)((tree_check ((string), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3815, __FUNCTION__, (STRING_CST)))->string.str))
3816 + index * chars_per_elt);
3817 r = native_interpret_expr (type, ptr, chars_per_elt);
3818 }
3819 return r;
3820}
3821
3822/* Subroutine of cxx_eval_array_reference. T is an ARRAY_REF; evaluate the
3823 subscript, diagnose any problems with it, and return the result. */
3824
3825static tree
3826eval_and_check_array_index (const constexpr_ctx *ctx,
3827 tree t, bool allow_one_past,
3828 bool *non_constant_p, bool *overflow_p)
3829{
3830 location_t loc = cp_expr_loc_or_input_loc (t);
3831 tree ary = TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3831, __FUNCTION__)))))
;
3832 t = TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3832, __FUNCTION__)))))
;
3833 tree index = cxx_eval_constant_expression (ctx, t, false,
3834 non_constant_p, overflow_p);
3835 VERIFY_CONSTANT (index)do { if (verify_constant ((index), ctx->quiet, non_constant_p
, overflow_p)) return t; } while (0)
;
3836
3837 if (!tree_fits_shwi_p (index)
3838 || tree_int_cst_sgn (index) < 0)
3839 {
3840 diag_array_subscript (loc, ctx, ary, index);
3841 *non_constant_p = true;
3842 return t;
3843 }
3844
3845 tree nelts = get_array_or_vector_nelts (ctx, TREE_TYPE (ary)((contains_struct_check ((ary), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3845, __FUNCTION__))->typed.type)
, non_constant_p,
3846 overflow_p);
3847 VERIFY_CONSTANT (nelts)do { if (verify_constant ((nelts), ctx->quiet, non_constant_p
, overflow_p)) return t; } while (0)
;
3848 if (allow_one_past
3849 ? !tree_int_cst_le (index, nelts)
3850 : !tree_int_cst_lt (index, nelts))
3851 {
3852 diag_array_subscript (loc, ctx, ary, index);
3853 *non_constant_p = true;
3854 return t;
3855 }
3856
3857 return index;
3858}
3859
3860/* Subroutine of cxx_eval_constant_expression.
3861 Attempt to reduce a reference to an array slot. */
3862
3863static tree
3864cxx_eval_array_reference (const constexpr_ctx *ctx, tree t,
3865 bool lval,
3866 bool *non_constant_p, bool *overflow_p)
3867{
3868 tree oldary = TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3868, __FUNCTION__)))))
;
3869 tree ary = cxx_eval_constant_expression (ctx, oldary,
3870 lval,
3871 non_constant_p, overflow_p);
3872 if (*non_constant_p)
3873 return t;
3874 if (!lval
3875 && TREE_CODE (ary)((enum tree_code) (ary)->base.code) == VIEW_CONVERT_EXPR
3876 && VECTOR_TYPE_P (TREE_TYPE (TREE_OPERAND (ary, 0)))(((enum tree_code) (((contains_struct_check (((*((const_cast<
tree*> (tree_operand_check ((ary), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3876, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3876, __FUNCTION__))->typed.type))->base.code) == VECTOR_TYPE
)
3877 && TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3877, __FUNCTION__))->typed.type)
== TREE_TYPE (TREE_TYPE (TREE_OPERAND (ary, 0)))((contains_struct_check ((((contains_struct_check (((*((const_cast
<tree*> (tree_operand_check ((ary), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3877, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3877, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3877, __FUNCTION__))->typed.type)
)
3878 ary = TREE_OPERAND (ary, 0)(*((const_cast<tree*> (tree_operand_check ((ary), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3878, __FUNCTION__)))))
;
3879
3880 tree oldidx = TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3880, __FUNCTION__)))))
;
3881 tree index = eval_and_check_array_index (ctx, t, lval,
3882 non_constant_p, overflow_p);
3883 if (*non_constant_p)
3884 return t;
3885
3886 if (lval && ary == oldary && index == oldidx)
3887 return t;
3888 else if (lval)
3889 return build4 (ARRAY_REF, TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3889, __FUNCTION__))->typed.type)
, ary, index, NULLnullptr, NULLnullptr);
3890
3891 unsigned len = 0, elem_nchars = 1;
3892 tree elem_type = TREE_TYPE (TREE_TYPE (ary))((contains_struct_check ((((contains_struct_check ((ary), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3892, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3892, __FUNCTION__))->typed.type)
;
3893 if (TREE_CODE (ary)((enum tree_code) (ary)->base.code) == CONSTRUCTOR)
3894 len = CONSTRUCTOR_NELTS (ary)(vec_safe_length (((tree_check ((ary), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3894, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
;
3895 else if (TREE_CODE (ary)((enum tree_code) (ary)->base.code) == STRING_CST)
3896 {
3897 elem_nchars = (TYPE_PRECISION (elem_type)((tree_class_check ((elem_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3897, __FUNCTION__))->type_common.precision)
3898 / TYPE_PRECISION (char_type_node)((tree_class_check ((integer_types[itk_char]), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3898, __FUNCTION__))->type_common.precision)
);
3899 len = (unsigned) TREE_STRING_LENGTH (ary)((tree_check ((ary), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3899, __FUNCTION__, (STRING_CST)))->string.length)
/ elem_nchars;
3900 }
3901 else if (TREE_CODE (ary)((enum tree_code) (ary)->base.code) == VECTOR_CST)
3902 /* We don't create variable-length VECTOR_CSTs. */
3903 len = VECTOR_CST_NELTS (ary)(TYPE_VECTOR_SUBPARTS (((contains_struct_check ((ary), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3903, __FUNCTION__))->typed.type)))
.to_constant ();
3904 else
3905 {
3906 /* We can't do anything with other tree codes, so use
3907 VERIFY_CONSTANT to complain and fail. */
3908 VERIFY_CONSTANT (ary)do { if (verify_constant ((ary), ctx->quiet, non_constant_p
, overflow_p)) return t; } while (0)
;
3909 gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3909, __FUNCTION__))
;
3910 }
3911
3912 bool found;
3913 HOST_WIDE_INTlong i = 0;
3914 if (TREE_CODE (ary)((enum tree_code) (ary)->base.code) == CONSTRUCTOR)
3915 {
3916 HOST_WIDE_INTlong ix = find_array_ctor_elt (ary, index);
3917 found = (ix >= 0);
3918 if (found)
3919 i = ix;
3920 }
3921 else
3922 {
3923 i = tree_to_shwi (index);
3924 found = (i < len);
3925 }
3926
3927 if (found)
3928 {
3929 tree r;
3930 if (TREE_CODE (ary)((enum tree_code) (ary)->base.code) == CONSTRUCTOR)
3931 r = (*CONSTRUCTOR_ELTS (ary)((tree_check ((ary), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3931, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
)[i].value;
3932 else if (TREE_CODE (ary)((enum tree_code) (ary)->base.code) == VECTOR_CST)
3933 r = VECTOR_CST_ELT (ary, i)vector_cst_elt (ary, i);
3934 else
3935 r = extract_string_elt (ary, elem_nchars, i);
3936
3937 if (r)
3938 /* Don't VERIFY_CONSTANT here. */
3939 return r;
3940
3941 /* Otherwise the element doesn't have a value yet. */
3942 }
3943
3944 /* Not found. */
3945
3946 if (TREE_CODE (ary)((enum tree_code) (ary)->base.code) == CONSTRUCTOR
3947 && CONSTRUCTOR_NO_CLEARING (ary)((tree_check ((ary), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3947, __FUNCTION__, (CONSTRUCTOR)))->base.public_flag)
)
3948 {
3949 /* 'ary' is part of the aggregate initializer we're currently
3950 building; if there's no initializer for this element yet,
3951 that's an error. */
3952 if (!ctx->quiet)
3953 error ("accessing uninitialized array element");
3954 *non_constant_p = true;
3955 return t;
3956 }
3957
3958 /* If it's within the array bounds but doesn't have an explicit
3959 initializer, it's initialized from {}. But use build_value_init
3960 directly for non-aggregates to avoid creating a garbage CONSTRUCTOR. */
3961 tree val;
3962 constexpr_ctx new_ctx;
3963 if (is_really_empty_class (elem_type, /*ignore_vptr*/false))
3964 return build_constructor (elem_type, NULLnullptr);
3965 else if (CP_AGGREGATE_TYPE_P (elem_type)(gnu_vector_type_p (elem_type) || ((enum tree_code) (elem_type
)->base.code) == ARRAY_TYPE || ((((((enum tree_code) (elem_type
)->base.code)) == RECORD_TYPE || (((enum tree_code) (elem_type
)->base.code)) == UNION_TYPE) && ((tree_class_check
((elem_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3965, __FUNCTION__))->type_common.lang_flag_5)) &&
(((tree_class_check ((elem_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3965, __FUNCTION__))->type_common.size) != (tree) nullptr
) && !((((tree_class_check ((elem_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3965, __FUNCTION__))->type_with_lang_specific.lang_specific
))->non_aggregate)))
)
3966 {
3967 tree empty_ctor = build_constructor (init_list_type_nodecp_global_trees[CPTI_INIT_LIST_TYPE], NULLnullptr);
3968 val = digest_init (elem_type, empty_ctor, tf_warning_or_error);
3969 }
3970 else
3971 val = build_value_init (elem_type, tf_warning_or_error);
3972
3973 if (!SCALAR_TYPE_P (elem_type)((((enum tree_code) (elem_type)->base.code) == OFFSET_TYPE
) || ((enum tree_code) (elem_type)->base.code) == ENUMERAL_TYPE
|| ((((enum tree_code) (elem_type)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (elem_type)->base.code) == INTEGER_TYPE
) || ((enum tree_code) (elem_type)->base.code) == REAL_TYPE
|| ((enum tree_code) (elem_type)->base.code) == COMPLEX_TYPE
) || (((enum tree_code) (elem_type)->base.code) == POINTER_TYPE
) || (((enum tree_code) (elem_type)->base.code) == RECORD_TYPE
&& (((tree_class_check (((tree_check ((elem_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3973, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3973, __FUNCTION__))->type_common.lang_flag_2))) || (((enum
tree_code) (elem_type)->base.code) == NULLPTR_TYPE))
)
3974 {
3975 new_ctx = *ctx;
3976 if (ctx->object)
3977 /* If there was no object, don't add one: it could confuse us
3978 into thinking we're modifying a const object. */
3979 new_ctx.object = t;
3980 new_ctx.ctor = build_constructor (elem_type, NULLnullptr);
3981 ctx = &new_ctx;
3982 }
3983 t = cxx_eval_constant_expression (ctx, val, lval, non_constant_p,
3984 overflow_p);
3985 if (!SCALAR_TYPE_P (elem_type)((((enum tree_code) (elem_type)->base.code) == OFFSET_TYPE
) || ((enum tree_code) (elem_type)->base.code) == ENUMERAL_TYPE
|| ((((enum tree_code) (elem_type)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (elem_type)->base.code) == INTEGER_TYPE
) || ((enum tree_code) (elem_type)->base.code) == REAL_TYPE
|| ((enum tree_code) (elem_type)->base.code) == COMPLEX_TYPE
) || (((enum tree_code) (elem_type)->base.code) == POINTER_TYPE
) || (((enum tree_code) (elem_type)->base.code) == RECORD_TYPE
&& (((tree_class_check (((tree_check ((elem_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3985, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 3985, __FUNCTION__))->type_common.lang_flag_2))) || (((enum
tree_code) (elem_type)->base.code) == NULLPTR_TYPE))
&& t != ctx->ctor)
3986 free_constructor (ctx->ctor);
3987 return t;
3988}
3989
3990/* Subroutine of cxx_eval_constant_expression.
3991 Attempt to reduce a field access of a value of class type. */
3992
3993static tree
3994cxx_eval_component_reference (const constexpr_ctx *ctx, tree t,
3995 bool lval,
3996 bool *non_constant_p, bool *overflow_p)
3997{
3998 unsigned HOST_WIDE_INTlong i;
3999 tree field;
4000 tree value;
4001 tree part = TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4001, __FUNCTION__)))))
;
4002 tree orig_whole = TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4002, __FUNCTION__)))))
;
4003 tree whole = cxx_eval_constant_expression (ctx, orig_whole,
4004 lval,
4005 non_constant_p, overflow_p);
4006 if (INDIRECT_REF_P (whole)(((enum tree_code) (whole)->base.code) == INDIRECT_REF)
4007 && integer_zerop (TREE_OPERAND (whole, 0)(*((const_cast<tree*> (tree_operand_check ((whole), (0)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4007, __FUNCTION__)))))
))
4008 {
4009 if (!ctx->quiet)
4010 error ("dereferencing a null pointer in %qE", orig_whole);
4011 *non_constant_p = true;
4012 return t;
4013 }
4014
4015 if (TREE_CODE (whole)((enum tree_code) (whole)->base.code) == PTRMEM_CST)
4016 whole = cplus_expand_constant (whole);
4017 if (whole == orig_whole)
4018 return t;
4019 if (lval)
4020 return fold_build3 (COMPONENT_REF, TREE_TYPE (t),fold_build3_loc (((location_t) 0), COMPONENT_REF, ((contains_struct_check
((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4020, __FUNCTION__))->typed.type), whole, part, (tree) nullptr
)
4021 whole, part, NULL_TREE)fold_build3_loc (((location_t) 0), COMPONENT_REF, ((contains_struct_check
((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4020, __FUNCTION__))->typed.type), whole, part, (tree) nullptr
)
;
4022 /* Don't VERIFY_CONSTANT here; we only want to check that we got a
4023 CONSTRUCTOR. */
4024 if (!*non_constant_p && TREE_CODE (whole)((enum tree_code) (whole)->base.code) != CONSTRUCTOR)
4025 {
4026 if (!ctx->quiet)
4027 error ("%qE is not a constant expression", orig_whole);
4028 *non_constant_p = true;
4029 }
4030 if (DECL_MUTABLE_P (part)(((contains_struct_check (((tree_check ((part), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4030, __FUNCTION__, (FIELD_DECL)))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4030, __FUNCTION__))->decl_common.lang_flag_0))
)
4031 {
4032 if (!ctx->quiet)
4033 error ("mutable %qD is not usable in a constant expression", part);
4034 *non_constant_p = true;
4035 }
4036 if (*non_constant_p)
4037 return t;
4038 bool pmf = TYPE_PTRMEMFUNC_P (TREE_TYPE (whole))(((enum tree_code) (((contains_struct_check ((whole), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4038, __FUNCTION__))->typed.type))->base.code) == RECORD_TYPE
&& (((tree_class_check (((tree_check ((((contains_struct_check
((whole), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4038, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4038, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4038, __FUNCTION__))->type_common.lang_flag_2)))
;
4039 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (whole), i, field, value)for (i = 0; (i >= vec_safe_length (((tree_check ((whole), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4039, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
? false : (((void) (value = (*((tree_check ((whole), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4039, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
i].value)), (field = (*((tree_check ((whole), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4039, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
i].index), true); (i)++)
4040 {
4041 /* Use name match for PMF fields, as a variant will have a
4042 different FIELD_DECL with a different type. */
4043 if (pmf ? DECL_NAME (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4043, __FUNCTION__))->decl_minimal.name)
== DECL_NAME (part)((contains_struct_check ((part), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4043, __FUNCTION__))->decl_minimal.name)
4044 : field == part)
4045 {
4046 if (value)
4047 {
4048 STRIP_ANY_LOCATION_WRAPPER (value)(value) = tree_strip_any_location_wrapper ((const_cast<union
tree_node *> (((value)))))
;
4049 return value;
4050 }
4051 else
4052 /* We're in the middle of initializing it. */
4053 break;
4054 }
4055 }
4056 if (TREE_CODE (TREE_TYPE (whole))((enum tree_code) (((contains_struct_check ((whole), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4056, __FUNCTION__))->typed.type))->base.code)
== UNION_TYPE
4057 && CONSTRUCTOR_NELTS (whole)(vec_safe_length (((tree_check ((whole), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4057, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
> 0)
4058 {
4059 /* DR 1188 says we don't have to deal with this. */
4060 if (!ctx->quiet)
4061 {
4062 constructor_elt *cep = CONSTRUCTOR_ELT (whole, 0)(&(*((tree_check ((whole), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4062, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
0])
;
4063 if (cep->value == NULL_TREE(tree) nullptr)
4064 error ("accessing uninitialized member %qD", part);
4065 else
4066 error ("accessing %qD member instead of initialized %qD member in "
4067 "constant expression", part, cep->index);
4068 }
4069 *non_constant_p = true;
4070 return t;
4071 }
4072
4073 /* We only create a CONSTRUCTOR for a subobject when we modify it, so empty
4074 classes never get represented; throw together a value now. */
4075 if (is_really_empty_class (TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4075, __FUNCTION__))->typed.type)
, /*ignore_vptr*/false))
4076 return build_constructor (TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4076, __FUNCTION__))->typed.type)
, NULLnullptr);
4077
4078 gcc_assert (DECL_CONTEXT (part) == TYPE_MAIN_VARIANT (TREE_TYPE (whole)))((void)(!(((contains_struct_check ((part), (TS_DECL_MINIMAL),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4078, __FUNCTION__))->decl_minimal.context) == ((tree_class_check
((((contains_struct_check ((whole), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4078, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4078, __FUNCTION__))->type_common.main_variant)) ? fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4078, __FUNCTION__), 0 : 0))
;
4079
4080 if (CONSTRUCTOR_NO_CLEARING (whole)((tree_check ((whole), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4080, __FUNCTION__, (CONSTRUCTOR)))->base.public_flag)
)
4081 {
4082 /* 'whole' is part of the aggregate initializer we're currently
4083 building; if there's no initializer for this member yet, that's an
4084 error. */
4085 if (!ctx->quiet)
4086 error ("accessing uninitialized member %qD", part);
4087 *non_constant_p = true;
4088 return t;
4089 }
4090
4091 /* If there's no explicit init for this field, it's value-initialized. */
4092 value = build_value_init (TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4092, __FUNCTION__))->typed.type)
, tf_warning_or_error);
4093 return cxx_eval_constant_expression (ctx, value,
4094 lval,
4095 non_constant_p, overflow_p);
4096}
4097
4098/* Subroutine of cxx_eval_constant_expression.
4099 Attempt to reduce a field access of a value of class type that is
4100 expressed as a BIT_FIELD_REF. */
4101
4102static tree
4103cxx_eval_bit_field_ref (const constexpr_ctx *ctx, tree t,
4104 bool lval,
4105 bool *non_constant_p, bool *overflow_p)
4106{
4107 tree orig_whole = TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4107, __FUNCTION__)))))
;
4108 tree retval, fldval, utype, mask;
4109 bool fld_seen = false;
4110 HOST_WIDE_INTlong istart, isize;
4111 tree whole = cxx_eval_constant_expression (ctx, orig_whole,
4112 lval,
4113 non_constant_p, overflow_p);
4114 tree start, field, value;
4115 unsigned HOST_WIDE_INTlong i;
4116
4117 if (whole == orig_whole)
4118 return t;
4119 /* Don't VERIFY_CONSTANT here; we only want to check that we got a
4120 CONSTRUCTOR. */
4121 if (!*non_constant_p
4122 && TREE_CODE (whole)((enum tree_code) (whole)->base.code) != VECTOR_CST
4123 && TREE_CODE (whole)((enum tree_code) (whole)->base.code) != CONSTRUCTOR)
4124 {
4125 if (!ctx->quiet)
4126 error ("%qE is not a constant expression", orig_whole);
4127 *non_constant_p = true;
4128 }
4129 if (*non_constant_p)
4130 return t;
4131
4132 if (TREE_CODE (whole)((enum tree_code) (whole)->base.code) == VECTOR_CST)
4133 return fold_ternary (BIT_FIELD_REF, TREE_TYPE (t), whole,fold_ternary_loc (((location_t) 0), BIT_FIELD_REF, ((contains_struct_check
((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4133, __FUNCTION__))->typed.type), whole, (*((const_cast
<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4134, __FUNCTION__))))), (*((const_cast<tree*> (tree_operand_check
((t), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4134, __FUNCTION__))))))
4134 TREE_OPERAND (t, 1), TREE_OPERAND (t, 2))fold_ternary_loc (((location_t) 0), BIT_FIELD_REF, ((contains_struct_check
((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4133, __FUNCTION__))->typed.type), whole, (*((const_cast
<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4134, __FUNCTION__))))), (*((const_cast<tree*> (tree_operand_check
((t), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4134, __FUNCTION__))))))
;
4135
4136 start = TREE_OPERAND (t, 2)(*((const_cast<tree*> (tree_operand_check ((t), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4136, __FUNCTION__)))))
;
4137 istart = tree_to_shwi (start);
4138 isize = tree_to_shwi (TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4138, __FUNCTION__)))))
);
4139 utype = TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4139, __FUNCTION__))->typed.type)
;
4140 if (!TYPE_UNSIGNED (utype)((tree_class_check ((utype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4140, __FUNCTION__))->base.u.bits.unsigned_flag)
)
4141 utype = build_nonstandard_integer_type (TYPE_PRECISION (utype)((tree_class_check ((utype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4141, __FUNCTION__))->type_common.precision)
, 1);
4142 retval = build_int_cst (utype, 0);
4143 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (whole), i, field, value)for (i = 0; (i >= vec_safe_length (((tree_check ((whole), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4143, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
? false : (((void) (value = (*((tree_check ((whole), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4143, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
i].value)), (field = (*((tree_check ((whole), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4143, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
i].index), true); (i)++)
4144 {
4145 tree bitpos = bit_position (field);
4146 STRIP_ANY_LOCATION_WRAPPER (value)(value) = tree_strip_any_location_wrapper ((const_cast<union
tree_node *> (((value)))))
;
4147 if (bitpos == start && DECL_SIZE (field)((contains_struct_check ((field), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4147, __FUNCTION__))->decl_common.size)
== TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4147, __FUNCTION__)))))
)
4148 return value;
4149 if (TREE_CODE (TREE_TYPE (field))((enum tree_code) (((contains_struct_check ((field), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4149, __FUNCTION__))->typed.type))->base.code)
== INTEGER_TYPE
4150 && TREE_CODE (value)((enum tree_code) (value)->base.code) == INTEGER_CST
4151 && tree_fits_shwi_p (bitpos)
4152 && tree_fits_shwi_p (DECL_SIZE (field)((contains_struct_check ((field), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4152, __FUNCTION__))->decl_common.size)
))
4153 {
4154 HOST_WIDE_INTlong bit = tree_to_shwi (bitpos);
4155 HOST_WIDE_INTlong sz = tree_to_shwi (DECL_SIZE (field)((contains_struct_check ((field), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4155, __FUNCTION__))->decl_common.size)
);
4156 HOST_WIDE_INTlong shift;
4157 if (bit >= istart && bit + sz <= istart + isize)
4158 {
4159 fldval = fold_convert (utype, value)fold_convert_loc (((location_t) 0), utype, value);
4160 mask = build_int_cst_type (utype, -1);
4161 mask = fold_build2 (LSHIFT_EXPR, utype, mask,fold_build2_loc (((location_t) 0), LSHIFT_EXPR, utype, mask, size_int_kind
(((tree_class_check ((utype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4162, __FUNCTION__))->type_common.precision) - sz, stk_sizetype
) )
4162 size_int (TYPE_PRECISION (utype) - sz))fold_build2_loc (((location_t) 0), LSHIFT_EXPR, utype, mask, size_int_kind
(((tree_class_check ((utype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4162, __FUNCTION__))->type_common.precision) - sz, stk_sizetype
) )
;
4163 mask = fold_build2 (RSHIFT_EXPR, utype, mask,fold_build2_loc (((location_t) 0), RSHIFT_EXPR, utype, mask, size_int_kind
(((tree_class_check ((utype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4164, __FUNCTION__))->type_common.precision) - sz, stk_sizetype
) )
4164 size_int (TYPE_PRECISION (utype) - sz))fold_build2_loc (((location_t) 0), RSHIFT_EXPR, utype, mask, size_int_kind
(((tree_class_check ((utype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4164, __FUNCTION__))->type_common.precision) - sz, stk_sizetype
) )
;
4165 fldval = fold_build2 (BIT_AND_EXPR, utype, fldval, mask)fold_build2_loc (((location_t) 0), BIT_AND_EXPR, utype, fldval
, mask )
;
4166 shift = bit - istart;
4167 if (BYTES_BIG_ENDIAN0)
4168 shift = TYPE_PRECISION (utype)((tree_class_check ((utype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4168, __FUNCTION__))->type_common.precision)
- shift - sz;
4169 fldval = fold_build2 (LSHIFT_EXPR, utype, fldval,fold_build2_loc (((location_t) 0), LSHIFT_EXPR, utype, fldval
, size_int_kind (shift, stk_sizetype) )
4170 size_int (shift))fold_build2_loc (((location_t) 0), LSHIFT_EXPR, utype, fldval
, size_int_kind (shift, stk_sizetype) )
;
4171 retval = fold_build2 (BIT_IOR_EXPR, utype, retval, fldval)fold_build2_loc (((location_t) 0), BIT_IOR_EXPR, utype, retval
, fldval )
;
4172 fld_seen = true;
4173 }
4174 }
4175 }
4176 if (fld_seen)
4177 return fold_convert (TREE_TYPE (t), retval)fold_convert_loc (((location_t) 0), ((contains_struct_check (
(t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4177, __FUNCTION__))->typed.type), retval)
;
4178 gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4178, __FUNCTION__))
;
4179 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
4180}
4181
4182/* Helper for cxx_eval_bit_cast.
4183 Check [bit.cast]/3 rules, bit_cast is constexpr only if the To and From
4184 types and types of all subobjects have is_union_v<T>, is_pointer_v<T>,
4185 is_member_pointer_v<T>, is_volatile_v<T> false and has no non-static
4186 data members of reference type. */
4187
4188static bool
4189check_bit_cast_type (const constexpr_ctx *ctx, location_t loc, tree type,
4190 tree orig_type)
4191{
4192 if (TREE_CODE (type)((enum tree_code) (type)->base.code) == UNION_TYPE)
4193 {
4194 if (!ctx->quiet)
4195 {
4196 if (type == orig_type)
4197 error_at (loc, "%qs is not a constant expression because %qT is "
4198 "a union type", "__builtin_bit_cast", type);
4199 else
4200 error_at (loc, "%qs is not a constant expression because %qT "
4201 "contains a union type", "__builtin_bit_cast",
4202 orig_type);
4203 }
4204 return true;
4205 }
4206 if (TREE_CODE (type)((enum tree_code) (type)->base.code) == POINTER_TYPE)
4207 {
4208 if (!ctx->quiet)
4209 {
4210 if (type == orig_type)
4211 error_at (loc, "%qs is not a constant expression because %qT is "
4212 "a pointer type", "__builtin_bit_cast", type);
4213 else
4214 error_at (loc, "%qs is not a constant expression because %qT "
4215 "contains a pointer type", "__builtin_bit_cast",
4216 orig_type);
4217 }
4218 return true;
4219 }
4220 if (TREE_CODE (type)((enum tree_code) (type)->base.code) == REFERENCE_TYPE)
4221 {
4222 if (!ctx->quiet)
4223 {
4224 if (type == orig_type)
4225 error_at (loc, "%qs is not a constant expression because %qT is "
4226 "a reference type", "__builtin_bit_cast", type);
4227 else
4228 error_at (loc, "%qs is not a constant expression because %qT "
4229 "contains a reference type", "__builtin_bit_cast",
4230 orig_type);
4231 }
4232 return true;
4233 }
4234 if (TYPE_PTRMEM_P (type)((((enum tree_code) (type)->base.code) == OFFSET_TYPE) || (
((enum tree_code) (type)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4234, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4234, __FUNCTION__))->type_common.lang_flag_2))))
)
4235 {
4236 if (!ctx->quiet)
4237 {
4238 if (type == orig_type)
4239 error_at (loc, "%qs is not a constant expression because %qT is "
4240 "a pointer to member type", "__builtin_bit_cast",
4241 type);
4242 else
4243 error_at (loc, "%qs is not a constant expression because %qT "
4244 "contains a pointer to member type",
4245 "__builtin_bit_cast", orig_type);
4246 }
4247 return true;
4248 }
4249 if (TYPE_VOLATILE (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4249, __FUNCTION__))->base.volatile_flag)
)
4250 {
4251 if (!ctx->quiet)
4252 {
4253 if (type == orig_type)
4254 error_at (loc, "%qs is not a constant expression because %qT is "
4255 "volatile", "__builtin_bit_cast", type);
4256 else
4257 error_at (loc, "%qs is not a constant expression because %qT "
4258 "contains a volatile subobject",
4259 "__builtin_bit_cast", orig_type);
4260 }
4261 return true;
4262 }
4263 if (TREE_CODE (type)((enum tree_code) (type)->base.code) == RECORD_TYPE)
4264 for (tree field = TYPE_FIELDS (type)((tree_check3 ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4264, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)
; field; field = DECL_CHAIN (field)(((contains_struct_check (((contains_struct_check ((field), (
TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4264, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4264, __FUNCTION__))->common.chain))
)
4265 if (TREE_CODE (field)((enum tree_code) (field)->base.code) == FIELD_DECL
4266 && check_bit_cast_type (ctx, loc, TREE_TYPE (field)((contains_struct_check ((field), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4266, __FUNCTION__))->typed.type)
, orig_type))
4267 return true;
4268 return false;
4269}
4270
4271/* Subroutine of cxx_eval_constant_expression.
4272 Attempt to evaluate a BIT_CAST_EXPR. */
4273
4274static tree
4275cxx_eval_bit_cast (const constexpr_ctx *ctx, tree t, bool *non_constant_p,
4276 bool *overflow_p)
4277{
4278 if (check_bit_cast_type (ctx, 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))
, TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4278, __FUNCTION__))->typed.type)
,
4279 TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4279, __FUNCTION__))->typed.type)
)
4280 || check_bit_cast_type (ctx, cp_expr_loc_or_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/cp/constexpr.c"
, 4280, __FUNCTION__)))))
,
4281 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))
),
4282 TREE_TYPE (TREE_OPERAND (t, 0))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check
((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4282, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4282, __FUNCTION__))->typed.type)
,
4283 TREE_TYPE (TREE_OPERAND (t, 0))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check
((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4283, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4283, __FUNCTION__))->typed.type)
))
4284 {
4285 *non_constant_p = true;
4286 return t;
4287 }
4288
4289 tree op = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4289, __FUNCTION__)))))
, false,
4290 non_constant_p, overflow_p);
4291 if (*non_constant_p)
4292 return t;
4293
4294 location_t 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))
;
4295 if (BITS_PER_UNIT(8) != 8 || CHAR_BIT8 != 8)
4296 {
4297 if (!ctx->quiet)
4298 sorry_at (loc, "%qs cannot be constant evaluated on the target",
4299 "__builtin_bit_cast");
4300 *non_constant_p = true;
4301 return t;
4302 }
4303
4304 if (!tree_fits_shwi_p (TYPE_SIZE_UNIT (TREE_TYPE (t))((tree_class_check ((((contains_struct_check ((t), (TS_TYPED)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4304, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4304, __FUNCTION__))->type_common.size_unit)
))
4305 {
4306 if (!ctx->quiet)
4307 sorry_at (loc, "%qs cannot be constant evaluated because the "
4308 "type is too large", "__builtin_bit_cast");
4309 *non_constant_p = true;
4310 return t;
4311 }
4312
4313 HOST_WIDE_INTlong len = tree_to_shwi (TYPE_SIZE_UNIT (TREE_TYPE (t))((tree_class_check ((((contains_struct_check ((t), (TS_TYPED)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4313, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4313, __FUNCTION__))->type_common.size_unit)
);
4314 if (len < 0 || (int) len != len)
4315 {
4316 if (!ctx->quiet)
4317 sorry_at (loc, "%qs cannot be constant evaluated because the "
4318 "type is too large", "__builtin_bit_cast");
4319 *non_constant_p = true;
4320 return t;
4321 }
4322
4323 unsigned char buf[64];
4324 unsigned char *ptr, *mask;
4325 size_t alen = (size_t) len * 2;
4326 if (alen <= sizeof (buf))
4327 ptr = buf;
4328 else
4329 ptr = XNEWVEC (unsigned char, alen)((unsigned char *) xmalloc (sizeof (unsigned char) * (alen)));
4330 mask = ptr + (size_t) len;
4331 /* At the beginning consider everything indeterminate. */
4332 memset (mask, ~0, (size_t) len);
4333
4334 if (native_encode_initializer (op, ptr, len, 0, mask) != len)
4335 {
4336 if (!ctx->quiet)
4337 sorry_at (loc, "%qs cannot be constant evaluated because the "
4338 "argument cannot be encoded", "__builtin_bit_cast");
4339 *non_constant_p = true;
4340 if (ptr != buf)
4341 XDELETE (ptr)free ((void*) (ptr));
4342 return t;
4343 }
4344
4345 tree r = NULL_TREE(tree) nullptr;
4346 if (can_native_interpret_type_p (TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4346, __FUNCTION__))->typed.type)
))
4347 r = native_interpret_expr (TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4347, __FUNCTION__))->typed.type)
, ptr, len);
4348 else if (TREE_CODE (TREE_TYPE (t))((enum tree_code) (((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4348, __FUNCTION__))->typed.type))->base.code)
== RECORD_TYPE)
4349 {
4350 r = native_interpret_aggregate (TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4350, __FUNCTION__))->typed.type)
, ptr, 0, len);
4351 if (r != NULL_TREE(tree) nullptr)
4352 clear_type_padding_in_mask (TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4352, __FUNCTION__))->typed.type)
, mask);
4353 }
4354
4355 if (r != NULL_TREE(tree) nullptr)
4356 {
4357 for (int i = 0; i < len; i++)
4358 if (mask[i])
4359 {
4360 if (!ctx->quiet)
4361 error_at (loc, "%qs accessing uninitialized byte at offset %d",
4362 "__builtin_bit_cast", i);
4363 *non_constant_p = true;
4364 r = t;
4365 break;
4366 }
4367 if (ptr != buf)
4368 XDELETE (ptr)free ((void*) (ptr));
4369 return r;
4370 }
4371
4372 if (!ctx->quiet)
4373 sorry_at (loc, "%qs cannot be constant evaluated because the "
4374 "argument cannot be interpreted", "__builtin_bit_cast");
4375 *non_constant_p = true;
4376 if (ptr != buf)
4377 XDELETE (ptr)free ((void*) (ptr));
4378 return t;
4379}
4380
4381/* Subroutine of cxx_eval_constant_expression.
4382 Evaluate a short-circuited logical expression T in the context
4383 of a given constexpr CALL. BAILOUT_VALUE is the value for
4384 early return. CONTINUE_VALUE is used here purely for
4385 sanity check purposes. */
4386
4387static tree
4388cxx_eval_logical_expression (const constexpr_ctx *ctx, tree t,
4389 tree bailout_value, tree continue_value,
4390 bool lval,
4391 bool *non_constant_p, bool *overflow_p)
4392{
4393 tree r;
4394 tree lhs = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4394, __FUNCTION__)))))
,
4395 lval,
4396 non_constant_p, overflow_p);
4397 VERIFY_CONSTANT (lhs)do { if (verify_constant ((lhs), ctx->quiet, non_constant_p
, overflow_p)) return t; } while (0)
;
4398 if (tree_int_cst_equal (lhs, bailout_value))
4399 return lhs;
4400 gcc_assert (tree_int_cst_equal (lhs, continue_value))((void)(!(tree_int_cst_equal (lhs, continue_value)) ? fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4400, __FUNCTION__), 0 : 0))
;
4401 r = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4401, __FUNCTION__)))))
,
4402 lval, non_constant_p,
4403 overflow_p);
4404 VERIFY_CONSTANT (r)do { if (verify_constant ((r), ctx->quiet, non_constant_p,
overflow_p)) return t; } while (0)
;
4405 return r;
4406}
4407
4408/* REF is a COMPONENT_REF designating a particular field. V is a vector of
4409 CONSTRUCTOR elements to initialize (part of) an object containing that
4410 field. Return a pointer to the constructor_elt corresponding to the
4411 initialization of the field. */
4412
4413static constructor_elt *
4414base_field_constructor_elt (vec<constructor_elt, va_gc> *v, tree ref)
4415{
4416 tree aggr = TREE_OPERAND (ref, 0)(*((const_cast<tree*> (tree_operand_check ((ref), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4416, __FUNCTION__)))))
;
4417 tree field = TREE_OPERAND (ref, 1)(*((const_cast<tree*> (tree_operand_check ((ref), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4417, __FUNCTION__)))))
;
4418 HOST_WIDE_INTlong i;
4419 constructor_elt *ce;
4420
4421 gcc_assert (TREE_CODE (ref) == COMPONENT_REF)((void)(!(((enum tree_code) (ref)->base.code) == COMPONENT_REF
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4421, __FUNCTION__), 0 : 0))
;
4422
4423 if (TREE_CODE (aggr)((enum tree_code) (aggr)->base.code) == COMPONENT_REF)
4424 {
4425 constructor_elt *base_ce
4426 = base_field_constructor_elt (v, aggr);
4427 v = CONSTRUCTOR_ELTS (base_ce->value)((tree_check ((base_ce->value), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4427, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
;
4428 }
4429
4430 for (i = 0; vec_safe_iterate (v, i, &ce); ++i)
4431 if (ce->index == field)
4432 return ce;
4433
4434 gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4434, __FUNCTION__))
;
4435 return NULLnullptr;
4436}
4437
4438/* Some of the expressions fed to the constexpr mechanism are calls to
4439 constructors, which have type void. In that case, return the type being
4440 initialized by the constructor. */
4441
4442static tree
4443initialized_type (tree t)
4444{
4445 if (TYPE_P (t)(tree_code_type[(int) (((enum tree_code) (t)->base.code))]
== tcc_type)
)
4446 return t;
4447 tree type = TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4447, __FUNCTION__))->typed.type)
;
4448 if (TREE_CODE (t)((enum tree_code) (t)->base.code) == CALL_EXPR)
4449 {
4450 /* A constructor call has void type, so we need to look deeper. */
4451 tree fn = get_function_named_in_call (t);
4452 if (fn && TREE_CODE (fn)((enum tree_code) (fn)->base.code) == FUNCTION_DECL
4453 && DECL_CXX_CONSTRUCTOR_P (fn)((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4453, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
)
4454 type = DECL_CONTEXT (fn)((contains_struct_check ((fn), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4454, __FUNCTION__))->decl_minimal.context)
;
4455 }
4456 else if (TREE_CODE (t)((enum tree_code) (t)->base.code) == COMPOUND_EXPR)
4457 return initialized_type (TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4457, __FUNCTION__)))))
);
4458 else if (TREE_CODE (t)((enum tree_code) (t)->base.code) == AGGR_INIT_EXPR)
4459 type = TREE_TYPE (AGGR_INIT_EXPR_SLOT (t))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check
(((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4459, __FUNCTION__, (AGGR_INIT_EXPR)))), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4459, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4459, __FUNCTION__))->typed.type)
;
4460 return cv_unqualified (type);
4461}
4462
4463/* We're about to initialize element INDEX of an array or class from VALUE.
4464 Set up NEW_CTX appropriately by adjusting .object to refer to the
4465 subobject and creating a new CONSTRUCTOR if the element is itself
4466 a class or array. */
4467
4468static void
4469init_subob_ctx (const constexpr_ctx *ctx, constexpr_ctx &new_ctx,
4470 tree index, tree &value)
4471{
4472 new_ctx = *ctx;
4473
4474 if (index && TREE_CODE (index)((enum tree_code) (index)->base.code) != INTEGER_CST
4475 && TREE_CODE (index)((enum tree_code) (index)->base.code) != FIELD_DECL
4476 && TREE_CODE (index)((enum tree_code) (index)->base.code) != RANGE_EXPR)
4477 /* This won't have an element in the new CONSTRUCTOR. */
4478 return;
4479
4480 tree type = initialized_type (value);
4481 if (!AGGREGATE_TYPE_P (type)(((enum tree_code) (type)->base.code) == ARRAY_TYPE || (((
enum tree_code) (type)->base.code) == RECORD_TYPE || ((enum
tree_code) (type)->base.code) == UNION_TYPE || ((enum tree_code
) (type)->base.code) == QUAL_UNION_TYPE))
&& !VECTOR_TYPE_P (type)(((enum tree_code) (type)->base.code) == VECTOR_TYPE))
4482 /* A non-aggregate member doesn't get its own CONSTRUCTOR. */
4483 return;
4484
4485 /* The sub-aggregate initializer might contain a placeholder;
4486 update object to refer to the subobject and ctor to refer to
4487 the (newly created) sub-initializer. */
4488 if (ctx->object)
4489 {
4490 if (index == NULL_TREE(tree) nullptr || TREE_CODE (index)((enum tree_code) (index)->base.code) == RANGE_EXPR)
4491 /* There's no well-defined subobject for this index. */
4492 new_ctx.object = NULL_TREE(tree) nullptr;
4493 else
4494 new_ctx.object = build_ctor_subob_ref (index, type, ctx->object);
4495 }
4496 tree elt = build_constructor (type, NULLnullptr);
4497 CONSTRUCTOR_NO_CLEARING (elt)((tree_check ((elt), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4497, __FUNCTION__, (CONSTRUCTOR)))->base.public_flag)
= true;
4498 new_ctx.ctor = elt;
4499
4500 if (TREE_CODE (value)((enum tree_code) (value)->base.code) == TARGET_EXPR)
4501 /* Avoid creating another CONSTRUCTOR when we expand the TARGET_EXPR. */
4502 value = TARGET_EXPR_INITIAL (value)(*(tree_operand_check_code ((value), (TARGET_EXPR), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4502, __FUNCTION__)))
;
4503}
4504
4505/* We're about to process an initializer for a class or array TYPE. Make
4506 sure that CTX is set up appropriately. */
4507
4508static void
4509verify_ctor_sanity (const constexpr_ctx *ctx, tree type)
4510{
4511 /* We don't bother building a ctor for an empty base subobject. */
4512 if (is_empty_class (type))
4513 return;
4514
4515 /* We're in the middle of an initializer that might involve placeholders;
4516 our caller should have created a CONSTRUCTOR for us to put the
4517 initializer into. We will either return that constructor or T. */
4518 gcc_assert (ctx->ctor)((void)(!(ctx->ctor) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4518, __FUNCTION__), 0 : 0))
;
4519 gcc_assert (same_type_ignoring_top_level_qualifiers_p((void)(!(same_type_ignoring_top_level_qualifiers_p (type, ((
contains_struct_check ((ctx->ctor), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4520, __FUNCTION__))->typed.type))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4520, __FUNCTION__), 0 : 0))
4520 (type, TREE_TYPE (ctx->ctor)))((void)(!(same_type_ignoring_top_level_qualifiers_p (type, ((
contains_struct_check ((ctx->ctor), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4520, __FUNCTION__))->typed.type))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4520, __FUNCTION__), 0 : 0))
;
4521 /* We used to check that ctx->ctor was empty, but that isn't the case when
4522 the object is zero-initialized before calling the constructor. */
4523 if (ctx->object)
4524 {
4525 tree otype = TREE_TYPE (ctx->object)((contains_struct_check ((ctx->object), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4525, __FUNCTION__))->typed.type)
;
4526 gcc_assert (same_type_ignoring_top_level_qualifiers_p (type, otype)((void)(!(same_type_ignoring_top_level_qualifiers_p (type, otype
) || (((enum tree_code) (otype)->base.code) == ARRAY_TYPE &&
((tree_check ((otype), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4529, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
) == (tree) nullptr && ((enum tree_code) (type)->base
.code) == ARRAY_TYPE && (same_type_ignoring_top_level_qualifiers_p
(((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4532, __FUNCTION__))->typed.type), ((contains_struct_check
((otype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4532, __FUNCTION__))->typed.type))))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4532, __FUNCTION__), 0 : 0))
4527 /* Handle flexible array members. */((void)(!(same_type_ignoring_top_level_qualifiers_p (type, otype
) || (((enum tree_code) (otype)->base.code) == ARRAY_TYPE &&
((tree_check ((otype), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4529, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
) == (tree) nullptr && ((enum tree_code) (type)->base
.code) == ARRAY_TYPE && (same_type_ignoring_top_level_qualifiers_p
(((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4532, __FUNCTION__))->typed.type), ((contains_struct_check
((otype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4532, __FUNCTION__))->typed.type))))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4532, __FUNCTION__), 0 : 0))
4528 || (TREE_CODE (otype) == ARRAY_TYPE((void)(!(same_type_ignoring_top_level_qualifiers_p (type, otype
) || (((enum tree_code) (otype)->base.code) == ARRAY_TYPE &&
((tree_check ((otype), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4529, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
) == (tree) nullptr && ((enum tree_code) (type)->base
.code) == ARRAY_TYPE && (same_type_ignoring_top_level_qualifiers_p
(((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4532, __FUNCTION__))->typed.type), ((contains_struct_check
((otype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4532, __FUNCTION__))->typed.type))))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4532, __FUNCTION__), 0 : 0))
4529 && TYPE_DOMAIN (otype) == NULL_TREE((void)(!(same_type_ignoring_top_level_qualifiers_p (type, otype
) || (((enum tree_code) (otype)->base.code) == ARRAY_TYPE &&
((tree_check ((otype), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4529, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
) == (tree) nullptr && ((enum tree_code) (type)->base
.code) == ARRAY_TYPE && (same_type_ignoring_top_level_qualifiers_p
(((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4532, __FUNCTION__))->typed.type), ((contains_struct_check
((otype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4532, __FUNCTION__))->typed.type))))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4532, __FUNCTION__), 0 : 0))
4530 && TREE_CODE (type) == ARRAY_TYPE((void)(!(same_type_ignoring_top_level_qualifiers_p (type, otype
) || (((enum tree_code) (otype)->base.code) == ARRAY_TYPE &&
((tree_check ((otype), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4529, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
) == (tree) nullptr && ((enum tree_code) (type)->base
.code) == ARRAY_TYPE && (same_type_ignoring_top_level_qualifiers_p
(((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4532, __FUNCTION__))->typed.type), ((contains_struct_check
((otype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4532, __FUNCTION__))->typed.type))))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4532, __FUNCTION__), 0 : 0))
4531 && (same_type_ignoring_top_level_qualifiers_p((void)(!(same_type_ignoring_top_level_qualifiers_p (type, otype
) || (((enum tree_code) (otype)->base.code) == ARRAY_TYPE &&
((tree_check ((otype), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4529, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
) == (tree) nullptr && ((enum tree_code) (type)->base
.code) == ARRAY_TYPE && (same_type_ignoring_top_level_qualifiers_p
(((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4532, __FUNCTION__))->typed.type), ((contains_struct_check
((otype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4532, __FUNCTION__))->typed.type))))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4532, __FUNCTION__), 0 : 0))
4532 (TREE_TYPE (type), TREE_TYPE (otype)))))((void)(!(same_type_ignoring_top_level_qualifiers_p (type, otype
) || (((enum tree_code) (otype)->base.code) == ARRAY_TYPE &&
((tree_check ((otype), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4529, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
) == (tree) nullptr && ((enum tree_code) (type)->base
.code) == ARRAY_TYPE && (same_type_ignoring_top_level_qualifiers_p
(((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4532, __FUNCTION__))->typed.type), ((contains_struct_check
((otype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4532, __FUNCTION__))->typed.type))))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4532, __FUNCTION__), 0 : 0))
;
4533 }
4534 gcc_assert (!ctx->object || !DECL_P (ctx->object)((void)(!(!ctx->object || !(tree_code_type[(int) (((enum tree_code
) (ctx->object)->base.code))] == tcc_declaration) || *(
ctx->global->values.get (ctx->object)) == ctx->ctor
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/constexpr.c"
, 4535, __FUNCTION__), 0 : 0))
4535 || *(ctx->global->values.get (ctx->object)) == ctx->ctor)((void)(!(!ctx->object || !(tree_code_type[(int) (((enum tree_code
) (ctx->object)->base.code))] == tcc_declaration) || *(
ctx->global->