Bug Summary

File:build/gcc/cp/init.cc
Warning:line 282, column 8
Called C++ object pointer is null

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-suse-linux -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name init.cc -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 -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/buildworker/marxinbox-gcc-clang-static-analyzer/objdir/gcc -resource-dir /usr/lib64/clang/15.0.7 -D IN_GCC_FRONTEND -D IN_GCC -D HAVE_CONFIG_H -I . -I cp -I /buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc -I /buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp -I /buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../include -I /buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../libcpp/include -I /buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../libcody -I /buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../libdecnumber -I /buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../libdecnumber/bid -I ../libdecnumber -I /buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../libbacktrace -internal-isystem /usr/bin/../lib64/gcc/x86_64-suse-linux/13/../../../../include/c++/13 -internal-isystem /usr/bin/../lib64/gcc/x86_64-suse-linux/13/../../../../include/c++/13/x86_64-suse-linux -internal-isystem /usr/bin/../lib64/gcc/x86_64-suse-linux/13/../../../../include/c++/13/backward -internal-isystem /usr/lib64/clang/15.0.7/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-narrowing -Wwrite-strings -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fdeprecated-macro -fdebug-compilation-dir=/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 /buildworker/marxinbox-gcc-clang-static-analyzer/objdir/clang-static-analyzer/2023-03-27-141847-20772-1/report-7ctkcx.plist -x c++ /buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc

/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc

1/* Handle initialization things in -*- C++ -*-
2 Copyright (C) 1987-2023 Free Software Foundation, Inc.
3 Contributed by Michael Tiemann (tiemann@cygnus.com)
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 3, or (at your option)
10any later version.
11
12GCC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING3. If not see
19<http://www.gnu.org/licenses/>. */
20
21/* High-level class interface. */
22
23#include "config.h"
24#include "system.h"
25#include "coretypes.h"
26#include "target.h"
27#include "cp-tree.h"
28#include "stringpool.h"
29#include "varasm.h"
30#include "gimplify.h"
31#include "c-family/c-ubsan.h"
32#include "intl.h"
33#include "stringpool.h"
34#include "attribs.h"
35#include "asan.h"
36#include "stor-layout.h"
37#include "pointer-query.h"
38
39static bool begin_init_stmts (tree *, tree *);
40static tree finish_init_stmts (bool, tree, tree);
41static void construct_virtual_base (tree, tree);
42static bool expand_aggr_init_1 (tree, tree, tree, tree, int, tsubst_flags_t);
43static bool expand_default_init (tree, tree, tree, tree, int, tsubst_flags_t);
44static int member_init_ok_or_else (tree, tree, tree);
45static void expand_virtual_init (tree, tree);
46static tree sort_mem_initializers (tree, tree);
47static tree initializing_context (tree);
48static void expand_cleanup_for_base (tree, tree);
49static tree dfs_initialize_vtbl_ptrs (tree, void *);
50static tree build_field_list (tree, tree, int *);
51static int diagnose_uninitialized_cst_or_ref_member_1 (tree, tree, bool, bool);
52
53static GTY(()) tree fn;
54
55/* We are about to generate some complex initialization code.
56 Conceptually, it is all a single expression. However, we may want
57 to include conditionals, loops, and other such statement-level
58 constructs. Therefore, we build the initialization code inside a
59 statement-expression. This function starts such an expression.
60 STMT_EXPR_P and COMPOUND_STMT_P are filled in by this function;
61 pass them back to finish_init_stmts when the expression is
62 complete. */
63
64static bool
65begin_init_stmts (tree *stmt_expr_p, tree *compound_stmt_p)
66{
67 bool is_global = !building_stmt_list_p ()((current_stmt_tree ()->x_cur_stmt_list) && !(current_stmt_tree
()->x_cur_stmt_list)->is_empty())
;
68
69 *stmt_expr_p = begin_stmt_expr ();
70 *compound_stmt_p = begin_compound_stmt (BCS_NO_SCOPE);
71
72 return is_global;
73}
74
75/* Finish out the statement-expression begun by the previous call to
76 begin_init_stmts. Returns the statement-expression itself. */
77
78static tree
79finish_init_stmts (bool is_global, tree stmt_expr, tree compound_stmt)
80{
81 finish_compound_stmt (compound_stmt);
82
83 stmt_expr = finish_stmt_expr (stmt_expr, true);
84
85 gcc_assert (!building_stmt_list_p () == is_global)((void)(!(!((current_stmt_tree ()->x_cur_stmt_list) &&
!(current_stmt_tree ()->x_cur_stmt_list)->is_empty()) ==
is_global) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 85, __FUNCTION__), 0 : 0))
;
86
87 return stmt_expr;
88}
89
90/* Constructors */
91
92/* Called from initialize_vtbl_ptrs via dfs_walk. BINFO is the base
93 which we want to initialize the vtable pointer for, DATA is
94 TREE_LIST whose TREE_VALUE is the this ptr expression. */
95
96static tree
97dfs_initialize_vtbl_ptrs (tree binfo, void *data)
98{
99 if (!TYPE_CONTAINS_VPTR_P (BINFO_TYPE (binfo))((((tree_not_check2 ((((contains_struct_check (((tree_check (
(binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 99, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 99, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 99, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits.
lang_flag_2)) || ((((tree_class_check ((((contains_struct_check
(((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 99, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 99, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 99, __FUNCTION__))->type_with_lang_specific.lang_specific
))->vbases))
)
100 return dfs_skip_bases((tree)1);
101
102 if (!BINFO_PRIMARY_P (binfo)((tree_not_check2 (((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 102, __FUNCTION__, (TREE_BINFO)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 102, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_5)
|| BINFO_VIRTUAL_P (binfo)((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 102, __FUNCTION__, (TREE_BINFO)))->base.static_flag)
)
103 {
104 tree base_ptr = TREE_VALUE ((tree) data)((tree_check (((tree) data), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 104, __FUNCTION__, (TREE_LIST)))->list.value)
;
105
106 base_ptr = build_base_path (PLUS_EXPR, base_ptr, binfo, /*nonnull=*/1,
107 tf_warning_or_error);
108
109 expand_virtual_init (binfo, base_ptr);
110 }
111
112 return NULL_TREE(tree) __null;
113}
114
115/* Initialize all the vtable pointers in the object pointed to by
116 ADDR. */
117
118void
119initialize_vtbl_ptrs (tree addr)
120{
121 tree list;
122 tree type;
123
124 type = TREE_TYPE (TREE_TYPE (addr))((contains_struct_check ((((contains_struct_check ((addr), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 124, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 124, __FUNCTION__))->typed.type)
;
125 list = build_tree_list (type, addr);
126
127 /* Walk through the hierarchy, initializing the vptr in each base
128 class. We do these in pre-order because we can't find the virtual
129 bases for a class until we've initialized the vtbl for that
130 class. */
131 dfs_walk_once (TYPE_BINFO (type)((tree_check3 ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 131, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.maxval)
, dfs_initialize_vtbl_ptrs, NULL__null, list);
132}
133
134/* Return an expression for the zero-initialization of an object with
135 type T. This expression will either be a constant (in the case
136 that T is a scalar), or a CONSTRUCTOR (in the case that T is an
137 aggregate), or NULL (in the case that T does not require
138 initialization). In either case, the value can be used as
139 DECL_INITIAL for a decl of the indicated TYPE; it is a valid static
140 initializer. If NELTS is non-NULL, and TYPE is an ARRAY_TYPE, NELTS
141 is the number of elements in the array. If STATIC_STORAGE_P is
142 TRUE, initializers are only generated for entities for which
143 zero-initialization does not simply mean filling the storage with
144 zero bytes. FIELD_SIZE, if non-NULL, is the bit size of the field,
145 subfields with bit positions at or above that bit size shouldn't
146 be added. Note that this only works when the result is assigned
147 to a base COMPONENT_REF; if we only have a pointer to the base subobject,
148 expand_assignment will end up clearing the full size of TYPE. */
149
150static tree
151build_zero_init_1 (tree type, tree nelts, bool static_storage_p,
152 tree field_size)
153{
154 tree init = NULL_TREE(tree) __null;
155
156 /* [dcl.init]
157
158 To zero-initialize an object of type T means:
159
160 -- if T is a scalar type, the storage is set to the value of zero
161 converted to T.
162
163 -- if T is a non-union class type, the storage for each non-static
164 data member and each base-class subobject is zero-initialized.
165
166 -- if T is a union type, the storage for its first data member is
167 zero-initialized.
168
169 -- if T is an array type, the storage for each element is
170 zero-initialized.
171
172 -- if T is a reference type, no initialization is performed. */
173
174 gcc_assert (nelts == NULL_TREE || TREE_CODE (nelts) == INTEGER_CST)((void)(!(nelts == (tree) __null || ((enum tree_code) (nelts)
->base.code) == INTEGER_CST) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 174, __FUNCTION__), 0 : 0))
;
42
'?' condition is false
175
176 if (type == error_mark_nodeglobal_trees[TI_ERROR_MARK])
43
Assuming the condition is false
177 ;
178 else if (static_storage_p
43.1
'static_storage_p' is false
43.1
'static_storage_p' is false
&& zero_init_p (type))
179 /* In order to save space, we do not explicitly build initializers
180 for items that do not need them. GCC's semantics are that
181 items with static storage duration that are not otherwise
182 initialized are initialized to zero. */
183 ;
184 else if (TYPE_PTR_OR_PTRMEM_P (type)((((enum tree_code) (type)->base.code) == POINTER_TYPE) ||
((((enum tree_code) (type)->base.code) == OFFSET_TYPE) ||
(((enum tree_code) (type)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 184, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 184, __FUNCTION__))->type_common.lang_flag_2)))))
)
44
Assuming field 'code' is not equal to POINTER_TYPE
45
Assuming field 'code' is not equal to OFFSET_TYPE
46
Assuming field 'code' is not equal to RECORD_TYPE
185 init = fold (convert (type, nullptr_nodec_global_trees[CTI_NULLPTR]));
186 else if (NULLPTR_TYPE_P (type)(((enum tree_code) (type)->base.code) == NULLPTR_TYPE))
47
Assuming field 'code' is not equal to NULLPTR_TYPE
187 init = build_int_cst (type, 0);
188 else if (SCALAR_TYPE_P (type)((((enum tree_code) (type)->base.code) == OFFSET_TYPE) || (
(enum tree_code) (type)->base.code) == ENUMERAL_TYPE || ((
((enum tree_code) (type)->base.code) == BOOLEAN_TYPE || ((
enum tree_code) (type)->base.code) == INTEGER_TYPE) || ((enum
tree_code) (type)->base.code) == REAL_TYPE || ((enum tree_code
) (type)->base.code) == COMPLEX_TYPE) || (((enum tree_code
) (type)->base.code) == POINTER_TYPE) || (((enum tree_code
) (type)->base.code) == RECORD_TYPE && (((tree_class_check
(((tree_check ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 188, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 188, __FUNCTION__))->type_common.lang_flag_2))) || (((enum
tree_code) (type)->base.code) == NULLPTR_TYPE))
)
48
Taking false branch
49
Assuming field 'code' is not equal to ENUMERAL_TYPE
50
Assuming field 'code' is not equal to BOOLEAN_TYPE
51
Assuming field 'code' is not equal to INTEGER_TYPE
52
Assuming field 'code' is not equal to REAL_TYPE
53
Assuming field 'code' is not equal to COMPLEX_TYPE
189 init = build_zero_cst (type);
190 else if (RECORD_OR_UNION_CODE_P (TREE_CODE (type))((((enum tree_code) (type)->base.code)) == RECORD_TYPE || (
((enum tree_code) (type)->base.code)) == UNION_TYPE)
)
54
Taking false branch
55
Assuming field 'code' is not equal to UNION_TYPE
56
Taking false branch
191 {
192 tree field;
193 vec<constructor_elt, va_gc> *v = NULL__null;
194
195 /* Iterate over the fields, building initializations. */
196 for (field = TYPE_FIELDS (type)((tree_check3 ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 196, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)
; field; field = DECL_CHAIN (field)(((contains_struct_check (((contains_struct_check ((field), (
TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 196, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 196, __FUNCTION__))->common.chain))
)
197 {
198 if (TREE_CODE (field)((enum tree_code) (field)->base.code) != FIELD_DECL)
199 continue;
200
201 if (TREE_TYPE (field)((contains_struct_check ((field), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 201, __FUNCTION__))->typed.type)
== error_mark_nodeglobal_trees[TI_ERROR_MARK])
202 continue;
203
204 /* Don't add virtual bases for base classes if they are beyond
205 the size of the current field, that means it is present
206 somewhere else in the object. */
207 if (field_size)
208 {
209 tree bitpos = bit_position (field);
210 if (TREE_CODE (bitpos)((enum tree_code) (bitpos)->base.code) == INTEGER_CST
211 && !tree_int_cst_lt (bitpos, field_size))
212 continue;
213 }
214
215 /* Note that for class types there will be FIELD_DECLs
216 corresponding to base classes as well. Thus, iterating
217 over TYPE_FIELDs will result in correct initialization of
218 all of the subobjects. */
219 if (!static_storage_p || !zero_init_p (TREE_TYPE (field)((contains_struct_check ((field), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 219, __FUNCTION__))->typed.type)
))
220 {
221 tree new_field_size
222 = (DECL_FIELD_IS_BASE (field)((contains_struct_check (((tree_check ((field), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 222, __FUNCTION__, (FIELD_DECL)))), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 222, __FUNCTION__))->decl_common.lang_flag_6)
223 && DECL_SIZE (field)((contains_struct_check ((field), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 223, __FUNCTION__))->decl_common.size)
224 && TREE_CODE (DECL_SIZE (field))((enum tree_code) (((contains_struct_check ((field), (TS_DECL_COMMON
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 224, __FUNCTION__))->decl_common.size))->base.code)
== INTEGER_CST)
225 ? DECL_SIZE (field)((contains_struct_check ((field), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 225, __FUNCTION__))->decl_common.size)
: NULL_TREE(tree) __null;
226 tree value = build_zero_init_1 (TREE_TYPE (field)((contains_struct_check ((field), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 226, __FUNCTION__))->typed.type)
,
227 /*nelts=*/NULL_TREE(tree) __null,
228 static_storage_p,
229 new_field_size);
230 if (value)
231 CONSTRUCTOR_APPEND_ELT(v, field, value)do { constructor_elt _ce___ = {field, value}; vec_safe_push (
(v), _ce___); } while (0)
;
232 }
233
234 /* For unions, only the first field is initialized. */
235 if (TREE_CODE (type)((enum tree_code) (type)->base.code) == UNION_TYPE)
236 break;
237 }
238
239 /* Build a constructor to contain the initializations. */
240 init = build_constructor (type, v);
241 }
242 else if (TREE_CODE (type)((enum tree_code) (type)->base.code) == ARRAY_TYPE)
57
Assuming field 'code' is equal to ARRAY_TYPE
58
Taking true branch
243 {
244 tree max_index;
245 vec<constructor_elt, va_gc> *v = NULL__null;
246
247 /* Iterate over the array elements, building initializations. */
248 if (nelts
58.1
'nelts' is null
58.1
'nelts' is null
)
59
Taking false branch
249 max_index = fold_build2_loc (input_location, MINUS_EXPR,
250 TREE_TYPE (nelts)((contains_struct_check ((nelts), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 250, __FUNCTION__))->typed.type)
, nelts,
251 build_one_cst (TREE_TYPE (nelts)((contains_struct_check ((nelts), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 251, __FUNCTION__))->typed.type)
));
252 /* Treat flexible array members like [0] arrays. */
253 else if (TYPE_DOMAIN (type)((tree_check ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 253, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
)
== NULL_TREE(tree) __null
)
60
Assuming field 'values' is not equal to NULL_TREE
61
Taking false branch
254 return NULL_TREE(tree) __null;
255 else
256 max_index = array_type_nelts (type);
257
258 /* If we have an error_mark here, we should just return error mark
259 as we don't know the size of the array yet. */
260 if (max_index == error_mark_nodeglobal_trees[TI_ERROR_MARK])
62
Assuming the condition is false
63
Taking false branch
261 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
262 gcc_assert (TREE_CODE (max_index) == INTEGER_CST)((void)(!(((enum tree_code) (max_index)->base.code) == INTEGER_CST
) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 262, __FUNCTION__), 0 : 0))
;
64
Assuming field 'code' is equal to INTEGER_CST
65
'?' condition is false
263
264 /* A zero-sized array, which is accepted as an extension, will
265 have an upper bound of -1. */
266 if (!integer_minus_onep (max_index))
66
Assuming the condition is true
67
Taking true branch
267 {
268 constructor_elt ce;
269
270 /* If this is a one element array, we just use a regular init. */
271 if (integer_zerop (max_index))
68
Assuming the condition is false
69
Taking false branch
272 ce.index = size_zero_nodeglobal_trees[TI_SIZE_ZERO];
273 else
274 ce.index = build2 (RANGE_EXPR, sizetypesizetype_tab[(int) stk_sizetype], size_zero_nodeglobal_trees[TI_SIZE_ZERO],
275 max_index);
276
277 ce.value = build_zero_init_1 (TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 277, __FUNCTION__))->typed.type)
, /*nelts=*/NULL_TREE(tree) __null,
278 static_storage_p, NULL_TREE(tree) __null);
279 if (ce.value)
70
Assuming field 'value' is non-null
71
Taking true branch
280 {
281 vec_alloc (v, 1);
72
Calling 'vec_alloc<constructor_elt, va_gc>'
83
Returning from 'vec_alloc<constructor_elt, va_gc>'
282 v->quick_push (ce);
84
Called C++ object pointer is null
283 }
284 }
285
286 /* Build a constructor to contain the initializations. */
287 init = build_constructor (type, v);
288 }
289 else if (VECTOR_TYPE_P (type)(((enum tree_code) (type)->base.code) == VECTOR_TYPE))
290 init = build_zero_cst (type);
291 else
292 gcc_assert (TYPE_REF_P (type))((void)(!((((enum tree_code) (type)->base.code) == REFERENCE_TYPE
)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 292, __FUNCTION__), 0 : 0))
;
293
294 /* In all cases, the initializer is a constant. */
295 if (init)
296 TREE_CONSTANT (init)((non_type_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 296, __FUNCTION__))->base.constant_flag)
= 1;
297
298 return init;
299}
300
301/* Return an expression for the zero-initialization of an object with
302 type T. This expression will either be a constant (in the case
303 that T is a scalar), or a CONSTRUCTOR (in the case that T is an
304 aggregate), or NULL (in the case that T does not require
305 initialization). In either case, the value can be used as
306 DECL_INITIAL for a decl of the indicated TYPE; it is a valid static
307 initializer. If NELTS is non-NULL, and TYPE is an ARRAY_TYPE, NELTS
308 is the number of elements in the array. If STATIC_STORAGE_P is
309 TRUE, initializers are only generated for entities for which
310 zero-initialization does not simply mean filling the storage with
311 zero bytes. */
312
313tree
314build_zero_init (tree type, tree nelts, bool static_storage_p)
315{
316 return build_zero_init_1 (type, nelts, static_storage_p, NULL_TREE(tree) __null);
317}
318
319/* Return a suitable initializer for value-initializing an object of type
320 TYPE, as described in [dcl.init]. */
321
322tree
323build_value_init (tree type, tsubst_flags_t complain)
324{
325 /* [dcl.init]
326
327 To value-initialize an object of type T means:
328
329 - if T is a class type (clause 9) with either no default constructor
330 (12.1) or a default constructor that is user-provided or deleted,
331 then the object is default-initialized;
332
333 - if T is a (possibly cv-qualified) class type without a user-provided
334 or deleted default constructor, then the object is zero-initialized
335 and the semantic constraints for default-initialization are checked,
336 and if T has a non-trivial default constructor, the object is
337 default-initialized;
338
339 - if T is an array type, then each element is value-initialized;
340
341 - otherwise, the object is zero-initialized.
342
343 A program that calls for default-initialization or
344 value-initialization of an entity of reference type is ill-formed. */
345
346 if (CLASS_TYPE_P (type)(((((enum tree_code) (type)->base.code)) == RECORD_TYPE ||
(((enum tree_code) (type)->base.code)) == UNION_TYPE) &&
((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 346, __FUNCTION__))->type_common.lang_flag_5))
&& type_build_ctor_call (type))
347 {
348 tree ctor
349 = build_special_member_call (NULL_TREE(tree) __null, complete_ctor_identifiercp_global_trees[CPTI_COMPLETE_CTOR_IDENTIFIER],
350 NULL__null, type, LOOKUP_NORMAL((1 << 0)), complain);
351 if (ctor == error_mark_nodeglobal_trees[TI_ERROR_MARK] || TREE_CONSTANT (ctor)((non_type_check ((ctor), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 351, __FUNCTION__))->base.constant_flag)
)
352 return ctor;
353 if (processing_template_declscope_chain->x_processing_template_decl)
354 /* The AGGR_INIT_EXPR tweaking below breaks in templates. */
355 return build_min (CAST_EXPR, type, NULL_TREE(tree) __null);
356 tree fn = NULL_TREE(tree) __null;
357 if (TREE_CODE (ctor)((enum tree_code) (ctor)->base.code) == CALL_EXPR)
358 fn = get_callee_fndecl (ctor);
359 ctor = build_aggr_init_expr (type, ctor);
360 if (fn && user_provided_p (fn))
361 return ctor;
362 else if (TYPE_HAS_COMPLEX_DFLT (type)((((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 362, __FUNCTION__))->type_with_lang_specific.lang_specific
))->has_complex_dflt)
)
363 {
364 /* This is a class that needs constructing, but doesn't have
365 a user-provided constructor. So we need to zero-initialize
366 the object and then call the implicitly defined ctor.
367 This will be handled in simplify_aggr_init_expr. */
368 AGGR_INIT_ZERO_FIRST (ctor)((tree_not_check2 (((tree_check ((ctor), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 368, __FUNCTION__, (AGGR_INIT_EXPR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 368, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_2)
= 1;
369 return ctor;
370 }
371 }
372
373 /* Discard any access checking during subobject initialization;
374 the checks are implied by the call to the ctor which we have
375 verified is OK (cpp0x/defaulted46.C). */
376 push_deferring_access_checks (dk_deferred);
377 tree r = build_value_init_noctor (type, complain);
378 pop_deferring_access_checks ();
379 return r;
380}
381
382/* Like build_value_init, but don't call the constructor for TYPE. Used
383 for base initializers. */
384
385tree
386build_value_init_noctor (tree type, tsubst_flags_t complain)
387{
388 if (!COMPLETE_TYPE_P (type)(((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 388, __FUNCTION__))->type_common.size) != (tree) __null)
)
389 {
390 if (complain & tf_error)
391 error ("value-initialization of incomplete type %qT", type);
392 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
393 }
394 /* FIXME the class and array cases should just use digest_init once it is
395 SFINAE-enabled. */
396 if (CLASS_TYPE_P (type)(((((enum tree_code) (type)->base.code)) == RECORD_TYPE ||
(((enum tree_code) (type)->base.code)) == UNION_TYPE) &&
((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 396, __FUNCTION__))->type_common.lang_flag_5))
)
397 {
398 gcc_assert (!TYPE_HAS_COMPLEX_DFLT (type)((void)(!(!((((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 398, __FUNCTION__))->type_with_lang_specific.lang_specific
))->has_complex_dflt) || (global_dc)->diagnostic_count[
(int) (DK_ERROR)] != 0) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 399, __FUNCTION__), 0 : 0))
399 || errorcount != 0)((void)(!(!((((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 398, __FUNCTION__))->type_with_lang_specific.lang_specific
))->has_complex_dflt) || (global_dc)->diagnostic_count[
(int) (DK_ERROR)] != 0) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 399, __FUNCTION__), 0 : 0))
;
400
401 if (TREE_CODE (type)((enum tree_code) (type)->base.code) != UNION_TYPE)
402 {
403 tree field;
404 vec<constructor_elt, va_gc> *v = NULL__null;
405
406 /* Iterate over the fields, building initializations. */
407 for (field = TYPE_FIELDS (type)((tree_check3 ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 407, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)
; field; field = DECL_CHAIN (field)(((contains_struct_check (((contains_struct_check ((field), (
TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 407, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 407, __FUNCTION__))->common.chain))
)
408 {
409 tree ftype, value;
410
411 if (TREE_CODE (field)((enum tree_code) (field)->base.code) != FIELD_DECL)
412 continue;
413
414 ftype = TREE_TYPE (field)((contains_struct_check ((field), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 414, __FUNCTION__))->typed.type)
;
415
416 if (ftype == error_mark_nodeglobal_trees[TI_ERROR_MARK])
417 continue;
418
419 /* Ignore flexible array members for value initialization. */
420 if (TREE_CODE (ftype)((enum tree_code) (ftype)->base.code) == ARRAY_TYPE
421 && !COMPLETE_TYPE_P (ftype)(((tree_class_check ((ftype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 421, __FUNCTION__))->type_common.size) != (tree) __null)
422 && !TYPE_DOMAIN (ftype)((tree_check ((ftype), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 422, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
)
423 && COMPLETE_TYPE_P (TREE_TYPE (ftype))(((tree_class_check ((((contains_struct_check ((ftype), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 423, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 423, __FUNCTION__))->type_common.size) != (tree) __null)
424 && (next_aggregate_field (DECL_CHAIN (field)(((contains_struct_check (((contains_struct_check ((field), (
TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 424, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 424, __FUNCTION__))->common.chain))
)
425 == NULL_TREE(tree) __null))
426 continue;
427
428 /* Ignore unnamed zero-width bitfields. */
429 if (DECL_UNNAMED_BIT_FIELD (field)((((contains_struct_check (((tree_check ((field), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 429, __FUNCTION__, (FIELD_DECL)))), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 429, __FUNCTION__))->decl_common.lang_flag_4) == 1) &&
!((contains_struct_check ((field), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 429, __FUNCTION__))->decl_minimal.name))
430 && integer_zerop (DECL_SIZE (field)((contains_struct_check ((field), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 430, __FUNCTION__))->decl_common.size)
))
431 continue;
432
433 /* We could skip vfields and fields of types with
434 user-defined constructors, but I think that won't improve
435 performance at all; it should be simpler in general just
436 to zero out the entire object than try to only zero the
437 bits that actually need it. */
438
439 /* Note that for class types there will be FIELD_DECLs
440 corresponding to base classes as well. Thus, iterating
441 over TYPE_FIELDs will result in correct initialization of
442 all of the subobjects. */
443 value = build_value_init (ftype, complain);
444 value = maybe_constant_init (value);
445
446 if (value == error_mark_nodeglobal_trees[TI_ERROR_MARK])
447 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
448
449 CONSTRUCTOR_APPEND_ELT(v, field, value)do { constructor_elt _ce___ = {field, value}; vec_safe_push (
(v), _ce___); } while (0)
;
450
451 /* We shouldn't have gotten here for anything that would need
452 non-trivial initialization, and gimplify_init_ctor_preeval
453 would need to be fixed to allow it. */
454 gcc_assert (TREE_CODE (value) != TARGET_EXPR((void)(!(((enum tree_code) (value)->base.code) != TARGET_EXPR
&& ((enum tree_code) (value)->base.code) != AGGR_INIT_EXPR
) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 455, __FUNCTION__), 0 : 0))
455 && TREE_CODE (value) != AGGR_INIT_EXPR)((void)(!(((enum tree_code) (value)->base.code) != TARGET_EXPR
&& ((enum tree_code) (value)->base.code) != AGGR_INIT_EXPR
) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 455, __FUNCTION__), 0 : 0))
;
456 }
457
458 /* Build a constructor to contain the zero- initializations. */
459 return build_constructor (type, v);
460 }
461 }
462 else if (TREE_CODE (type)((enum tree_code) (type)->base.code) == ARRAY_TYPE)
463 {
464 vec<constructor_elt, va_gc> *v = NULL__null;
465
466 /* Iterate over the array elements, building initializations. */
467 tree max_index = array_type_nelts (type);
468
469 /* If we have an error_mark here, we should just return error mark
470 as we don't know the size of the array yet. */
471 if (max_index == error_mark_nodeglobal_trees[TI_ERROR_MARK])
472 {
473 if (complain & tf_error)
474 error ("cannot value-initialize array of unknown bound %qT",
475 type);
476 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
477 }
478 gcc_assert (TREE_CODE (max_index) == INTEGER_CST)((void)(!(((enum tree_code) (max_index)->base.code) == INTEGER_CST
) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 478, __FUNCTION__), 0 : 0))
;
479
480 /* A zero-sized array, which is accepted as an extension, will
481 have an upper bound of -1. */
482 if (!tree_int_cst_equal (max_index, integer_minus_one_nodeglobal_trees[TI_INTEGER_MINUS_ONE]))
483 {
484 constructor_elt ce;
485
486 /* If this is a one element array, we just use a regular init. */
487 if (tree_int_cst_equal (size_zero_nodeglobal_trees[TI_SIZE_ZERO], max_index))
488 ce.index = size_zero_nodeglobal_trees[TI_SIZE_ZERO];
489 else
490 ce.index = build2 (RANGE_EXPR, sizetypesizetype_tab[(int) stk_sizetype], size_zero_nodeglobal_trees[TI_SIZE_ZERO], max_index);
491
492 ce.value = build_value_init (TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 492, __FUNCTION__))->typed.type)
, complain);
493 ce.value = maybe_constant_init (ce.value);
494 if (ce.value == error_mark_nodeglobal_trees[TI_ERROR_MARK])
495 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
496
497 vec_alloc (v, 1);
498 v->quick_push (ce);
499
500 /* We shouldn't have gotten here for anything that would need
501 non-trivial initialization, and gimplify_init_ctor_preeval
502 would need to be fixed to allow it. */
503 gcc_assert (TREE_CODE (ce.value) != TARGET_EXPR((void)(!(((enum tree_code) (ce.value)->base.code) != TARGET_EXPR
&& ((enum tree_code) (ce.value)->base.code) != AGGR_INIT_EXPR
) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 504, __FUNCTION__), 0 : 0))
504 && TREE_CODE (ce.value) != AGGR_INIT_EXPR)((void)(!(((enum tree_code) (ce.value)->base.code) != TARGET_EXPR
&& ((enum tree_code) (ce.value)->base.code) != AGGR_INIT_EXPR
) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 504, __FUNCTION__), 0 : 0))
;
505 }
506
507 /* Build a constructor to contain the initializations. */
508 return build_constructor (type, v);
509 }
510 else if (TREE_CODE (type)((enum tree_code) (type)->base.code) == FUNCTION_TYPE)
511 {
512 if (complain & tf_error)
513 error ("value-initialization of function type %qT", type);
514 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
515 }
516 else if (TYPE_REF_P (type)(((enum tree_code) (type)->base.code) == REFERENCE_TYPE))
517 {
518 if (complain & tf_error)
519 error ("value-initialization of reference type %qT", type);
520 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
521 }
522
523 return build_zero_init (type, NULL_TREE(tree) __null, /*static_storage_p=*/false);
524}
525
526/* Initialize current class with INIT, a TREE_LIST of arguments for
527 a target constructor. If TREE_LIST is void_type_node, an empty
528 initializer list was given. Return the target constructor. */
529
530static tree
531perform_target_ctor (tree init)
532{
533 tree decl = current_class_ref(*((cfun + 0) && ((cfun + 0)->language) ? &((cfun
+ 0)->language)->x_current_class_ref : &scope_chain
->x_current_class_ref))
;
534 tree type = current_class_typescope_chain->class_type;
535
536 init = build_aggr_init (decl, init, LOOKUP_NORMAL((1 << 0))|LOOKUP_DELEGATING_CONS(((((((((((1 << 6) << 1) << 1) << 1) <<
1) << 1) << 1) << 1) << 1) << 1
) << 1)
,
537 tf_warning_or_error);
538 finish_expr_stmt (init);
539 if (type_build_dtor_call (type))
540 {
541 tree expr = build_delete (input_location,
542 type, decl, sfk_complete_destructor,
543 LOOKUP_NORMAL((1 << 0))
544 |LOOKUP_NONVIRTUAL(1 << 1)
545 |LOOKUP_DESTRUCTOR(1 << 5),
546 0, tf_warning_or_error);
547 if (DECL_HAS_IN_CHARGE_PARM_P (current_function_decl)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (current_function_decl)->base.code) ==
TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<
union tree_node *> ((((tree_check ((current_function_decl)
, "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 547, __FUNCTION__, (TEMPLATE_DECL))))))))->result : current_function_decl
)), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 547, __FUNCTION__))->decl_common.lang_specific); if (!((
(enum tree_code) (current_function_decl)->base.code) == FUNCTION_DECL
|| (((enum tree_code) (current_function_decl)->base.code)
== TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast
<union tree_node *> ((((tree_check ((current_function_decl
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 547, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((current_function_decl
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 547, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base
.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 547, __FUNCTION__); &lt->u.fn; })->has_in_charge_parm_p
)
)
548 {
549 tree base = build_delete (input_location,
550 type, decl, sfk_base_destructor,
551 LOOKUP_NORMAL((1 << 0))
552 |LOOKUP_NONVIRTUAL(1 << 1)
553 |LOOKUP_DESTRUCTOR(1 << 5),
554 0, tf_warning_or_error);
555 expr = build_if_in_charge (expr, base);
556 }
557 if (expr != error_mark_nodeglobal_trees[TI_ERROR_MARK]
558 && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)(((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 558, __FUNCTION__))->type_common.lang_flag_4))
)
559 finish_eh_cleanup (expr);
560 }
561 return init;
562}
563
564/* Instantiate the default member initializer of MEMBER, if needed.
565 Only get_nsdmi should use the return value of this function. */
566
567static GTY((cache)) decl_tree_cache_map *nsdmi_inst;
568
569tree
570maybe_instantiate_nsdmi_init (tree member, tsubst_flags_t complain)
571{
572 tree init = DECL_INITIAL (member)((contains_struct_check ((member), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 572, __FUNCTION__))->decl_common.initial)
;
573 if (init && DECL_LANG_SPECIFIC (member)((contains_struct_check ((member), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 573, __FUNCTION__))->decl_common.lang_specific)
&& DECL_TEMPLATE_INFO (member)(((contains_struct_check ((template_info_decl_check ((member)
, "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 573, __FUNCTION__)), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 573, __FUNCTION__))->decl_common.lang_specific) ->u.min
.template_info)
)
574 {
575 init = DECL_INITIAL (DECL_TI_TEMPLATE (member))((contains_struct_check ((((struct tree_template_info*)(tree_check
(((((contains_struct_check ((template_info_decl_check ((member
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 575, __FUNCTION__)), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 575, __FUNCTION__))->decl_common.lang_specific) ->u.min
.template_info)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 575, __FUNCTION__, (TEMPLATE_INFO))))->tmpl), (TS_DECL_COMMON
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 575, __FUNCTION__))->decl_common.initial)
;
576 location_t expr_loc
577 = cp_expr_loc_or_loc (init, DECL_SOURCE_LOCATION (member)((contains_struct_check ((member), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 577, __FUNCTION__))->decl_minimal.locus)
);
578 if (TREE_CODE (init)((enum tree_code) (init)->base.code) == DEFERRED_PARSE)
579 /* Unparsed. */;
580 else if (tree *slot = hash_map_safe_get (nsdmi_inst, member))
581 init = *slot;
582 /* Check recursive instantiation. */
583 else if (DECL_INSTANTIATING_NSDMI_P (member)((contains_struct_check (((tree_check ((member), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 583, __FUNCTION__, (FIELD_DECL)))), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 583, __FUNCTION__))->decl_common.lang_flag_2)
)
584 {
585 if (complain & tf_error)
586 error_at (expr_loc, "recursive instantiation of default member "
587 "initializer for %qD", member);
588 init = error_mark_nodeglobal_trees[TI_ERROR_MARK];
589 }
590 else
591 {
592 cp_evaluated ev;
593
594 location_t sloc = input_location;
595 input_location = expr_loc;
596
597 DECL_INSTANTIATING_NSDMI_P (member)((contains_struct_check (((tree_check ((member), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 597, __FUNCTION__, (FIELD_DECL)))), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 597, __FUNCTION__))->decl_common.lang_flag_2)
= 1;
598
599 bool pushed = false;
600 tree ctx = DECL_CONTEXT (member)((contains_struct_check ((member), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 600, __FUNCTION__))->decl_minimal.context)
;
601
602 processing_template_decl_sentinel ptds (/*reset*/false);
603 if (!currently_open_class (ctx))
604 {
605 if (!LOCAL_CLASS_P (ctx)(decl_function_context (((((contains_struct_check (((tree_class_check
((((tree_class_check ((ctx), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 605, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 605, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 605, __FUNCTION__))->common.chain)))) != (tree) __null)
)
606 push_to_top_level ();
607 else
608 /* push_to_top_level would lose the necessary function context,
609 just reset processing_template_decl. */
610 processing_template_declscope_chain->x_processing_template_decl = 0;
611 push_nested_class (ctx);
612 push_deferring_access_checks (dk_no_deferred);
613 pushed = true;
614 }
615
616 /* If we didn't push_to_top_level, still step out of constructor
617 scope so build_base_path doesn't try to use its __in_chrg. */
618 tree cfd = current_function_decl;
619 auto cbl = current_binding_level(*((cfun + 0) && ((cfun + 0)->language) &&
((cfun + 0)->language)->bindings ? &((cfun + 0)->
language)->bindings : &scope_chain->bindings))
;
620 if (at_function_scope_p ())
621 {
622 current_function_decl
623 = decl_function_context (current_function_decl);
624 while (current_binding_level(*((cfun + 0) && ((cfun + 0)->language) &&
((cfun + 0)->language)->bindings ? &((cfun + 0)->
language)->bindings : &scope_chain->bindings))
->kind != sk_class)
625 current_binding_level(*((cfun + 0) && ((cfun + 0)->language) &&
((cfun + 0)->language)->bindings ? &((cfun + 0)->
language)->bindings : &scope_chain->bindings))
= current_binding_level(*((cfun + 0) && ((cfun + 0)->language) &&
((cfun + 0)->language)->bindings ? &((cfun + 0)->
language)->bindings : &scope_chain->bindings))
->level_chain;
626 }
627
628 inject_this_parameter (ctx, TYPE_UNQUALIFIED);
629
630 start_lambda_scope (member);
631
632 /* Do deferred instantiation of the NSDMI. */
633 init = tsubst_copy_and_build (init, DECL_TI_ARGS (member)((struct tree_template_info*)(tree_check (((((contains_struct_check
((template_info_decl_check ((member), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 633, __FUNCTION__)), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 633, __FUNCTION__))->decl_common.lang_specific) ->u.min
.template_info)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 633, __FUNCTION__, (TEMPLATE_INFO))))->args
,
634 complain, member);
635 init = digest_nsdmi_init (member, init, complain);
636
637 finish_lambda_scope ();
638
639 DECL_INSTANTIATING_NSDMI_P (member)((contains_struct_check (((tree_check ((member), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 639, __FUNCTION__, (FIELD_DECL)))), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 639, __FUNCTION__))->decl_common.lang_flag_2)
= 0;
640
641 if (init != error_mark_nodeglobal_trees[TI_ERROR_MARK])
642 hash_map_safe_put<hm_ggc> (nsdmi_inst, member, init);
643
644 current_function_decl = cfd;
645 current_binding_level(*((cfun + 0) && ((cfun + 0)->language) &&
((cfun + 0)->language)->bindings ? &((cfun + 0)->
language)->bindings : &scope_chain->bindings))
= cbl;
646 if (pushed)
647 {
648 pop_deferring_access_checks ();
649 pop_nested_class ();
650 if (!LOCAL_CLASS_P (ctx)(decl_function_context (((((contains_struct_check (((tree_class_check
((((tree_class_check ((ctx), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 650, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 650, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 650, __FUNCTION__))->common.chain)))) != (tree) __null)
)
651 pop_from_top_level ();
652 }
653
654 input_location = sloc;
655 }
656 }
657
658 return init;
659}
660
661/* Return the non-static data initializer for FIELD_DECL MEMBER. */
662
663tree
664get_nsdmi (tree member, bool in_ctor, tsubst_flags_t complain)
665{
666 tree save_ccp = current_class_ptr(*((cfun + 0) && ((cfun + 0)->language) ? &((cfun
+ 0)->language)->x_current_class_ptr : &scope_chain
->x_current_class_ptr))
;
667 tree save_ccr = current_class_ref(*((cfun + 0) && ((cfun + 0)->language) ? &((cfun
+ 0)->language)->x_current_class_ref : &scope_chain
->x_current_class_ref))
;
668
669 tree init = maybe_instantiate_nsdmi_init (member, complain);
670
671 if (init && TREE_CODE (init)((enum tree_code) (init)->base.code) == DEFERRED_PARSE)
672 {
673 if (complain & tf_error)
674 {
675 error ("default member initializer for %qD required before the end "
676 "of its enclosing class", member);
677 inform (location_of (init), "defined here");
678 DECL_INITIAL (member)((contains_struct_check ((member), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 678, __FUNCTION__))->decl_common.initial)
= error_mark_nodeglobal_trees[TI_ERROR_MARK];
679 }
680 init = error_mark_nodeglobal_trees[TI_ERROR_MARK];
681 }
682
683 if (in_ctor)
684 {
685 current_class_ptr(*((cfun + 0) && ((cfun + 0)->language) ? &((cfun
+ 0)->language)->x_current_class_ptr : &scope_chain
->x_current_class_ptr))
= save_ccp;
686 current_class_ref(*((cfun + 0) && ((cfun + 0)->language) ? &((cfun
+ 0)->language)->x_current_class_ref : &scope_chain
->x_current_class_ref))
= save_ccr;
687 }
688 else
689 {
690 /* Use a PLACEHOLDER_EXPR when we don't have a 'this' parameter to
691 refer to; constexpr evaluation knows what to do with it. */
692 current_class_ref(*((cfun + 0) && ((cfun + 0)->language) ? &((cfun
+ 0)->language)->x_current_class_ref : &scope_chain
->x_current_class_ref))
= build0 (PLACEHOLDER_EXPR, DECL_CONTEXT (member)((contains_struct_check ((member), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 692, __FUNCTION__))->decl_minimal.context)
);
693 current_class_ptr(*((cfun + 0) && ((cfun + 0)->language) ? &((cfun
+ 0)->language)->x_current_class_ptr : &scope_chain
->x_current_class_ptr))
= build_address (current_class_ref(*((cfun + 0) && ((cfun + 0)->language) ? &((cfun
+ 0)->language)->x_current_class_ref : &scope_chain
->x_current_class_ref))
);
694 }
695
696 /* Clear processing_template_decl for sake of break_out_target_exprs;
697 INIT is always non-templated. */
698 processing_template_decl_sentinel ptds;
699
700 /* Strip redundant TARGET_EXPR so we don't need to remap it, and
701 so the aggregate init code below will see a CONSTRUCTOR. */
702 bool simple_target = (init && SIMPLE_TARGET_EXPR_P (init)(((enum tree_code) (init)->base.code) == TARGET_EXPR &&
(*(tree_operand_check_code ((init), (TARGET_EXPR), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 702, __FUNCTION__))) && !(((enum tree_code) (((contains_struct_check
(((*(tree_operand_check_code ((init), (TARGET_EXPR), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 702, __FUNCTION__)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 702, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE
))
);
703 if (simple_target)
704 init = TARGET_EXPR_INITIAL (init)(*(tree_operand_check_code ((init), (TARGET_EXPR), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 704, __FUNCTION__)))
;
705 init = break_out_target_exprs (init, /*loc*/true);
706 if (init && TREE_CODE (init)((enum tree_code) (init)->base.code) == TARGET_EXPR)
707 /* In a constructor, this expresses the full initialization, prevent
708 perform_member_init from calling another constructor (58162). */
709 TARGET_EXPR_DIRECT_INIT_P (init)((tree_not_check2 (((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 709, __FUNCTION__, (TARGET_EXPR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 709, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_2)
= in_ctor;
710 if (simple_target && TREE_CODE (init)((enum tree_code) (init)->base.code) != CONSTRUCTOR)
711 /* Now put it back so C++17 copy elision works. */
712 init = get_target_expr (init);
713
714 set_target_expr_eliding (init);
715
716 current_class_ptr(*((cfun + 0) && ((cfun + 0)->language) ? &((cfun
+ 0)->language)->x_current_class_ptr : &scope_chain
->x_current_class_ptr))
= save_ccp;
717 current_class_ref(*((cfun + 0) && ((cfun + 0)->language) ? &((cfun
+ 0)->language)->x_current_class_ref : &scope_chain
->x_current_class_ref))
= save_ccr;
718 return init;
719}
720
721/* Diagnose the flexible array MEMBER if its INITializer is non-null
722 and return true if so. Otherwise return false. */
723
724bool
725maybe_reject_flexarray_init (tree member, tree init)
726{
727 tree type = TREE_TYPE (member)((contains_struct_check ((member), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 727, __FUNCTION__))->typed.type)
;
728
729 if (!init
730 || TREE_CODE (type)((enum tree_code) (type)->base.code) != ARRAY_TYPE
731 || TYPE_DOMAIN (type)((tree_check ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 731, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
)
)
732 return false;
733
734 /* Point at the flexible array member declaration if it's initialized
735 in-class, and at the ctor if it's initialized in a ctor member
736 initializer list. */
737 location_t loc;
738 if (DECL_INITIAL (member)((contains_struct_check ((member), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 738, __FUNCTION__))->decl_common.initial)
== init
739 || !current_function_decl
740 || DECL_DEFAULTED_FN (current_function_decl)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (current_function_decl)->base.code) ==
TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<
union tree_node *> ((((tree_check ((current_function_decl)
, "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 740, __FUNCTION__, (TEMPLATE_DECL))))))))->result : current_function_decl
)), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 740, __FUNCTION__))->decl_common.lang_specific); if (!((
(enum tree_code) (current_function_decl)->base.code) == FUNCTION_DECL
|| (((enum tree_code) (current_function_decl)->base.code)
== TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast
<union tree_node *> ((((tree_check ((current_function_decl
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 740, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((current_function_decl
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 740, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base
.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 740, __FUNCTION__); &lt->u.fn; })->defaulted_p)
)
741 loc = DECL_SOURCE_LOCATION (member)((contains_struct_check ((member), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 741, __FUNCTION__))->decl_minimal.locus)
;
742 else
743 loc = DECL_SOURCE_LOCATION (current_function_decl)((contains_struct_check ((current_function_decl), (TS_DECL_MINIMAL
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 743, __FUNCTION__))->decl_minimal.locus)
;
744
745 error_at (loc, "initializer for flexible array member %q#D", member);
746 return true;
747}
748
749/* If INIT's value can come from a call to std::initializer_list<T>::begin,
750 return that function. Otherwise, NULL_TREE. */
751
752static tree
753find_list_begin (tree init)
754{
755 STRIP_NOPS (init)(init) = tree_strip_nop_conversions ((const_cast<union tree_node
*> (((init)))))
;
756 while (TREE_CODE (init)((enum tree_code) (init)->base.code) == COMPOUND_EXPR)
757 init = TREE_OPERAND (init, 1)(*((const_cast<tree*> (tree_operand_check ((init), (1),
"/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 757, __FUNCTION__)))))
;
758 STRIP_NOPS (init)(init) = tree_strip_nop_conversions ((const_cast<union tree_node
*> (((init)))))
;
759 if (TREE_CODE (init)((enum tree_code) (init)->base.code) == COND_EXPR)
760 {
761 tree left = TREE_OPERAND (init, 1)(*((const_cast<tree*> (tree_operand_check ((init), (1),
"/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 761, __FUNCTION__)))))
;
762 if (!left)
763 left = TREE_OPERAND (init, 0)(*((const_cast<tree*> (tree_operand_check ((init), (0),
"/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 763, __FUNCTION__)))))
;
764 left = find_list_begin (left);
765 if (left)
766 return left;
767 return find_list_begin (TREE_OPERAND (init, 2)(*((const_cast<tree*> (tree_operand_check ((init), (2),
"/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 767, __FUNCTION__)))))
);
768 }
769 if (TREE_CODE (init)((enum tree_code) (init)->base.code) == CALL_EXPR)
770 if (tree fn = get_callee_fndecl (init))
771 if (id_equal (DECL_NAME (fn)((contains_struct_check ((fn), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 771, __FUNCTION__))->decl_minimal.name)
, "begin")
772 && is_std_init_list (DECL_CONTEXT (fn)((contains_struct_check ((fn), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 772, __FUNCTION__))->decl_minimal.context)
))
773 return fn;
774 return NULL_TREE(tree) __null;
775}
776
777/* If INIT initializing MEMBER is copying the address of the underlying array
778 of an initializer_list, warn. */
779
780static void
781maybe_warn_list_ctor (tree member, tree init)
782{
783 tree memtype = TREE_TYPE (member)((contains_struct_check ((member), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 783, __FUNCTION__))->typed.type)
;
784 if (!init || !TYPE_PTR_P (memtype)(((enum tree_code) (memtype)->base.code) == POINTER_TYPE)
785 || !is_list_ctor (current_function_decl))
786 return;
787
788 tree parm = FUNCTION_FIRST_USER_PARMTYPE (current_function_decl)skip_artificial_parms_for ((current_function_decl), ((tree_check2
((((contains_struct_check ((current_function_decl), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 788, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 788, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values))
;
789 parm = TREE_VALUE (parm)((tree_check ((parm), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 789, __FUNCTION__, (TREE_LIST)))->list.value)
;
790 tree initlist = non_reference (parm);
791
792 /* Do not warn if the parameter is an lvalue reference to non-const. */
793 if (TYPE_REF_P (parm)(((enum tree_code) (parm)->base.code) == REFERENCE_TYPE) && !TYPE_REF_IS_RVALUE (parm)((tree_check ((parm), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 793, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag
)
794 && !CP_TYPE_CONST_P (initlist)((cp_type_quals (initlist) & TYPE_QUAL_CONST) != 0))
795 return;
796
797 tree targs = CLASSTYPE_TI_ARGS (initlist)((struct tree_template_info*)(tree_check (((((tree_class_check
(((tree_check3 ((initlist), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 797, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 797, __FUNCTION__))->type_non_common.lang_1))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 797, __FUNCTION__, (TEMPLATE_INFO))))->args
;
798 tree elttype = TREE_VEC_ELT (targs, 0)(*((const_cast<tree *> (tree_vec_elt_check ((targs), (0
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 798, __FUNCTION__)))))
;
799
800 if (!same_type_ignoring_top_level_qualifiers_p
801 (TREE_TYPE (memtype)((contains_struct_check ((memtype), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 801, __FUNCTION__))->typed.type)
, elttype))
802 return;
803
804 tree begin = find_list_begin (init);
805 if (!begin)
806 return;
807
808 location_t loc = cp_expr_loc_or_input_loc (init);
809 warning_at (loc, OPT_Winit_list_lifetime,
810 "initializing %qD from %qE does not extend the lifetime "
811 "of the underlying array", member, begin);
812}
813
814/* Data structure for find_uninit_fields_r, below. */
815
816struct find_uninit_data {
817 /* The set tracking the yet-uninitialized members. */
818 hash_set<tree> *uninitialized;
819 /* The data member we are currently initializing. It can be either
820 a type (initializing a base class/delegating constructors), or
821 a COMPONENT_REF. */
822 tree member;
823};
824
825/* walk_tree callback that warns about using uninitialized data in
826 a member-initializer-list. */
827
828static tree
829find_uninit_fields_r (tree *tp, int *walk_subtrees, void *data)
830{
831 find_uninit_data *d = static_cast<find_uninit_data *>(data);
832 hash_set<tree> *uninitialized = d->uninitialized;
833 tree init = *tp;
834 const tree_code code = TREE_CODE (init)((enum tree_code) (init)->base.code);
835
836 /* No need to look into types or unevaluated operands. */
837 if (TYPE_P (init)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code
) (init)->base.code))] == tcc_type)
|| unevaluated_p (code))
838 {
839 *walk_subtrees = false;
840 return NULL_TREE(tree) __null;
841 }
842
843 switch (code)
844 {
845 /* We'd need data flow info to avoid false positives. */
846 case COND_EXPR:
847 case VEC_COND_EXPR:
848 case BIND_EXPR:
849 /* We might see a MODIFY_EXPR in cases like S() : a((b = 42)), c(b) { }
850 where the initializer for 'a' surreptitiously initializes 'b'. Let's
851 not bother with these complicated scenarios in the front end. */
852 case MODIFY_EXPR:
853 /* Don't attempt to handle statement-expressions, either. */
854 case STATEMENT_LIST:
855 uninitialized->empty ();
856 gcc_fallthrough ();
857 /* If we're just taking the address of an object, it doesn't matter
858 whether it's been initialized. */
859 case ADDR_EXPR:
860 *walk_subtrees = false;
861 return NULL_TREE(tree) __null;
862 default:
863 break;
864 }
865
866 /* We'd need data flow info to avoid false positives. */
867 if (truth_value_p (code))
868 goto give_up;
869 /* Attempt to handle a simple a{b}, but no more. */
870 else if (BRACE_ENCLOSED_INITIALIZER_P (init)(((enum tree_code) (init)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((init), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 870, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
)
871 {
872 if (CONSTRUCTOR_NELTS (init)(vec_safe_length (((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 872, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
== 1
873 && !BRACE_ENCLOSED_INITIALIZER_P (CONSTRUCTOR_ELT (init, 0)->value)(((enum tree_code) ((&(*((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 873, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[0
])->value)->base.code) == CONSTRUCTOR && ((contains_struct_check
(((&(*((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 873, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[0
])->value), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 873, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
)
874 init = CONSTRUCTOR_ELT (init, 0)(&(*((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 874, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[0
])
->value;
875 else
876 goto give_up;
877 }
878 /* Warn about uninitialized 'this'. */
879 else if (code == CALL_EXPR)
880 {
881 tree fn = get_callee_fndecl (init);
882 if (fn && DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)(((enum tree_code) (((contains_struct_check ((fn), (TS_TYPED)
, "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 882, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE
)
)
883 {
884 tree op = CALL_EXPR_ARG (init, 0)(*((const_cast<tree*> (tree_operand_check (((tree_check
((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 884, __FUNCTION__, (CALL_EXPR)))), ((0) + 3), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 884, __FUNCTION__)))))
;
885 if (TREE_CODE (op)((enum tree_code) (op)->base.code) == ADDR_EXPR)
886 op = TREE_OPERAND (op, 0)(*((const_cast<tree*> (tree_operand_check ((op), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 886, __FUNCTION__)))))
;
887 temp_override<tree> ovr (d->member, DECL_ARGUMENTS (fn)((tree_check ((fn), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 887, __FUNCTION__, (FUNCTION_DECL)))->function_decl.arguments
)
);
888 cp_walk_tree_without_duplicates (&op, find_uninit_fields_r, data)walk_tree_without_duplicates_1 (&op, find_uninit_fields_r
, data, cp_walk_subtrees)
;
889 }
890 /* Functions (whether static or nonstatic member) may have side effects
891 and initialize other members; it's not the front end's job to try to
892 figure it out. But don't give up for constructors: we still want to
893 warn when initializing base classes:
894
895 struct D : public B {
896 int x;
897 D() : B(x) {}
898 };
899
900 so carry on to detect that 'x' is used uninitialized. */
901 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 901, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn))
, "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 901, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
)
902 goto give_up;
903 }
904
905 /* If we find FIELD in the uninitialized set, we warn. */
906 if (code == COMPONENT_REF)
907 {
908 tree field = TREE_OPERAND (init, 1)(*((const_cast<tree*> (tree_operand_check ((init), (1),
"/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 908, __FUNCTION__)))))
;
909 tree type = TYPE_P (d->member)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code
) (d->member)->base.code))] == tcc_type)
? d->member : TREE_TYPE (d->member)((contains_struct_check ((d->member), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 909, __FUNCTION__))->typed.type)
;
910
911 /* We're initializing a reference member with itself. */
912 if (TYPE_REF_P (type)(((enum tree_code) (type)->base.code) == REFERENCE_TYPE) && cp_tree_equal (d->member, init))
913 warning_at (EXPR_LOCATION (init)((((init)) && ((tree_code_type_tmpl <0>::tree_code_type
[(int) (((enum tree_code) ((init))->base.code))]) >= tcc_reference
&& (tree_code_type_tmpl <0>::tree_code_type[(int
) (((enum tree_code) ((init))->base.code))]) <= tcc_expression
)) ? (init)->exp.locus : ((location_t) 0))
, OPT_Winit_self,
914 "%qD is initialized with itself", field);
915 else if (cp_tree_equal (TREE_OPERAND (init, 0)(*((const_cast<tree*> (tree_operand_check ((init), (0),
"/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 915, __FUNCTION__)))))
, current_class_ref(*((cfun + 0) && ((cfun + 0)->language) ? &((cfun
+ 0)->language)->x_current_class_ref : &scope_chain
->x_current_class_ref))
)
916 && uninitialized->contains (field))
917 {
918 if (TYPE_REF_P (TREE_TYPE (field))(((enum tree_code) (((contains_struct_check ((field), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 918, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
)
)
919 warning_at (EXPR_LOCATION (init)((((init)) && ((tree_code_type_tmpl <0>::tree_code_type
[(int) (((enum tree_code) ((init))->base.code))]) >= tcc_reference
&& (tree_code_type_tmpl <0>::tree_code_type[(int
) (((enum tree_code) ((init))->base.code))]) <= tcc_expression
)) ? (init)->exp.locus : ((location_t) 0))
, OPT_Wuninitialized,
920 "reference %qD is not yet bound to a value when used "
921 "here", field);
922 else if (!INDIRECT_TYPE_P (type)((((enum tree_code) (type)->base.code) == POINTER_TYPE) ||
(((enum tree_code) (type)->base.code) == REFERENCE_TYPE))
|| is_this_parameter (d->member))
923 warning_at (EXPR_LOCATION (init)((((init)) && ((tree_code_type_tmpl <0>::tree_code_type
[(int) (((enum tree_code) ((init))->base.code))]) >= tcc_reference
&& (tree_code_type_tmpl <0>::tree_code_type[(int
) (((enum tree_code) ((init))->base.code))]) <= tcc_expression
)) ? (init)->exp.locus : ((location_t) 0))
, OPT_Wuninitialized,
924 "member %qD is used uninitialized", field);
925 *walk_subtrees = false;
926 }
927 }
928
929 return NULL_TREE(tree) __null;
930
931give_up:
932 *walk_subtrees = false;
933 uninitialized->empty ();
934 return integer_zero_nodeglobal_trees[TI_INTEGER_ZERO];
935}
936
937/* Wrapper around find_uninit_fields_r above. */
938
939static void
940find_uninit_fields (tree *t, hash_set<tree> *uninitialized, tree member)
941{
942 if (!uninitialized->is_empty ())
943 {
944 find_uninit_data data = { uninitialized, member };
945 cp_walk_tree_without_duplicates (t, find_uninit_fields_r, &data)walk_tree_without_duplicates_1 (t, find_uninit_fields_r, &
data, cp_walk_subtrees)
;
946 }
947}
948
949/* Initialize MEMBER, a FIELD_DECL, with INIT, a TREE_LIST of
950 arguments. If TREE_LIST is void_type_node, an empty initializer
951 list was given; if NULL_TREE no initializer was given. UNINITIALIZED
952 is the hash set that tracks uninitialized fields. */
953
954static void
955perform_member_init (tree member, tree init, hash_set<tree> &uninitialized)
956{
957 tree decl;
958 tree type = TREE_TYPE (member)((contains_struct_check ((member), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 958, __FUNCTION__))->typed.type)
;
959
960 /* Use the non-static data member initializer if there was no
961 mem-initializer for this field. */
962 if (init == NULL_TREE(tree) __null)
963 init = get_nsdmi (member, /*ctor*/true, tf_warning_or_error);
964
965 if (init == error_mark_nodeglobal_trees[TI_ERROR_MARK])
966 return;
967
968 /* Effective C++ rule 12 requires that all data members be
969 initialized. */
970 if (warn_ecppglobal_options.x_warn_ecpp && init == NULL_TREE(tree) __null && TREE_CODE (type)((enum tree_code) (type)->base.code) != ARRAY_TYPE)
971 warning_at (DECL_SOURCE_LOCATION (current_function_decl)((contains_struct_check ((current_function_decl), (TS_DECL_MINIMAL
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 971, __FUNCTION__))->decl_minimal.locus)
, OPT_Weffc__,
972 "%qD should be initialized in the member initialization list",
973 member);
974
975 /* Get an lvalue for the data member. */
976 decl = build_class_member_access_expr (current_class_ref(*((cfun + 0) && ((cfun + 0)->language) ? &((cfun
+ 0)->language)->x_current_class_ref : &scope_chain
->x_current_class_ref))
, member,
977 /*access_path=*/NULL_TREE(tree) __null,
978 /*preserve_reference=*/true,
979 tf_warning_or_error);
980 if (decl == error_mark_nodeglobal_trees[TI_ERROR_MARK])
981 return;
982
983 if ((warn_init_selfglobal_options.x_warn_init_self || warn_uninitializedglobal_options.x_warn_uninitialized)
984 && init
985 && TREE_CODE (init)((enum tree_code) (init)->base.code) == TREE_LIST
986 && TREE_CHAIN (init)((contains_struct_check ((init), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 986, __FUNCTION__))->common.chain)
== NULL_TREE(tree) __null)
987 {
988 tree val = TREE_VALUE (init)((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 988, __FUNCTION__, (TREE_LIST)))->list.value)
;
989 /* Handle references. */
990 if (REFERENCE_REF_P (val)((((enum tree_code) (val)->base.code) == INDIRECT_REF) &&
((contains_struct_check (((*((const_cast<tree*> (tree_operand_check
((val), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 990, __FUNCTION__)))))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 990, __FUNCTION__))->typed.type) && (((enum tree_code
) (((contains_struct_check (((*((const_cast<tree*> (tree_operand_check
(((val)), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 990, __FUNCTION__)))))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 990, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
))
)
991 val = TREE_OPERAND (val, 0)(*((const_cast<tree*> (tree_operand_check ((val), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 991, __FUNCTION__)))))
;
992 if (TREE_CODE (val)((enum tree_code) (val)->base.code) == COMPONENT_REF && TREE_OPERAND (val, 1)(*((const_cast<tree*> (tree_operand_check ((val), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 992, __FUNCTION__)))))
== member
993 && TREE_OPERAND (val, 0)(*((const_cast<tree*> (tree_operand_check ((val), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 993, __FUNCTION__)))))
== current_class_ref(*((cfun + 0) && ((cfun + 0)->language) ? &((cfun
+ 0)->language)->x_current_class_ref : &scope_chain
->x_current_class_ref))
)
994 warning_at (DECL_SOURCE_LOCATION (current_function_decl)((contains_struct_check ((current_function_decl), (TS_DECL_MINIMAL
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 994, __FUNCTION__))->decl_minimal.locus)
,
995 OPT_Winit_self, "%qD is initialized with itself",
996 member);
997 else
998 find_uninit_fields (&val, &uninitialized, decl);
999 }
1000
1001 if (array_of_unknown_bound_p (type))
1002 {
1003 maybe_reject_flexarray_init (member, init);
1004 return;
1005 }
1006
1007 if (init && TREE_CODE (init)((enum tree_code) (init)->base.code) == TREE_LIST)
1008 {
1009 /* A(): a{e} */
1010 if (DIRECT_LIST_INIT_P (TREE_VALUE (init))((((enum tree_code) (((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1010, __FUNCTION__, (TREE_LIST)))->list.value))->base
.code) == CONSTRUCTOR && ((contains_struct_check ((((
tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1010, __FUNCTION__, (TREE_LIST)))->list.value)), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1010, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
]) && (((tree_not_check2 (((tree_check ((((tree_check
((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1010, __FUNCTION__, (TREE_LIST)))->list.value)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1010, __FUNCTION__, (CONSTRUCTOR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1010, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0)))
)
1011 init = build_x_compound_expr_from_list (init, ELK_MEM_INIT,
1012 tf_warning_or_error);
1013 /* We are trying to initialize an array from a ()-list. If we
1014 should attempt to do so, conjure up a CONSTRUCTOR. */
1015 else if (TREE_CODE (type)((enum tree_code) (type)->base.code) == ARRAY_TYPE
1016 /* P0960 is a C++20 feature. */
1017 && cxx_dialect >= cxx20)
1018 init = do_aggregate_paren_init (init, type);
1019 else if (!CLASS_TYPE_P (type)(((((enum tree_code) (type)->base.code)) == RECORD_TYPE ||
(((enum tree_code) (type)->base.code)) == UNION_TYPE) &&
((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1019, __FUNCTION__))->type_common.lang_flag_5))
)
1020 init = build_x_compound_expr_from_list (init, ELK_MEM_INIT,
1021 tf_warning_or_error);
1022 /* If we're initializing a class from a ()-list, leave the TREE_LIST
1023 alone: we might call an appropriate constructor, or (in C++20)
1024 do aggregate-initialization. */
1025 }
1026
1027 /* Assume we are initializing the member. */
1028 bool member_initialized_p = true;
1029
1030 if (init == void_type_nodeglobal_trees[TI_VOID_TYPE])
1031 {
1032 /* mem() means value-initialization. */
1033 if (TREE_CODE (type)((enum tree_code) (type)->base.code) == ARRAY_TYPE)
1034 {
1035 init = build_vec_init_expr (type, init, tf_warning_or_error);
1036 init = cp_build_init_expr (decl, init);
1037 finish_expr_stmt (init);
1038 }
1039 else
1040 {
1041 tree value = build_value_init (type, tf_warning_or_error);
1042 if (value == error_mark_nodeglobal_trees[TI_ERROR_MARK])
1043 return;
1044 init = cp_build_init_expr (decl, value);
1045 finish_expr_stmt (init);
1046 }
1047 }
1048 /* Deal with this here, as we will get confused if we try to call the
1049 assignment op for an anonymous union. This can happen in a
1050 synthesized copy constructor. */
1051 else if (ANON_AGGR_TYPE_P (type)((((((enum tree_code) (type)->base.code)) == RECORD_TYPE ||
(((enum tree_code) (type)->base.code)) == UNION_TYPE) &&
((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1051, __FUNCTION__))->type_common.lang_flag_5)) &&
(((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1051, __FUNCTION__))->type_with_lang_specific.lang_specific
))->anon_aggr)
)
1052 {
1053 if (init)
1054 {
1055 init = cp_build_init_expr (decl, TREE_VALUE (init)((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1055, __FUNCTION__, (TREE_LIST)))->list.value)
);
1056 finish_expr_stmt (init);
1057 }
1058 }
1059 else if (init
1060 && (TYPE_REF_P (type)(((enum tree_code) (type)->base.code) == REFERENCE_TYPE)
1061 || (TREE_CODE (init)((enum tree_code) (init)->base.code) == CONSTRUCTOR
1062 && (CP_AGGREGATE_TYPE_P (type)(gnu_vector_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) && ((tree_class_check ((type), (
tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1062, __FUNCTION__))->type_common.lang_flag_5)) &&
(((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1062, __FUNCTION__))->type_common.size) != (tree) __null
) && !((((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1062, __FUNCTION__))->type_with_lang_specific.lang_specific
))->non_aggregate)))
1063 || is_std_init_list (type)))))
1064 {
1065 /* With references and list-initialization, we need to deal with
1066 extending temporary lifetimes. 12.2p5: "A temporary bound to a
1067 reference member in a constructor’s ctor-initializer (12.6.2)
1068 persists until the constructor exits." */
1069 unsigned i; tree t;
1070 releasing_vec cleanups;
1071 if (!same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (init)((contains_struct_check ((init), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1071, __FUNCTION__))->typed.type)
, type))
1072 {
1073 if (BRACE_ENCLOSED_INITIALIZER_P (init)(((enum tree_code) (init)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((init), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1073, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
1074 && CP_AGGREGATE_TYPE_P (type)(gnu_vector_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) && ((tree_class_check ((type), (
tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1074, __FUNCTION__))->type_common.lang_flag_5)) &&
(((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1074, __FUNCTION__))->type_common.size) != (tree) __null
) && !((((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1074, __FUNCTION__))->type_with_lang_specific.lang_specific
))->non_aggregate)))
)
1075 init = reshape_init (type, init, tf_warning_or_error);
1076 init = digest_init (type, init, tf_warning_or_error);
1077 }
1078 if (init == error_mark_nodeglobal_trees[TI_ERROR_MARK])
1079 return;
1080 if (is_empty_field (member)
1081 && !TREE_SIDE_EFFECTS (init)((non_type_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1081, __FUNCTION__))->base.side_effects_flag)
)
1082 /* Don't add trivial initialization of an empty base/field, as they
1083 might not be ordered the way the back-end expects. */
1084 return;
1085 /* A FIELD_DECL doesn't really have a suitable lifetime, but
1086 make_temporary_var_for_ref_to_temp will treat it as automatic and
1087 set_up_extended_ref_temp wants to use the decl in a warning. */
1088 init = extend_ref_init_temps (member, init, &cleanups);
1089 if (TREE_CODE (type)((enum tree_code) (type)->base.code) == ARRAY_TYPE
1090 && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (type))(((tree_class_check ((((contains_struct_check ((type), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1090, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1090, __FUNCTION__))->type_common.lang_flag_4))
)
1091 init = build_vec_init_expr (type, init, tf_warning_or_error);
1092 init = cp_build_init_expr (decl, init);
1093 finish_expr_stmt (init);
1094 FOR_EACH_VEC_ELT (*cleanups, i, t)for (i = 0; (*cleanups).iterate ((i), &(t)); ++(i))
1095 push_cleanup (NULL_TREE(tree) __null, t, false);
1096 }
1097 else if (type_build_ctor_call (type)
1098 || (init && CLASS_TYPE_P (strip_array_types (type))(((((enum tree_code) (strip_array_types (type))->base.code
)) == RECORD_TYPE || (((enum tree_code) (strip_array_types (type
))->base.code)) == UNION_TYPE) && ((tree_class_check
((strip_array_types (type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1098, __FUNCTION__))->type_common.lang_flag_5))
))
1099 {
1100 if (TREE_CODE (type)((enum tree_code) (type)->base.code) == ARRAY_TYPE)
1101 {
1102 if (init == NULL_TREE(tree) __null
1103 || same_type_ignoring_top_level_qualifiers_p (type,
1104 TREE_TYPE (init)((contains_struct_check ((init), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1104, __FUNCTION__))->typed.type)
))
1105 {
1106 if (TYPE_DOMAIN (type)((tree_check ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1106, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
)
&& TYPE_MAX_VALUE (TYPE_DOMAIN (type))((tree_check5 ((((tree_check ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1106, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1106, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE
), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval
)
)
1107 {
1108 /* Initialize the array only if it's not a flexible
1109 array member (i.e., if it has an upper bound). */
1110 init = build_vec_init_expr (type, init, tf_warning_or_error);
1111 init = cp_build_init_expr (decl, init);
1112 finish_expr_stmt (init);
1113 }
1114 }
1115 else
1116 error ("invalid initializer for array member %q#D", member);
1117 }
1118 else
1119 {
1120 int flags = LOOKUP_NORMAL((1 << 0));
1121 if (DECL_DEFAULTED_FN (current_function_decl)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (current_function_decl)->base.code) ==
TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<
union tree_node *> ((((tree_check ((current_function_decl)
, "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1121, __FUNCTION__, (TEMPLATE_DECL))))))))->result : current_function_decl
)), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1121, __FUNCTION__))->decl_common.lang_specific); if (!(
((enum tree_code) (current_function_decl)->base.code) == FUNCTION_DECL
|| (((enum tree_code) (current_function_decl)->base.code)
== TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast
<union tree_node *> ((((tree_check ((current_function_decl
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1121, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((current_function_decl
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1121, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1121, __FUNCTION__); &lt->u.fn; })->defaulted_p)
)
1122 flags |= LOOKUP_DEFAULTED(((((((1 << 6) << 1) << 1) << 1) <<
1) << 1) << 1)
;
1123 if (CP_TYPE_CONST_P (type)((cp_type_quals (type) & TYPE_QUAL_CONST) != 0)
1124 && init == NULL_TREE(tree) __null
1125 && default_init_uninitialized_part (type))
1126 {
1127 /* TYPE_NEEDS_CONSTRUCTING can be set just because we have a
1128 vtable; still give this diagnostic. */
1129 auto_diagnostic_group d;
1130 if (permerror (DECL_SOURCE_LOCATION (current_function_decl)((contains_struct_check ((current_function_decl), (TS_DECL_MINIMAL
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1130, __FUNCTION__))->decl_minimal.locus)
,
1131 "uninitialized const member in %q#T", type))
1132 inform (DECL_SOURCE_LOCATION (member)((contains_struct_check ((member), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1132, __FUNCTION__))->decl_minimal.locus)
,
1133 "%q#D should be initialized", member );
1134 }
1135 finish_expr_stmt (build_aggr_init (decl, init, flags,
1136 tf_warning_or_error));
1137 }
1138 }
1139 else
1140 {
1141 if (init == NULL_TREE(tree) __null)
1142 {
1143 tree core_type;
1144 /* member traversal: note it leaves init NULL */
1145 if (TYPE_REF_P (type)(((enum tree_code) (type)->base.code) == REFERENCE_TYPE))
1146 {
1147 auto_diagnostic_group d;
1148 if (permerror (DECL_SOURCE_LOCATION (current_function_decl)((contains_struct_check ((current_function_decl), (TS_DECL_MINIMAL
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1148, __FUNCTION__))->decl_minimal.locus)
,
1149 "uninitialized reference member in %q#T", type))
1150 inform (DECL_SOURCE_LOCATION (member)((contains_struct_check ((member), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1150, __FUNCTION__))->decl_minimal.locus)
,
1151 "%q#D should be initialized", member);
1152 }
1153 else if (CP_TYPE_CONST_P (type)((cp_type_quals (type) & TYPE_QUAL_CONST) != 0))
1154 {
1155 auto_diagnostic_group d;
1156 if (permerror (DECL_SOURCE_LOCATION (current_function_decl)((contains_struct_check ((current_function_decl), (TS_DECL_MINIMAL
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1156, __FUNCTION__))->decl_minimal.locus)
,
1157 "uninitialized const member in %q#T", type))
1158 inform (DECL_SOURCE_LOCATION (member)((contains_struct_check ((member), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1158, __FUNCTION__))->decl_minimal.locus)
,
1159 "%q#D should be initialized", member );
1160 }
1161
1162 core_type = strip_array_types (type);
1163
1164 if (CLASS_TYPE_P (core_type)(((((enum tree_code) (core_type)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (core_type)->base.code)) == UNION_TYPE
) && ((tree_class_check ((core_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1164, __FUNCTION__))->type_common.lang_flag_5))
1165 && (CLASSTYPE_READONLY_FIELDS_NEED_INIT (core_type)(((tree_class_check ((core_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1165, __FUNCTION__))->type_with_lang_specific.lang_specific
) ? (((tree_class_check ((core_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1165, __FUNCTION__))->type_with_lang_specific.lang_specific
))->const_needs_init : 0)
1166 || CLASSTYPE_REF_FIELDS_NEED_INIT (core_type)(((tree_class_check ((core_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1166, __FUNCTION__))->type_with_lang_specific.lang_specific
) ? (((tree_class_check ((core_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1166, __FUNCTION__))->type_with_lang_specific.lang_specific
))->ref_needs_init : 0)
))
1167 diagnose_uninitialized_cst_or_ref_member (core_type,
1168 /*using_new=*/false,
1169 /*complain=*/true);
1170
1171 /* We left the member uninitialized. */
1172 member_initialized_p = false;
1173 }
1174
1175 maybe_warn_list_ctor (member, init);
1176
1177 if (init)
1178 finish_expr_stmt (cp_build_modify_expr (input_location, decl,
1179 INIT_EXPR, init,
1180 tf_warning_or_error));
1181 }
1182
1183 if (member_initialized_p && warn_uninitializedglobal_options.x_warn_uninitialized)
1184 /* This member is now initialized, remove it from the uninitialized
1185 set. */
1186 uninitialized.remove (member);
1187
1188 if (type_build_dtor_call (type))
1189 {
1190 tree expr;
1191
1192 expr = build_class_member_access_expr (current_class_ref(*((cfun + 0) && ((cfun + 0)->language) ? &((cfun
+ 0)->language)->x_current_class_ref : &scope_chain
->x_current_class_ref))
, member,
1193 /*access_path=*/NULL_TREE(tree) __null,
1194 /*preserve_reference=*/false,
1195 tf_warning_or_error);
1196 expr = build_delete (input_location,
1197 type, expr, sfk_complete_destructor,
1198 LOOKUP_NONVIRTUAL(1 << 1)|LOOKUP_DESTRUCTOR(1 << 5), 0,
1199 tf_warning_or_error);
1200
1201 if (expr != error_mark_nodeglobal_trees[TI_ERROR_MARK]
1202 && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)(((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1202, __FUNCTION__))->type_common.lang_flag_4))
)
1203 finish_eh_cleanup (expr);
1204 }
1205}
1206
1207/* Returns a TREE_LIST containing (as the TREE_PURPOSE of each node) all
1208 the FIELD_DECLs on the TYPE_FIELDS list for T, in reverse order. */
1209
1210static tree
1211build_field_list (tree t, tree list, int *uses_unions_or_anon_p)
1212{
1213 tree fields;
1214
1215 /* Note whether or not T is a union. */
1216 if (TREE_CODE (t)((enum tree_code) (t)->base.code) == UNION_TYPE)
1217 *uses_unions_or_anon_p = 1;
1218
1219 for (fields = TYPE_FIELDS (t)((tree_check3 ((t), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1219, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)
; fields; fields = DECL_CHAIN (fields)(((contains_struct_check (((contains_struct_check ((fields), (
TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1219, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1219, __FUNCTION__))->common.chain))
)
1220 {
1221 tree fieldtype;
1222
1223 /* Skip CONST_DECLs for enumeration constants and so forth. */
1224 if (TREE_CODE (fields)((enum tree_code) (fields)->base.code) != FIELD_DECL || DECL_ARTIFICIAL (fields)((contains_struct_check ((fields), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1224, __FUNCTION__))->decl_common.artificial_flag)
)
1225 continue;
1226
1227 fieldtype = TREE_TYPE (fields)((contains_struct_check ((fields), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1227, __FUNCTION__))->typed.type)
;
1228
1229 /* For an anonymous struct or union, we must recursively
1230 consider the fields of the anonymous type. They can be
1231 directly initialized from the constructor. */
1232 if (ANON_AGGR_TYPE_P (fieldtype)((((((enum tree_code) (fieldtype)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (fieldtype)->base.code)) == UNION_TYPE
) && ((tree_class_check ((fieldtype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1232, __FUNCTION__))->type_common.lang_flag_5)) &&
(((tree_class_check ((fieldtype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1232, __FUNCTION__))->type_with_lang_specific.lang_specific
))->anon_aggr)
)
1233 {
1234 /* Add this field itself. Synthesized copy constructors
1235 initialize the entire aggregate. */
1236 list = tree_cons (fields, NULL_TREE(tree) __null, list);
1237 /* And now add the fields in the anonymous aggregate. */
1238 list = build_field_list (fieldtype, list, uses_unions_or_anon_p);
1239 *uses_unions_or_anon_p = 1;
1240 }
1241 /* Add this field. */
1242 else if (DECL_NAME (fields)((contains_struct_check ((fields), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1242, __FUNCTION__))->decl_minimal.name)
)
1243 list = tree_cons (fields, NULL_TREE(tree) __null, list);
1244 }
1245
1246 return list;
1247}
1248
1249/* Return the innermost aggregate scope for FIELD, whether that is
1250 the enclosing class or an anonymous aggregate within it. */
1251
1252static tree
1253innermost_aggr_scope (tree field)
1254{
1255 if (ANON_AGGR_TYPE_P (TREE_TYPE (field))((((((enum tree_code) (((contains_struct_check ((field), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1255, __FUNCTION__))->typed.type))->base.code)) == RECORD_TYPE
|| (((enum tree_code) (((contains_struct_check ((field), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1255, __FUNCTION__))->typed.type))->base.code)) == UNION_TYPE
) && ((tree_class_check ((((contains_struct_check ((field
), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1255, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1255, __FUNCTION__))->type_common.lang_flag_5)) &&
(((tree_class_check ((((contains_struct_check ((field), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1255, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1255, __FUNCTION__))->type_with_lang_specific.lang_specific
))->anon_aggr)
)
1256 return TREE_TYPE (field)((contains_struct_check ((field), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1256, __FUNCTION__))->typed.type)
;
1257 else
1258 return DECL_CONTEXT (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1258, __FUNCTION__))->decl_minimal.context)
;
1259}
1260
1261/* The MEM_INITS are a TREE_LIST. The TREE_PURPOSE of each list gives
1262 a FIELD_DECL or BINFO in T that needs initialization. The
1263 TREE_VALUE gives the initializer, or list of initializer arguments.
1264
1265 Return a TREE_LIST containing all of the initializations required
1266 for T, in the order in which they should be performed. The output
1267 list has the same format as the input. */
1268
1269static tree
1270sort_mem_initializers (tree t, tree mem_inits)
1271{
1272 tree init;
1273 tree base, binfo, base_binfo;
1274 tree sorted_inits;
1275 tree next_subobject;
1276 vec<tree, va_gc> *vbases;
1277 int i;
1278 int uses_unions_or_anon_p = 0;
1279
1280 /* Build up a list of initializations. The TREE_PURPOSE of entry
1281 will be the subobject (a FIELD_DECL or BINFO) to initialize. The
1282 TREE_VALUE will be the constructor arguments, or NULL if no
1283 explicit initialization was provided. */
1284 sorted_inits = NULL_TREE(tree) __null;
1285
1286 /* Process the virtual bases. */
1287 for (vbases = CLASSTYPE_VBASECLASSES (t)((((tree_class_check ((t), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1287, __FUNCTION__))->type_with_lang_specific.lang_specific
))->vbases)
, i = 0;
1288 vec_safe_iterate (vbases, i, &base); i++)
1289 sorted_inits = tree_cons (base, NULL_TREE(tree) __null, sorted_inits);
1290
1291 /* Process the direct bases. */
1292 for (binfo = TYPE_BINFO (t)((tree_check3 ((t), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1292, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.maxval)
, i = 0;
1293 BINFO_BASE_ITERATE (binfo, i, base_binfo)((&(tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1293, __FUNCTION__, (TREE_BINFO)))->binfo.base_binfos)->
iterate ((i), &(base_binfo)))
; ++i)
1294 if (!BINFO_VIRTUAL_P (base_binfo)((tree_check ((base_binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1294, __FUNCTION__, (TREE_BINFO)))->base.static_flag)
)
1295 sorted_inits = tree_cons (base_binfo, NULL_TREE(tree) __null, sorted_inits);
1296
1297 /* Process the non-static data members. */
1298 sorted_inits = build_field_list (t, sorted_inits, &uses_unions_or_anon_p);
1299 /* Reverse the entire list of initializations, so that they are in
1300 the order that they will actually be performed. */
1301 sorted_inits = nreverse (sorted_inits);
1302
1303 /* If the user presented the initializers in an order different from
1304 that in which they will actually occur, we issue a warning. Keep
1305 track of the next subobject which can be explicitly initialized
1306 without issuing a warning. */
1307 next_subobject = sorted_inits;
1308
1309 /* Go through the explicit initializers, filling in TREE_PURPOSE in
1310 the SORTED_INITS. */
1311 for (init = mem_inits; init; init = TREE_CHAIN (init)((contains_struct_check ((init), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1311, __FUNCTION__))->common.chain)
)
1312 {
1313 tree subobject;
1314 tree subobject_init;
1315
1316 subobject = TREE_PURPOSE (init)((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1316, __FUNCTION__, (TREE_LIST)))->list.purpose)
;
1317
1318 /* If the explicit initializers are in sorted order, then
1319 SUBOBJECT will be NEXT_SUBOBJECT, or something following
1320 it. */
1321 for (subobject_init = next_subobject;
1322 subobject_init;
1323 subobject_init = TREE_CHAIN (subobject_init)((contains_struct_check ((subobject_init), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1323, __FUNCTION__))->common.chain)
)
1324 if (TREE_PURPOSE (subobject_init)((tree_check ((subobject_init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1324, __FUNCTION__, (TREE_LIST)))->list.purpose)
== subobject)
1325 break;
1326
1327 /* Issue a warning if the explicit initializer order does not
1328 match that which will actually occur.
1329 ??? Are all these on the correct lines? */
1330 if (warn_reorderglobal_options.x_warn_reorder && !subobject_init)
1331 {
1332 if (TREE_CODE (TREE_PURPOSE (next_subobject))((enum tree_code) (((tree_check ((next_subobject), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1332, __FUNCTION__, (TREE_LIST)))->list.purpose))->base
.code)
== FIELD_DECL)
1333 warning_at (DECL_SOURCE_LOCATION (TREE_PURPOSE (next_subobject))((contains_struct_check ((((tree_check ((next_subobject), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1333, __FUNCTION__, (TREE_LIST)))->list.purpose)), (TS_DECL_MINIMAL
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1333, __FUNCTION__))->decl_minimal.locus)
,
1334 OPT_Wreorder, "%qD will be initialized after",
1335 TREE_PURPOSE (next_subobject)((tree_check ((next_subobject), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1335, __FUNCTION__, (TREE_LIST)))->list.purpose)
);
1336 else
1337 warning (OPT_Wreorder, "base %qT will be initialized after",
1338 TREE_PURPOSE (next_subobject)((tree_check ((next_subobject), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1338, __FUNCTION__, (TREE_LIST)))->list.purpose)
);
1339 if (TREE_CODE (subobject)((enum tree_code) (subobject)->base.code) == FIELD_DECL)
1340 warning_at (DECL_SOURCE_LOCATION (subobject)((contains_struct_check ((subobject), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1340, __FUNCTION__))->decl_minimal.locus)
,
1341 OPT_Wreorder, " %q#D", subobject);
1342 else
1343 warning (OPT_Wreorder, " base %qT", subobject);
1344 warning_at (DECL_SOURCE_LOCATION (current_function_decl)((contains_struct_check ((current_function_decl), (TS_DECL_MINIMAL
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1344, __FUNCTION__))->decl_minimal.locus)
,
1345 OPT_Wreorder, " when initialized here");
1346 }
1347
1348 /* Look again, from the beginning of the list. */
1349 if (!subobject_init)
1350 {
1351 subobject_init = sorted_inits;
1352 while (TREE_PURPOSE (subobject_init)((tree_check ((subobject_init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1352, __FUNCTION__, (TREE_LIST)))->list.purpose)
!= subobject)
1353 subobject_init = TREE_CHAIN (subobject_init)((contains_struct_check ((subobject_init), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1353, __FUNCTION__))->common.chain)
;
1354 }
1355
1356 /* It is invalid to initialize the same subobject more than
1357 once. */
1358 if (TREE_VALUE (subobject_init)((tree_check ((subobject_init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1358, __FUNCTION__, (TREE_LIST)))->list.value)
)
1359 {
1360 if (TREE_CODE (subobject)((enum tree_code) (subobject)->base.code) == FIELD_DECL)
1361 error_at (DECL_SOURCE_LOCATION (current_function_decl)((contains_struct_check ((current_function_decl), (TS_DECL_MINIMAL
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1361, __FUNCTION__))->decl_minimal.locus)
,
1362 "multiple initializations given for %qD",
1363 subobject);
1364 else
1365 error_at (DECL_SOURCE_LOCATION (current_function_decl)((contains_struct_check ((current_function_decl), (TS_DECL_MINIMAL
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1365, __FUNCTION__))->decl_minimal.locus)
,
1366 "multiple initializations given for base %qT",
1367 subobject);
1368 }
1369
1370 /* Record the initialization. */
1371 TREE_VALUE (subobject_init)((tree_check ((subobject_init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1371, __FUNCTION__, (TREE_LIST)))->list.value)
= TREE_VALUE (init)((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1371, __FUNCTION__, (TREE_LIST)))->list.value)
;
1372 /* Carry over the dummy TREE_TYPE node containing the source location. */
1373 TREE_TYPE (subobject_init)((contains_struct_check ((subobject_init), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1373, __FUNCTION__))->typed.type)
= TREE_TYPE (init)((contains_struct_check ((init), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1373, __FUNCTION__))->typed.type)
;
1374 next_subobject = subobject_init;
1375 }
1376
1377 /* [class.base.init]
1378
1379 If a ctor-initializer specifies more than one mem-initializer for
1380 multiple members of the same union (including members of
1381 anonymous unions), the ctor-initializer is ill-formed.
1382
1383 Here we also splice out uninitialized union members. */
1384 if (uses_unions_or_anon_p)
1385 {
1386 tree *last_p = NULL__null;
1387 tree *p;
1388 for (p = &sorted_inits; *p; )
1389 {
1390 tree field;
1391 tree ctx;
1392
1393 init = *p;
1394
1395 field = TREE_PURPOSE (init)((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1395, __FUNCTION__, (TREE_LIST)))->list.purpose)
;
1396
1397 /* Skip base classes. */
1398 if (TREE_CODE (field)((enum tree_code) (field)->base.code) != FIELD_DECL)
1399 goto next;
1400
1401 /* If this is an anonymous aggregate with no explicit initializer,
1402 splice it out. */
1403 if (!TREE_VALUE (init)((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1403, __FUNCTION__, (TREE_LIST)))->list.value)
&& ANON_AGGR_TYPE_P (TREE_TYPE (field))((((((enum tree_code) (((contains_struct_check ((field), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1403, __FUNCTION__))->typed.type))->base.code)) == RECORD_TYPE
|| (((enum tree_code) (((contains_struct_check ((field), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1403, __FUNCTION__))->typed.type))->base.code)) == UNION_TYPE
) && ((tree_class_check ((((contains_struct_check ((field
), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1403, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1403, __FUNCTION__))->type_common.lang_flag_5)) &&
(((tree_class_check ((((contains_struct_check ((field), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1403, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1403, __FUNCTION__))->type_with_lang_specific.lang_specific
))->anon_aggr)
)
1404 goto splice;
1405
1406 /* See if this field is a member of a union, or a member of a
1407 structure contained in a union, etc. */
1408 ctx = innermost_aggr_scope (field);
1409
1410 /* If this field is not a member of a union, skip it. */
1411 if (TREE_CODE (ctx)((enum tree_code) (ctx)->base.code) != UNION_TYPE
1412 && !ANON_AGGR_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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1412, __FUNCTION__))->type_common.lang_flag_5)) &&
(((tree_class_check ((ctx), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1412, __FUNCTION__))->type_with_lang_specific.lang_specific
))->anon_aggr)
)
1413 goto next;
1414
1415 /* If this union member has no explicit initializer and no NSDMI,
1416 splice it out. */
1417 if (TREE_VALUE (init)((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1417, __FUNCTION__, (TREE_LIST)))->list.value)
|| DECL_INITIAL (field)((contains_struct_check ((field), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1417, __FUNCTION__))->decl_common.initial)
)
1418 /* OK. */;
1419 else
1420 goto splice;
1421
1422 /* It's only an error if we have two initializers for the same
1423 union type. */
1424 if (!last_p)
1425 {
1426 last_p = p;
1427 goto next;
1428 }
1429
1430 /* See if LAST_FIELD and the field initialized by INIT are
1431 members of the same union (or the union itself). If so, there's
1432 a problem, unless they're actually members of the same structure
1433 which is itself a member of a union. For example, given:
1434
1435 union { struct { int i; int j; }; };
1436
1437 initializing both `i' and `j' makes sense. */
1438 ctx = common_enclosing_class
1439 (innermost_aggr_scope (field),
1440 innermost_aggr_scope (TREE_PURPOSE (*last_p)((tree_check ((*last_p), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1440, __FUNCTION__, (TREE_LIST)))->list.purpose)
));
1441
1442 if (ctx && (TREE_CODE (ctx)((enum tree_code) (ctx)->base.code) == UNION_TYPE
1443 || ctx == TREE_TYPE (TREE_PURPOSE (*last_p))((contains_struct_check ((((tree_check ((*last_p), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1443, __FUNCTION__, (TREE_LIST)))->list.purpose)), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1443, __FUNCTION__))->typed.type)
))
1444 {
1445 /* A mem-initializer hides an NSDMI. */
1446 if (TREE_VALUE (init)((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1446, __FUNCTION__, (TREE_LIST)))->list.value)
&& !TREE_VALUE (*last_p)((tree_check ((*last_p), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1446, __FUNCTION__, (TREE_LIST)))->list.value)
)
1447 *last_p = TREE_CHAIN (*last_p)((contains_struct_check ((*last_p), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1447, __FUNCTION__))->common.chain)
;
1448 else if (TREE_VALUE (*last_p)((tree_check ((*last_p), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1448, __FUNCTION__, (TREE_LIST)))->list.value)
&& !TREE_VALUE (init)((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1448, __FUNCTION__, (TREE_LIST)))->list.value)
)
1449 goto splice;
1450 else
1451 {
1452 error_at (DECL_SOURCE_LOCATION (current_function_decl)((contains_struct_check ((current_function_decl), (TS_DECL_MINIMAL
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1452, __FUNCTION__))->decl_minimal.locus)
,
1453 "initializations for multiple members of %qT",
1454 ctx);
1455 goto splice;
1456 }
1457 }
1458
1459 last_p = p;
1460
1461 next:
1462 p = &TREE_CHAIN (*p)((contains_struct_check ((*p), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1462, __FUNCTION__))->common.chain)
;
1463 continue;
1464 splice:
1465 *p = TREE_CHAIN (*p)((contains_struct_check ((*p), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1465, __FUNCTION__))->common.chain)
;
1466 }
1467 }
1468
1469 return sorted_inits;
1470}
1471
1472/* Callback for cp_walk_tree to mark all PARM_DECLs in a tree as read. */
1473
1474static tree
1475mark_exp_read_r (tree *tp, int *, void *)
1476{
1477 tree t = *tp;
1478 if (TREE_CODE (t)((enum tree_code) (t)->base.code) == PARM_DECL)
1479 mark_exp_read (t);
1480 return NULL_TREE(tree) __null;
1481}
1482
1483/* Initialize all bases and members of CURRENT_CLASS_TYPE. MEM_INITS
1484 is a TREE_LIST giving the explicit mem-initializer-list for the
1485 constructor. The TREE_PURPOSE of each entry is a subobject (a
1486 FIELD_DECL or a BINFO) of the CURRENT_CLASS_TYPE. The TREE_VALUE
1487 is a TREE_LIST giving the arguments to the constructor or
1488 void_type_node for an empty list of arguments. */
1489
1490void
1491emit_mem_initializers (tree mem_inits)
1492{
1493 int flags = LOOKUP_NORMAL((1 << 0));
1494
1495 /* We will already have issued an error message about the fact that
1496 the type is incomplete. */
1497 if (!COMPLETE_TYPE_P (current_class_type)(((tree_class_check ((scope_chain->class_type), (tcc_type)
, "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1497, __FUNCTION__))->type_common.size) != (tree) __null
)
)
1
Assuming the condition is true
2
Taking false branch
1498 return;
1499
1500 /* Keep a set holding fields that are not initialized. */
1501 hash_set<tree> uninitialized;
1502
1503 /* Initially that is all of them. */
1504 if (warn_uninitializedglobal_options.x_warn_uninitialized)
3
Assuming field 'x_warn_uninitialized' is 0
1505 for (tree f = next_aggregate_field (TYPE_FIELDS (current_class_type)((tree_check3 ((scope_chain->class_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1505, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)
);
1506 f != NULL_TREE(tree) __null;
1507 f = next_aggregate_field (DECL_CHAIN (f)(((contains_struct_check (((contains_struct_check ((f), (TS_DECL_MINIMAL
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1507, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1507, __FUNCTION__))->common.chain))
))
1508 if (!DECL_ARTIFICIAL (f)((contains_struct_check ((f), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1508, __FUNCTION__))->decl_common.artificial_flag)
1509 && !is_really_empty_class (TREE_TYPE (f)((contains_struct_check ((f), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1509, __FUNCTION__))->typed.type)
, /*ignore_vptr*/false))
1510 uninitialized.add (f);
1511
1512 if (mem_inits
4
Assuming 'mem_inits' is null
1513 && TYPE_P (TREE_PURPOSE (mem_inits))(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code
) (((tree_check ((mem_inits), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1513, __FUNCTION__, (TREE_LIST)))->list.purpose))->base
.code))] == tcc_type)
1514 && same_type_p (TREE_PURPOSE (mem_inits), current_class_type)comptypes ((((tree_check ((mem_inits), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1514, __FUNCTION__, (TREE_LIST)))->list.purpose)), (scope_chain
->class_type), 0)
)
1515 {
1516 /* Delegating constructor. */
1517 gcc_assert (TREE_CHAIN (mem_inits) == NULL_TREE)((void)(!(((contains_struct_check ((mem_inits), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1517, __FUNCTION__))->common.chain) == (tree) __null) ? fancy_abort
("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1517, __FUNCTION__), 0 : 0))
;
1518 tree ctor = perform_target_ctor (TREE_VALUE (mem_inits)((tree_check ((mem_inits), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1518, __FUNCTION__, (TREE_LIST)))->list.value)
);
1519 find_uninit_fields (&ctor, &uninitialized, current_class_typescope_chain->class_type);
1520 return;
1521 }
1522
1523 if (DECL_DEFAULTED_FN (current_function_decl)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (current_function_decl)->base.code) ==
TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<
union tree_node *> ((((tree_check ((current_function_decl)
, "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1523, __FUNCTION__, (TEMPLATE_DECL))))))))->result : current_function_decl
)), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1523, __FUNCTION__))->decl_common.lang_specific); if (!(
((enum tree_code) (current_function_decl)->base.code) == FUNCTION_DECL
|| (((enum tree_code) (current_function_decl)->base.code)
== TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast
<union tree_node *> ((((tree_check ((current_function_decl
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1523, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((current_function_decl
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1523, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1523, __FUNCTION__); &lt->u.fn; })->defaulted_p)
5
Assuming field 'code' is not equal to TEMPLATE_DECL
6
'?' condition is false
7
Assuming field 'code' is equal to FUNCTION_DECL
8
Assuming field 'selector' is equal to lds_fn
9
Taking false branch
10
Assuming field 'defaulted_p' is 0
1524 && ! DECL_INHERITED_CTOR (current_function_decl)((((enum tree_code) (current_function_decl)->base.code) ==
FUNCTION_DECL || (((enum tree_code) (current_function_decl)->
base.code) == TEMPLATE_DECL && ((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((current_function_decl
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1524, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((current_function_decl
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1524, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) && ((tree_check (((((enum
tree_code) (current_function_decl)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((current_function_decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1524, __FUNCTION__, (TEMPLATE_DECL))))))))->result : current_function_decl
)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1524, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
) ? __extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (current_function_decl)->base.code) ==
TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<
union tree_node *> ((((tree_check ((current_function_decl)
, "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1524, __FUNCTION__, (TEMPLATE_DECL))))))))->result : current_function_decl
)), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1524, __FUNCTION__))->decl_common.lang_specific); if (!(
((enum tree_code) (current_function_decl)->base.code) == FUNCTION_DECL
|| (((enum tree_code) (current_function_decl)->base.code)
== TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast
<union tree_node *> ((((tree_check ((current_function_decl
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1524, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((current_function_decl
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1524, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1524, __FUNCTION__); &lt->u.fn; })->context : (tree
) __null)
)
1525 flags |= LOOKUP_DEFAULTED(((((((1 << 6) << 1) << 1) << 1) <<
1) << 1) << 1)
;
1526
1527 /* Sort the mem-initializers into the order in which the
1528 initializations should be performed. */
1529 mem_inits = sort_mem_initializers (current_class_typescope_chain->class_type, mem_inits);
1530
1531 in_base_initializer((cfun + 0)->language)->x_in_base_initializer = 1;
1532
1533 /* Initialize base classes. */
1534 for (; (mem_inits
11
Assuming 'mem_inits' is non-null
13
Loop condition is true. Entering loop body
1535 && TREE_CODE (TREE_PURPOSE (mem_inits))((enum tree_code) (((tree_check ((mem_inits), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1535, __FUNCTION__, (TREE_LIST)))->list.purpose))->base
.code)
!= FIELD_DECL
);
12
Assuming field 'code' is not equal to FIELD_DECL
1536 mem_inits = TREE_CHAIN (mem_inits)((contains_struct_check ((mem_inits), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1536, __FUNCTION__))->common.chain)
)
1537 {
1538 tree subobject = TREE_PURPOSE (mem_inits)((tree_check ((mem_inits), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1538, __FUNCTION__, (TREE_LIST)))->list.purpose)
;
1539 tree arguments = TREE_VALUE (mem_inits)((tree_check ((mem_inits), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1539, __FUNCTION__, (TREE_LIST)))->list.value)
;
1540
1541 /* We already have issued an error message. */
1542 if (arguments == error_mark_nodeglobal_trees[TI_ERROR_MARK])
14
Assuming the condition is false
1543 continue;
1544
1545 /* Suppress access control when calling the inherited ctor. */
1546 bool inherited_base = (DECL_INHERITED_CTOR (current_function_decl)((((enum tree_code) (current_function_decl)->base.code) ==
FUNCTION_DECL || (((enum tree_code) (current_function_decl)->
base.code) == TEMPLATE_DECL && ((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((current_function_decl
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1546, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((current_function_decl
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1546, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) && ((tree_check (((((enum
tree_code) (current_function_decl)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((current_function_decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1546, __FUNCTION__, (TEMPLATE_DECL))))))))->result : current_function_decl
)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1546, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
) ? __extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (current_function_decl)->base.code) ==
TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<
union tree_node *> ((((tree_check ((current_function_decl)
, "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1546, __FUNCTION__, (TEMPLATE_DECL))))))))->result : current_function_decl
)), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1546, __FUNCTION__))->decl_common.lang_specific); if (!(
((enum tree_code) (current_function_decl)->base.code) == FUNCTION_DECL
|| (((enum tree_code) (current_function_decl)->base.code)
== TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast
<union tree_node *> ((((tree_check ((current_function_decl
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1546, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((current_function_decl
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1546, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1546, __FUNCTION__); &lt->u.fn; })->context : (tree
) __null)
15
Taking false branch
16
Assuming field 'code' is not equal to FUNCTION_DECL
17
Assuming field 'code' is not equal to TEMPLATE_DECL
1547 && flag_new_inheriting_ctorsglobal_options.x_flag_new_inheriting_ctors
1548 && arguments);
1549 if (inherited_base
17.1
'inherited_base' is false
17.1
'inherited_base' is false
)
18
Taking false branch
1550 push_deferring_access_checks (dk_deferred);
1551
1552 if (arguments == NULL_TREE(tree) __null)
19
Assuming 'arguments' is not equal to NULL_TREE
20
Taking false branch
1553 {
1554 /* If these initializations are taking place in a copy constructor,
1555 the base class should probably be explicitly initialized if there
1556 is a user-defined constructor in the base class (other than the
1557 default constructor, which will be called anyway). */
1558 if (extra_warningsglobal_options.x_extra_warnings
1559 && DECL_COPY_CONSTRUCTOR_P (current_function_decl)(((tree_check (((((enum tree_code) (current_function_decl)->
base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(
const_cast<union tree_node *> ((((tree_check ((current_function_decl
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1559, __FUNCTION__, (TEMPLATE_DECL))))))))->result : current_function_decl
)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1559, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
) && copy_fn_p (current_function_decl) > 0)
1560 && type_has_user_nondefault_constructor (BINFO_TYPE (subobject)((contains_struct_check (((tree_check ((subobject), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1560, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1560, __FUNCTION__))->typed.type)
))
1561 warning_at (DECL_SOURCE_LOCATION (current_function_decl)((contains_struct_check ((current_function_decl), (TS_DECL_MINIMAL
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1561, __FUNCTION__))->decl_minimal.locus)
,
1562 OPT_Wextra, "base class %q#T should be explicitly "
1563 "initialized in the copy constructor",
1564 BINFO_TYPE (subobject)((contains_struct_check (((tree_check ((subobject), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1564, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1564, __FUNCTION__))->typed.type)
);
1565 }
1566
1567 /* Initialize the base. */
1568 if (!BINFO_VIRTUAL_P (subobject)((tree_check ((subobject), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1568, __FUNCTION__, (TREE_BINFO)))->base.static_flag)
)
21
Assuming field 'static_flag' is 0
22
Taking true branch
1569 {
1570 tree base_addr;
1571
1572 base_addr = build_base_path (PLUS_EXPR, current_class_ptr(*((cfun + 0) && ((cfun + 0)->language) ? &((cfun
+ 0)->language)->x_current_class_ptr : &scope_chain
->x_current_class_ptr))
,
23
'?' condition is true
1573 subobject, 1, tf_warning_or_error);
1574 expand_aggr_init_1 (subobject, NULL_TREE(tree) __null,
24
Calling 'expand_aggr_init_1'
1575 cp_build_fold_indirect_ref (base_addr),
1576 arguments,
1577 flags,
1578 tf_warning_or_error);
1579 expand_cleanup_for_base (subobject, NULL_TREE(tree) __null);
1580 if (STATEMENT_LIST_TAIL (cur_stmt_list)((tree_check ((((current_stmt_tree ()->x_cur_stmt_list)->
last ())), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1580, __FUNCTION__, (STATEMENT_LIST)))->stmt_list.tail)
)
1581 find_uninit_fields (&STATEMENT_LIST_TAIL (cur_stmt_list)((tree_check ((((current_stmt_tree ()->x_cur_stmt_list)->
last ())), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1581, __FUNCTION__, (STATEMENT_LIST)))->stmt_list.tail)
->stmt,
1582 &uninitialized, BINFO_TYPE (subobject)((contains_struct_check (((tree_check ((subobject), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1582, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1582, __FUNCTION__))->typed.type)
);
1583 }
1584 else if (!ABSTRACT_CLASS_TYPE_P (current_class_type)((((((enum tree_code) (scope_chain->class_type)->base.code
)) == RECORD_TYPE || (((enum tree_code) (scope_chain->class_type
)->base.code)) == UNION_TYPE) && ((tree_class_check
((scope_chain->class_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1584, __FUNCTION__))->type_common.lang_flag_5)) &&
((((tree_class_check ((scope_chain->class_type), (tcc_type
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1584, __FUNCTION__))->type_with_lang_specific.lang_specific
))->pure_virtuals))
)
1585 /* C++14 DR1658 Means we do not have to construct vbases of
1586 abstract classes. */
1587 construct_virtual_base (subobject, arguments);
1588 else
1589 /* When not constructing vbases of abstract classes, at least mark
1590 the arguments expressions as read to avoid
1591 -Wunused-but-set-parameter false positives. */
1592 cp_walk_tree (&arguments, mark_exp_read_r, NULL, NULL)walk_tree_1 (&arguments, mark_exp_read_r, __null, __null,
cp_walk_subtrees)
;
1593
1594 if (inherited_base)
1595 pop_deferring_access_checks ();
1596 }
1597 in_base_initializer((cfun + 0)->language)->x_in_base_initializer = 0;
1598
1599 /* Initialize the vptrs. */
1600 initialize_vtbl_ptrs (current_class_ptr(*((cfun + 0) && ((cfun + 0)->language) ? &((cfun
+ 0)->language)->x_current_class_ptr : &scope_chain
->x_current_class_ptr))
);
1601
1602 /* Initialize the data members. */
1603 while (mem_inits)
1604 {
1605 /* If this initializer was explicitly provided, then the dummy TREE_TYPE
1606 node contains the source location. */
1607 iloc_sentinel ils (EXPR_LOCATION (TREE_TYPE (mem_inits))((((((contains_struct_check ((mem_inits), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1607, __FUNCTION__))->typed.type))) && ((tree_code_type_tmpl
<0>::tree_code_type[(int) (((enum tree_code) ((((contains_struct_check
((mem_inits), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1607, __FUNCTION__))->typed.type)))->base.code))]) >=
tcc_reference && (tree_code_type_tmpl <0>::tree_code_type
[(int) (((enum tree_code) ((((contains_struct_check ((mem_inits
), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1607, __FUNCTION__))->typed.type)))->base.code))]) <=
tcc_expression)) ? (((contains_struct_check ((mem_inits), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1607, __FUNCTION__))->typed.type))->exp.locus : ((location_t
) 0))
);
1608
1609 perform_member_init (TREE_PURPOSE (mem_inits)((tree_check ((mem_inits), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1609, __FUNCTION__, (TREE_LIST)))->list.purpose)
,
1610 TREE_VALUE (mem_inits)((tree_check ((mem_inits), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1610, __FUNCTION__, (TREE_LIST)))->list.value)
,
1611 uninitialized);
1612
1613 mem_inits = TREE_CHAIN (mem_inits)((contains_struct_check ((mem_inits), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1613, __FUNCTION__))->common.chain)
;
1614 }
1615}
1616
1617/* Returns the address of the vtable (i.e., the value that should be
1618 assigned to the vptr) for BINFO. */
1619
1620tree
1621build_vtbl_address (tree binfo)
1622{
1623 tree binfo_for = binfo;
1624 tree vtbl;
1625
1626 if (BINFO_VPTR_INDEX (binfo)((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1626, __FUNCTION__, (TREE_BINFO)))->binfo.vtt_vptr)
&& BINFO_VIRTUAL_P (binfo)((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1626, __FUNCTION__, (TREE_BINFO)))->base.static_flag)
)
1627 /* If this is a virtual primary base, then the vtable we want to store
1628 is that for the base this is being used as the primary base of. We
1629 can't simply skip the initialization, because we may be expanding the
1630 inits of a subobject constructor where the virtual base layout
1631 can be different. */
1632 while (BINFO_PRIMARY_P (binfo_for)((tree_not_check2 (((tree_check ((binfo_for), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1632, __FUNCTION__, (TREE_BINFO)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1632, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_5)
)
1633 binfo_for = BINFO_INHERITANCE_CHAIN (binfo_for)((tree_check ((binfo_for), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1633, __FUNCTION__, (TREE_BINFO)))->binfo.inheritance)
;
1634
1635 /* Figure out what vtable BINFO's vtable is based on, and mark it as
1636 used. */
1637 vtbl = get_vtbl_decl_for_binfo (binfo_for);
1638 TREE_USED (vtbl)((vtbl)->base.used_flag) = true;
1639
1640 /* Now compute the address to use when initializing the vptr. */
1641 vtbl = unshare_expr (BINFO_VTABLE (binfo_for)((tree_check ((binfo_for), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1641, __FUNCTION__, (TREE_BINFO)))->binfo.vtable)
);
1642 if (VAR_P (vtbl)(((enum tree_code) (vtbl)->base.code) == VAR_DECL))
1643 vtbl = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (vtbl)((contains_struct_check ((vtbl), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1643, __FUNCTION__))->typed.type)
), vtbl);
1644
1645 return vtbl;
1646}
1647
1648/* This code sets up the virtual function tables appropriate for
1649 the pointer DECL. It is a one-ply initialization.
1650
1651 BINFO is the exact type that DECL is supposed to be. In
1652 multiple inheritance, this might mean "C's A" if C : A, B. */
1653
1654static void
1655expand_virtual_init (tree binfo, tree decl)
1656{
1657 tree vtbl, vtbl_ptr;
1658 tree vtt_index;
1659
1660 /* Compute the initializer for vptr. */
1661 vtbl = build_vtbl_address (binfo);
1662
1663 /* We may get this vptr from a VTT, if this is a subobject
1664 constructor or subobject destructor. */
1665 vtt_index = BINFO_VPTR_INDEX (binfo)((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1665, __FUNCTION__, (TREE_BINFO)))->binfo.vtt_vptr)
;
1666 if (vtt_index)
1667 {
1668 tree vtbl2;
1669 tree vtt_parm;
1670
1671 /* Compute the value to use, when there's a VTT. */
1672 vtt_parm = current_vtt_parm((cfun + 0)->language)->x_vtt_parm;
1673 vtbl2 = fold_build_pointer_plus (vtt_parm, vtt_index)fold_build_pointer_plus_loc (((location_t) 0), vtt_parm, vtt_index
)
;
1674 vtbl2 = cp_build_fold_indirect_ref (vtbl2);
1675 vtbl2 = convert (TREE_TYPE (vtbl)((contains_struct_check ((vtbl), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1675, __FUNCTION__))->typed.type)
, vtbl2);
1676
1677 /* The actual initializer is the VTT value only in the subobject
1678 constructor. In maybe_clone_body we'll substitute NULL for
1679 the vtt_parm in the case of the non-subobject constructor. */
1680 vtbl = build_if_in_charge (vtbl, vtbl2);
1681 }
1682
1683 /* Compute the location of the vtpr. */
1684 vtbl_ptr = build_vfield_ref (cp_build_fold_indirect_ref (decl),
1685 TREE_TYPE (binfo)((contains_struct_check ((binfo), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1685, __FUNCTION__))->typed.type)
);
1686 gcc_assert (vtbl_ptr != error_mark_node)((void)(!(vtbl_ptr != global_trees[TI_ERROR_MARK]) ? fancy_abort
("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1686, __FUNCTION__), 0 : 0))
;
1687
1688 /* Assign the vtable to the vptr. */
1689 vtbl = convert_force (TREE_TYPE (vtbl_ptr)((contains_struct_check ((vtbl_ptr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1689, __FUNCTION__))->typed.type)
, vtbl, 0, tf_warning_or_error);
1690 finish_expr_stmt (cp_build_modify_expr (input_location, vtbl_ptr, NOP_EXPR,
1691 vtbl, tf_warning_or_error));
1692}
1693
1694/* If an exception is thrown in a constructor, those base classes already
1695 constructed must be destroyed. This function creates the cleanup
1696 for BINFO, which has just been constructed. If FLAG is non-NULL,
1697 it is a DECL which is nonzero when this base needs to be
1698 destroyed. */
1699
1700static void
1701expand_cleanup_for_base (tree binfo, tree flag)
1702{
1703 tree expr;
1704
1705 if (!type_build_dtor_call (BINFO_TYPE (binfo)((contains_struct_check (((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1705, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1705, __FUNCTION__))->typed.type)
))
1706 return;
1707
1708 /* Call the destructor. */
1709 expr = build_special_member_call (current_class_ref(*((cfun + 0) && ((cfun + 0)->language) ? &((cfun
+ 0)->language)->x_current_class_ref : &scope_chain
->x_current_class_ref))
,
1710 base_dtor_identifiercp_global_trees[CPTI_BASE_DTOR_IDENTIFIER],
1711 NULL__null,
1712 binfo,
1713 LOOKUP_NORMAL((1 << 0)) | LOOKUP_NONVIRTUAL(1 << 1),
1714 tf_warning_or_error);
1715
1716 if (TYPE_HAS_TRIVIAL_DESTRUCTOR (BINFO_TYPE (binfo))(!(((tree_class_check ((((contains_struct_check (((tree_check
((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1716, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1716, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1716, __FUNCTION__))->type_common.lang_flag_4)))
)
1717 return;
1718
1719 if (flag)
1720 expr = fold_build3_loc (input_location,
1721 COND_EXPR, void_type_nodeglobal_trees[TI_VOID_TYPE],
1722 c_common_truthvalue_conversion (input_location, flag),
1723 expr, integer_zero_nodeglobal_trees[TI_INTEGER_ZERO]);
1724
1725 finish_eh_cleanup (expr);
1726}
1727
1728/* Construct the virtual base-class VBASE passing the ARGUMENTS to its
1729 constructor. */
1730
1731static void
1732construct_virtual_base (tree vbase, tree arguments)
1733{
1734 tree inner_if_stmt;
1735 tree exp;
1736 tree flag;
1737
1738 /* If there are virtual base classes with destructors, we need to
1739 emit cleanups to destroy them if an exception is thrown during
1740 the construction process. These exception regions (i.e., the
1741 period during which the cleanups must occur) begin from the time
1742 the construction is complete to the end of the function. If we
1743 create a conditional block in which to initialize the
1744 base-classes, then the cleanup region for the virtual base begins
1745 inside a block, and ends outside of that block. This situation
1746 confuses the sjlj exception-handling code. Therefore, we do not
1747 create a single conditional block, but one for each
1748 initialization. (That way the cleanup regions always begin
1749 in the outer block.) We trust the back end to figure out
1750 that the FLAG will not change across initializations, and
1751 avoid doing multiple tests. */
1752 flag = DECL_CHAIN (DECL_ARGUMENTS (current_function_decl))(((contains_struct_check (((contains_struct_check ((((tree_check
((current_function_decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1752, __FUNCTION__, (FUNCTION_DECL)))->function_decl.arguments
)), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1752, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1752, __FUNCTION__))->common.chain))
;
1753 inner_if_stmt = begin_if_stmt ();
1754 finish_if_stmt_cond (flag, inner_if_stmt);
1755
1756 /* Compute the location of the virtual base. If we're
1757 constructing virtual bases, then we must be the most derived
1758 class. Therefore, we don't have to look up the virtual base;
1759 we already know where it is. */
1760 exp = convert_to_base_statically (current_class_ref(*((cfun + 0) && ((cfun + 0)->language) ? &((cfun
+ 0)->language)->x_current_class_ref : &scope_chain
->x_current_class_ref))
, vbase);
1761
1762 expand_aggr_init_1 (vbase, current_class_ref(*((cfun + 0) && ((cfun + 0)->language) ? &((cfun
+ 0)->language)->x_current_class_ref : &scope_chain
->x_current_class_ref))
, exp, arguments,
1763 0, tf_warning_or_error);
1764 finish_then_clause (inner_if_stmt);
1765 finish_if_stmt (inner_if_stmt);
1766
1767 expand_cleanup_for_base (vbase, flag);
1768}
1769
1770/* Find the context in which this FIELD can be initialized. */
1771
1772static tree
1773initializing_context (tree field)
1774{
1775 tree t = DECL_CONTEXT (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1775, __FUNCTION__))->decl_minimal.context)
;
1776
1777 /* Anonymous union members can be initialized in the first enclosing
1778 non-anonymous union context. */
1779 while (t && ANON_AGGR_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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1779, __FUNCTION__))->type_common.lang_flag_5)) &&
(((tree_class_check ((t), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1779, __FUNCTION__))->type_with_lang_specific.lang_specific
))->anon_aggr)
)
1780 t = TYPE_CONTEXT (t)((tree_class_check ((t), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1780, __FUNCTION__))->type_common.context)
;
1781 return t;
1782}
1783
1784/* Function to give error message if member initialization specification
1785 is erroneous. FIELD is the member we decided to initialize.
1786 TYPE is the type for which the initialization is being performed.
1787 FIELD must be a member of TYPE.
1788
1789 MEMBER_NAME is the name of the member. */
1790
1791static int
1792member_init_ok_or_else (tree field, tree type, tree member_name)
1793{
1794 if (field == error_mark_nodeglobal_trees[TI_ERROR_MARK])
1795 return 0;
1796 if (!field)
1797 {
1798 error ("class %qT does not have any field named %qD", type,
1799 member_name);
1800 return 0;
1801 }
1802 if (VAR_P (field)(((enum tree_code) (field)->base.code) == VAR_DECL))
1803 {
1804 error ("%q#D is a static data member; it can only be "
1805 "initialized at its definition",
1806 field);
1807 return 0;
1808 }
1809 if (TREE_CODE (field)((enum tree_code) (field)->base.code) != FIELD_DECL)
1810 {
1811 error ("%q#D is not a non-static data member of %qT",
1812 field, type);
1813 return 0;
1814 }
1815 if (initializing_context (field) != type)
1816 {
1817 error ("class %qT does not have any field named %qD", type,
1818 member_name);
1819 return 0;
1820 }
1821
1822 return 1;
1823}
1824
1825/* NAME is a FIELD_DECL, an IDENTIFIER_NODE which names a field, or it
1826 is a _TYPE node or TYPE_DECL which names a base for that type.
1827 Check the validity of NAME, and return either the base _TYPE, base
1828 binfo, or the FIELD_DECL of the member. If NAME is invalid, return
1829 NULL_TREE and issue a diagnostic.
1830
1831 An old style unnamed direct single base construction is permitted,
1832 where NAME is NULL. */
1833
1834tree
1835expand_member_init (tree name)
1836{
1837 tree basetype;
1838 tree field;
1839
1840 if (!current_class_ref(*((cfun + 0) && ((cfun + 0)->language) ? &((cfun
+ 0)->language)->x_current_class_ref : &scope_chain
->x_current_class_ref))
)
1841 return NULL_TREE(tree) __null;
1842
1843 if (!name)
1844 {
1845 /* This is an obsolete unnamed base class initializer. The
1846 parser will already have warned about its use. */
1847 switch (BINFO_N_BASE_BINFOS (TYPE_BINFO (current_class_type))((&(tree_check ((((tree_check3 ((scope_chain->class_type
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1847, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.maxval)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1847, __FUNCTION__, (TREE_BINFO)))->binfo.base_binfos)->
length ())
)
1848 {
1849 case 0:
1850 error ("unnamed initializer for %qT, which has no base classes",
1851 current_class_typescope_chain->class_type);
1852 return NULL_TREE(tree) __null;
1853 case 1:
1854 basetype = BINFO_TYPE((contains_struct_check (((tree_check ((((*(&(tree_check (
(((tree_check3 ((scope_chain->class_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1855, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.maxval)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1855, __FUNCTION__, (TREE_BINFO)))->binfo.base_binfos))[
(0)])), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1855, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1855, __FUNCTION__))->typed.type)
1855 (BINFO_BASE_BINFO (TYPE_BINFO (current_class_type), 0))((contains_struct_check (((tree_check ((((*(&(tree_check (
(((tree_check3 ((scope_chain->class_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1855, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.maxval)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1855, __FUNCTION__, (TREE_BINFO)))->binfo.base_binfos))[
(0)])), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1855, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1855, __FUNCTION__))->typed.type)
;
1856 break;
1857 default:
1858 error ("unnamed initializer for %qT, which uses multiple inheritance",
1859 current_class_typescope_chain->class_type);
1860 return NULL_TREE(tree) __null;
1861 }
1862 }
1863 else if (TYPE_P (name)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code
) (name)->base.code))] == tcc_type)
)
1864 {
1865 basetype = TYPE_MAIN_VARIANT (name)((tree_class_check ((name), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1865, __FUNCTION__))->type_common.main_variant)
;
1866 name = TYPE_NAME (name)((tree_class_check ((name), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1866, __FUNCTION__))->type_common.name)
;
1867 }
1868 else if (TREE_CODE (name)((enum tree_code) (name)->base.code) == TYPE_DECL)
1869 basetype = TYPE_MAIN_VARIANT (TREE_TYPE (name))((tree_class_check ((((contains_struct_check ((name), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1869, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1869, __FUNCTION__))->type_common.main_variant)
;
1870 else
1871 basetype = NULL_TREE(tree) __null;
1872
1873 if (basetype)
1874 {
1875 tree class_binfo;
1876 tree direct_binfo;
1877 tree virtual_binfo;
1878 int i;
1879
1880 if (current_template_parmsscope_chain->template_parms
1881 || same_type_p (basetype, current_class_type)comptypes ((basetype), (scope_chain->class_type), 0))
1882 return basetype;
1883
1884 class_binfo = TYPE_BINFO (current_class_type)((tree_check3 ((scope_chain->class_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1884, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.maxval)
;
1885 direct_binfo = NULL_TREE(tree) __null;
1886 virtual_binfo = NULL_TREE(tree) __null;
1887
1888 /* Look for a direct base. */
1889 for (i = 0; BINFO_BASE_ITERATE (class_binfo, i, direct_binfo)((&(tree_check ((class_binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1889, __FUNCTION__, (TREE_BINFO)))->binfo.base_binfos)->
iterate ((i), &(direct_binfo)))
; ++i)
1890 if (SAME_BINFO_TYPE_P (BINFO_TYPE (direct_binfo), basetype)((((contains_struct_check (((tree_check ((direct_binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1890, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1890, __FUNCTION__))->typed.type)) == (basetype))
)
1891 break;
1892
1893 /* Look for a virtual base -- unless the direct base is itself
1894 virtual. */
1895 if (!direct_binfo || !BINFO_VIRTUAL_P (direct_binfo)((tree_check ((direct_binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1895, __FUNCTION__, (TREE_BINFO)))->base.static_flag)
)
1896 virtual_binfo = binfo_for_vbase (basetype, current_class_typescope_chain->class_type);
1897
1898 /* [class.base.init]
1899
1900 If a mem-initializer-id is ambiguous because it designates
1901 both a direct non-virtual base class and an inherited virtual
1902 base class, the mem-initializer is ill-formed. */
1903 if (direct_binfo && virtual_binfo)
1904 {
1905 error ("%qD is both a direct base and an indirect virtual base",
1906 basetype);
1907 return NULL_TREE(tree) __null;
1908 }
1909
1910 if (!direct_binfo && !virtual_binfo)
1911 {
1912 if (CLASSTYPE_VBASECLASSES (current_class_type)((((tree_class_check ((scope_chain->class_type), (tcc_type
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1912, __FUNCTION__))->type_with_lang_specific.lang_specific
))->vbases)
)
1913 error ("type %qT is not a direct or virtual base of %qT",
1914 basetype, current_class_typescope_chain->class_type);
1915 else
1916 error ("type %qT is not a direct base of %qT",
1917 basetype, current_class_typescope_chain->class_type);
1918 return NULL_TREE(tree) __null;
1919 }
1920
1921 return direct_binfo ? direct_binfo : virtual_binfo;
1922 }
1923 else
1924 {
1925 if (identifier_p (name))
1926 field = lookup_field (current_class_typescope_chain->class_type, name, 1, false);
1927 else
1928 field = name;
1929
1930 if (member_init_ok_or_else (field, current_class_typescope_chain->class_type, name))
1931 return field;
1932 }
1933
1934 return NULL_TREE(tree) __null;
1935}
1936
1937/* This is like `expand_member_init', only it stores one aggregate
1938 value into another.
1939
1940 INIT comes in two flavors: it is either a value which
1941 is to be stored in EXP, or it is a parameter list
1942 to go to a constructor, which will operate on EXP.
1943 If INIT is not a parameter list for a constructor, then set
1944 LOOKUP_ONLYCONVERTING.
1945 If FLAGS is LOOKUP_ONLYCONVERTING then it is the = init form of
1946 the initializer, if FLAGS is 0, then it is the (init) form.
1947 If `init' is a CONSTRUCTOR, then we emit a warning message,
1948 explaining that such initializations are invalid.
1949
1950 If INIT resolves to a CALL_EXPR which happens to return
1951 something of the type we are looking for, then we know
1952 that we can safely use that call to perform the
1953 initialization.
1954
1955 The virtual function table pointer cannot be set up here, because
1956 we do not really know its type.
1957
1958 This never calls operator=().
1959
1960 When initializing, nothing is CONST.
1961
1962 A default copy constructor may have to be used to perform the
1963 initialization.
1964
1965 A constructor or a conversion operator may have to be used to
1966 perform the initialization, but not both, as it would be ambiguous. */
1967
1968tree
1969build_aggr_init (tree exp, tree init, int flags, tsubst_flags_t complain)
1970{
1971 tree stmt_expr;
1972 tree compound_stmt;
1973 int destroy_temps;
1974 tree type = TREE_TYPE (exp)((contains_struct_check ((exp), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1974, __FUNCTION__))->typed.type)
;
1975 int was_const = TREE_READONLY (exp)((non_type_check ((exp), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1975, __FUNCTION__))->base.readonly_flag)
;
1976 int was_volatile = TREE_THIS_VOLATILE (exp)((exp)->base.volatile_flag);
1977 int is_global;
1978
1979 if (init == error_mark_nodeglobal_trees[TI_ERROR_MARK])
1980 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
1981
1982 location_t init_loc = (init
1983 ? cp_expr_loc_or_input_loc (init)
1984 : location_of (exp));
1985
1986 TREE_READONLY (exp)((non_type_check ((exp), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1986, __FUNCTION__))->base.readonly_flag)
= 0;
1987 TREE_THIS_VOLATILE (exp)((exp)->base.volatile_flag) = 0;
1988
1989 if (TREE_CODE (type)((enum tree_code) (type)->base.code) == ARRAY_TYPE)
1990 {
1991 tree itype = init ? TREE_TYPE (init)((contains_struct_check ((init), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1991, __FUNCTION__))->typed.type)
: NULL_TREE(tree) __null;
1992 int from_array = 0;
1993
1994 if (VAR_P (exp)(((enum tree_code) (exp)->base.code) == VAR_DECL) && DECL_DECOMPOSITION_P (exp)((((enum tree_code) (exp)->base.code) == VAR_DECL) &&
((contains_struct_check ((exp), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1994, __FUNCTION__))->decl_common.lang_specific) ? ((contains_struct_check
((exp), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 1994, __FUNCTION__))->decl_common.lang_specific)->u.base
.selector == lds_decomp : false)
)
1995 {
1996 from_array = 1;
1997 init = mark_rvalue_use (init);
1998 if (init
1999 && DECL_P (tree_strip_any_location_wrapper (init))(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code
) (tree_strip_any_location_wrapper (init))->base.code))] ==
tcc_declaration)
2000 && !(flags & LOOKUP_ONLYCONVERTING(1 << 2)))
2001 {
2002 /* Wrap the initializer in a CONSTRUCTOR so that build_vec_init
2003 recognizes it as direct-initialization. */
2004 init = build_constructor_single (init_list_type_nodecp_global_trees[CPTI_INIT_LIST_TYPE],
2005 NULL_TREE(tree) __null, init);
2006 CONSTRUCTOR_IS_DIRECT_INIT (init)(((tree_not_check2 (((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2006, __FUNCTION__, (CONSTRUCTOR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2006, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0))
= true;
2007 }
2008 }
2009 else
2010 {
2011 /* Must arrange to initialize each element of EXP
2012 from elements of INIT. */
2013 if (cv_qualified_p (type))
2014 TREE_TYPE (exp)((contains_struct_check ((exp), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2014, __FUNCTION__))->typed.type)
= cv_unqualified (type);
2015 if (itype && cv_qualified_p (itype))
2016 TREE_TYPE (init)((contains_struct_check ((init), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2016, __FUNCTION__))->typed.type)
= cv_unqualified (itype);
2017 from_array = (itype && same_type_p (TREE_TYPE (init),comptypes ((((contains_struct_check ((init), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2017, __FUNCTION__))->typed.type)), (((contains_struct_check
((exp), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2018, __FUNCTION__))->typed.type)), 0)
2018 TREE_TYPE (exp))comptypes ((((contains_struct_check ((init), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2017, __FUNCTION__))->typed.type)), (((contains_struct_check
((exp), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2018, __FUNCTION__))->typed.type)), 0)
);
2019
2020 if (init && !BRACE_ENCLOSED_INITIALIZER_P (init)(((enum tree_code) (init)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((init), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2020, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
2021 && (!from_array
2022 || (TREE_CODE (init)((enum tree_code) (init)->base.code) != CONSTRUCTOR
2023 /* Can happen, eg, handling the compound-literals
2024 extension (ext/complit12.C). */
2025 && TREE_CODE (init)((enum tree_code) (init)->base.code) != TARGET_EXPR)))
2026 {
2027 if (complain & tf_error)
2028 error_at (init_loc, "array must be initialized "
2029 "with a brace-enclosed initializer");
2030 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2031 }
2032 }
2033
2034 stmt_expr = build_vec_init (exp, NULL_TREE(tree) __null, init,
2035 /*explicit_value_init_p=*/false,
2036 from_array,
2037 complain);
2038 TREE_READONLY (exp)((non_type_check ((exp), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2038, __FUNCTION__))->base.readonly_flag)
= was_const;
2039 TREE_THIS_VOLATILE (exp)((exp)->base.volatile_flag) = was_volatile;
2040 TREE_TYPE (exp)((contains_struct_check ((exp), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2040, __FUNCTION__))->typed.type)
= type;
2041 /* Restore the type of init unless it was used directly. */
2042 if (init && TREE_CODE (stmt_expr)((enum tree_code) (stmt_expr)->base.code) != INIT_EXPR)
2043 TREE_TYPE (init)((contains_struct_check ((init), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2043, __FUNCTION__))->typed.type)
= itype;
2044 return stmt_expr;
2045 }
2046
2047 if (is_copy_initialization (init))
2048 flags |= LOOKUP_ONLYCONVERTING(1 << 2);
2049
2050 is_global = begin_init_stmts (&stmt_expr, &compound_stmt);
2051 destroy_temps = stmts_are_full_exprs_p ();
2052 current_stmt_tree ()->stmts_are_full_exprs_p = 0;
2053 bool ok = expand_aggr_init_1 (TYPE_BINFO (type)((tree_check3 ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2053, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.maxval)
, exp, exp,
2054 init, LOOKUP_NORMAL((1 << 0))|flags, complain);
2055 stmt_expr = finish_init_stmts (is_global, stmt_expr, compound_stmt);
2056 current_stmt_tree ()->stmts_are_full_exprs_p = destroy_temps;
2057 TREE_READONLY (exp)((non_type_check ((exp), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2057, __FUNCTION__))->base.readonly_flag)
= was_const;
2058 TREE_THIS_VOLATILE (exp)((exp)->base.volatile_flag) = was_volatile;
2059 if (!ok)
2060 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2061
2062 if ((VAR_P (exp)(((enum tree_code) (exp)->base.code) == VAR_DECL) || TREE_CODE (exp)((enum tree_code) (exp)->base.code) == PARM_DECL)
2063 && TREE_SIDE_EFFECTS (stmt_expr)((non_type_check ((stmt_expr), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2063, __FUNCTION__))->base.side_effects_flag)
2064 && !lookup_attribute ("warn_unused", TYPE_ATTRIBUTES (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2064, __FUNCTION__))->type_common.attributes)
))
2065 /* Just know that we've seen something for this node. */
2066 TREE_USED (exp)((exp)->base.used_flag) = 1;
2067
2068 return stmt_expr;
2069}
2070
2071static bool
2072expand_default_init (tree binfo, tree true_exp, tree exp, tree init, int flags,
2073 tsubst_flags_t complain)
2074{
2075 tree type = TREE_TYPE (exp)((contains_struct_check ((exp), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2075, __FUNCTION__))->typed.type)
;
2076
2077 /* It fails because there may not be a constructor which takes
2078 its own type as the first (or only parameter), but which does
2079 take other types via a conversion. So, if the thing initializing
2080 the expression is a unit element of type X, first try X(X&),
2081 followed by initialization by X. If neither of these work
2082 out, then look hard. */
2083 tree rval;
2084 vec<tree, va_gc> *parms;
2085
2086 /* If we have direct-initialization from an initializer list, pull
2087 it out of the TREE_LIST so the code below can see it. */
2088 if (init && TREE_CODE (init)((enum tree_code) (init)->base.code) == TREE_LIST
2089 && DIRECT_LIST_INIT_P (TREE_VALUE (init))((((enum tree_code) (((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2089, __FUNCTION__, (TREE_LIST)))->list.value))->base
.code) == CONSTRUCTOR && ((contains_struct_check ((((
tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2089, __FUNCTION__, (TREE_LIST)))->list.value)), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2089, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
]) && (((tree_not_check2 (((tree_check ((((tree_check
((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2089, __FUNCTION__, (TREE_LIST)))->list.value)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2089, __FUNCTION__, (CONSTRUCTOR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2089, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0)))
)
2090 {
2091 gcc_checking_assert ((flags & LOOKUP_ONLYCONVERTING) == 0((void)(!((flags & (1 << 2)) == 0 && ((contains_struct_check
((init), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2092, __FUNCTION__))->common.chain) == (tree) __null) ? fancy_abort
("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2092, __FUNCTION__), 0 : 0))
2092 && TREE_CHAIN (init) == NULL_TREE)((void)(!((flags & (1 << 2)) == 0 && ((contains_struct_check
((init), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2092, __FUNCTION__))->common.chain) == (tree) __null) ? fancy_abort
("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2092, __FUNCTION__), 0 : 0))
;
2093 init = TREE_VALUE (init)((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2093, __FUNCTION__, (TREE_LIST)))->list.value)
;
2094 /* Only call reshape_init if it has not been called earlier
2095 by the callers. */
2096 if (BRACE_ENCLOSED_INITIALIZER_P (init)(((enum tree_code) (init)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((init), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2096, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
&& CP_AGGREGATE_TYPE_P (type)(gnu_vector_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) && ((tree_class_check ((type), (
tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2096, __FUNCTION__))->type_common.lang_flag_5)) &&
(((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2096, __FUNCTION__))->type_common.size) != (tree) __null
) && !((((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2096, __FUNCTION__))->type_with_lang_specific.lang_specific
))->non_aggregate)))
)
2097 init = reshape_init (type, init, complain);
2098 }
2099
2100 if (init && BRACE_ENCLOSED_INITIALIZER_P (init)(((enum tree_code) (init)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((init), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2100, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
2101 && CP_AGGREGATE_TYPE_P (type)(gnu_vector_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) && ((tree_class_check ((type), (
tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2101, __FUNCTION__))->type_common.lang_flag_5)) &&
(((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2101, __FUNCTION__))->type_common.size) != (tree) __null
) && !((((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2101, __FUNCTION__))->type_with_lang_specific.lang_specific
))->non_aggregate)))
)
2102 /* A brace-enclosed initializer for an aggregate. In C++0x this can
2103 happen for direct-initialization, too. */
2104 init = digest_init (type, init, complain);
2105
2106 if (init == error_mark_nodeglobal_trees[TI_ERROR_MARK])
2107 return false;
2108
2109 /* A CONSTRUCTOR of the target's type is a previously digested
2110 initializer, whether that happened just above or in
2111 cp_parser_late_parsing_nsdmi.
2112
2113 A TARGET_EXPR with TARGET_EXPR_DIRECT_INIT_P or TARGET_EXPR_LIST_INIT_P
2114 set represents the whole initialization, so we shouldn't build up
2115 another ctor call. */
2116 if (init
2117 && (TREE_CODE (init)((enum tree_code) (init)->base.code) == CONSTRUCTOR
2118 || (TREE_CODE (init)((enum tree_code) (init)->base.code) == TARGET_EXPR
2119 && (TARGET_EXPR_DIRECT_INIT_P (init)((tree_not_check2 (((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2119, __FUNCTION__, (TARGET_EXPR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2119, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_2)
2120 || TARGET_EXPR_LIST_INIT_P (init)((tree_not_check2 (((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2120, __FUNCTION__, (TARGET_EXPR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2120, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_1)
)))
2121 && same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (init)((contains_struct_check ((init), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2121, __FUNCTION__))->typed.type)
, type))
2122 {
2123 /* Early initialization via a TARGET_EXPR only works for
2124 complete objects. */
2125 gcc_assert (TREE_CODE (init) == CONSTRUCTOR || true_exp == exp)((void)(!(((enum tree_code) (init)->base.code) == CONSTRUCTOR
|| true_exp == exp) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2125, __FUNCTION__), 0 : 0))
;
2126
2127 init = cp_build_init_expr (exp, init);
2128 TREE_SIDE_EFFECTS (init)((non_type_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2128, __FUNCTION__))->base.side_effects_flag)
= 1;
2129 finish_expr_stmt (init);
2130 return true;
2131 }
2132
2133 if (init && TREE_CODE (init)((enum tree_code) (init)->base.code) != TREE_LIST
2134 && (flags & LOOKUP_ONLYCONVERTING(1 << 2))
2135 && !unsafe_return_slot_p (exp))
2136 {
2137 /* Base subobjects should only get direct-initialization. */
2138 gcc_assert (true_exp == exp)((void)(!(true_exp == exp) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2138, __FUNCTION__), 0 : 0))
;
2139
2140 if (flags & DIRECT_BIND(1 << 3))
2141 /* Do nothing. We hit this in two cases: Reference initialization,
2142 where we aren't initializing a real variable, so we don't want
2143 to run a new constructor; and catching an exception, where we
2144 have already built up the constructor call so we could wrap it
2145 in an exception region. */;
2146 else
2147 {
2148 init = ocp_convert (type, init, CONV_IMPLICIT1|CONV_FORCE_TEMP32,
2149 flags, complain | tf_no_cleanup);
2150 if (init == error_mark_nodeglobal_trees[TI_ERROR_MARK])
2151 return false;
2152 }
2153
2154 /* We need to protect the initialization of a catch parm with a
2155 call to terminate(), which shows up as a MUST_NOT_THROW_EXPR
2156 around the TARGET_EXPR for the copy constructor. See
2157 initialize_handler_parm. */
2158 tree *p = &init;
2159 while (TREE_CODE (*p)((enum tree_code) (*p)->base.code) == MUST_NOT_THROW_EXPR
2160 || TREE_CODE (*p)((enum tree_code) (*p)->base.code) == CLEANUP_POINT_EXPR)
2161 {
2162 /* Avoid voidify_wrapper_expr making a temporary. */
2163 TREE_TYPE (*p)((contains_struct_check ((*p), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2163, __FUNCTION__))->typed.type)
= void_type_nodeglobal_trees[TI_VOID_TYPE];
2164 p = &TREE_OPERAND (*p, 0)(*((const_cast<tree*> (tree_operand_check ((*p), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2164, __FUNCTION__)))))
;
2165 }
2166 *p = cp_build_init_expr (exp, *p);
2167 finish_expr_stmt (init);
2168 return true;
2169 }
2170
2171 if (init == NULL_TREE(tree) __null)
2172 parms = NULL__null;
2173 else if (TREE_CODE (init)((enum tree_code) (init)->base.code) == TREE_LIST && !TREE_TYPE (init)((contains_struct_check ((init), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2173, __FUNCTION__))->typed.type)
)
2174 {
2175 parms = make_tree_vector ();
2176 for (; init != NULL_TREE(tree) __null; init = TREE_CHAIN (init)((contains_struct_check ((init), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2176, __FUNCTION__))->common.chain)
)
2177 vec_safe_push (parms, TREE_VALUE (init)((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2177, __FUNCTION__, (TREE_LIST)))->list.value)
);
2178 }
2179 else
2180 parms = make_tree_vector_single (init);
2181
2182 if (exp == current_class_ref(*((cfun + 0) && ((cfun + 0)->language) ? &((cfun
+ 0)->language)->x_current_class_ref : &scope_chain
->x_current_class_ref))
&& current_function_decl
2183 && DECL_HAS_IN_CHARGE_PARM_P (current_function_decl)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (current_function_decl)->base.code) ==
TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<
union tree_node *> ((((tree_check ((current_function_decl)
, "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2183, __FUNCTION__, (TEMPLATE_DECL))))))))->result : current_function_decl
)), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2183, __FUNCTION__))->decl_common.lang_specific); if (!(
((enum tree_code) (current_function_decl)->base.code) == FUNCTION_DECL
|| (((enum tree_code) (current_function_decl)->base.code)
== TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast
<union tree_node *> ((((tree_check ((current_function_decl
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2183, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((current_function_decl
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2183, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2183, __FUNCTION__); &lt->u.fn; })->has_in_charge_parm_p
)
)
2184 {
2185 /* Delegating constructor. */
2186 tree complete;
2187 tree base;
2188 tree elt; unsigned i;
2189
2190 /* Unshare the arguments for the second call. */
2191 releasing_vec parms2;
2192 FOR_EACH_VEC_SAFE_ELT (parms, i, elt)for (i = 0; vec_safe_iterate ((parms), (i), &(elt)); ++(i
))
2193 {
2194 elt = break_out_target_exprs (elt);
2195 vec_safe_push (parms2, elt);
2196 }
2197 complete = build_special_member_call (exp, complete_ctor_identifiercp_global_trees[CPTI_COMPLETE_CTOR_IDENTIFIER],
2198 &parms2, binfo, flags,
2199 complain);
2200 complete = fold_build_cleanup_point_expr (void_type_nodeglobal_trees[TI_VOID_TYPE], complete);
2201
2202 base = build_special_member_call (exp, base_ctor_identifiercp_global_trees[CPTI_BASE_CTOR_IDENTIFIER],
2203 &parms, binfo, flags,
2204 complain);
2205 base = fold_build_cleanup_point_expr (void_type_nodeglobal_trees[TI_VOID_TYPE], base);
2206 if (complete == error_mark_nodeglobal_trees[TI_ERROR_MARK] || base == error_mark_nodeglobal_trees[TI_ERROR_MARK])
2207 return false;
2208 rval = build_if_in_charge (complete, base);
2209 }
2210 else
2211 {
2212 tree ctor_name = (true_exp == exp
2213 ? complete_ctor_identifiercp_global_trees[CPTI_COMPLETE_CTOR_IDENTIFIER] : base_ctor_identifiercp_global_trees[CPTI_BASE_CTOR_IDENTIFIER]);
2214
2215 rval = build_special_member_call (exp, ctor_name, &parms, binfo, flags,
2216 complain);
2217 if (rval == error_mark_nodeglobal_trees[TI_ERROR_MARK])
2218 return false;
2219 }
2220
2221 if (parms != NULL__null)
2222 release_tree_vector (parms);
2223
2224 if (exp == true_exp && TREE_CODE (rval)((enum tree_code) (rval)->base.code) == CALL_EXPR)
2225 {
2226 tree fn = get_callee_fndecl (rval);
2227 if (fn && DECL_DECLARED_CONSTEXPR_P (fn)((contains_struct_check (((tree_check2 (((((enum tree_code) (
fn)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fn),
"/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2227, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2227, __FUNCTION__, (VAR_DECL), (FUNCTION_DECL)))), (TS_DECL_COMMON
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2227, __FUNCTION__))->decl_common.lang_flag_8)
)
2228 {
2229 tree e = maybe_constant_init (rval, exp);
2230 if (TREE_CONSTANT (e)((non_type_check ((e), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2230, __FUNCTION__))->base.constant_flag)
)
2231 rval = cp_build_init_expr (exp, e);
2232 }
2233 }
2234
2235 /* FIXME put back convert_to_void? */
2236 if (TREE_SIDE_EFFECTS (rval)((non_type_check ((rval), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2236, __FUNCTION__))->base.side_effects_flag)
)
2237 finish_expr_stmt (rval);
2238
2239 return true;
2240}
2241
2242/* This function is responsible for initializing EXP with INIT
2243 (if any). Returns true on success, false on failure.
2244
2245 BINFO is the binfo of the type for who we are performing the
2246 initialization. For example, if W is a virtual base class of A and B,
2247 and C : A, B.
2248 If we are initializing B, then W must contain B's W vtable, whereas
2249 were we initializing C, W must contain C's W vtable.
2250
2251 TRUE_EXP is nonzero if it is the true expression being initialized.
2252 In this case, it may be EXP, or may just contain EXP. The reason we
2253 need this is because if EXP is a base element of TRUE_EXP, we
2254 don't necessarily know by looking at EXP where its virtual
2255 baseclass fields should really be pointing. But we do know
2256 from TRUE_EXP. In constructors, we don't know anything about
2257 the value being initialized.
2258
2259 FLAGS is just passed to `build_new_method_call'. See that function
2260 for its description. */
2261
2262static bool
2263expand_aggr_init_1 (tree binfo, tree true_exp, tree exp, tree init, int flags,
2264 tsubst_flags_t complain)
2265{
2266 tree type = TREE_TYPE (exp)((contains_struct_check ((exp), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2266, __FUNCTION__))->typed.type)
;
2267
2268 gcc_assert (init != error_mark_node && type != error_mark_node)((void)(!(init != global_trees[TI_ERROR_MARK] && type
!= global_trees[TI_ERROR_MARK]) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2268, __FUNCTION__), 0 : 0))
;
25
Assuming the condition is true
26
Assuming the condition is true
27
'?' condition is false
2269 gcc_assert (building_stmt_list_p ())((void)(!(((current_stmt_tree ()->x_cur_stmt_list) &&
!(current_stmt_tree ()->x_cur_stmt_list)->is_empty()))
? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2269, __FUNCTION__), 0 : 0))
;
28
Assuming field 'x_cur_stmt_list' is non-null
29
Assuming the condition is true
30
'?' condition is false
2270
2271 /* Use a function returning the desired type to initialize EXP for us.
2272 If the function is a constructor, and its first argument is
2273 NULL_TREE, know that it was meant for us--just slide exp on
2274 in and expand the constructor. Constructors now come
2275 as TARGET_EXPRs. */
2276
2277 if (init
30.1
'init' is non-null
30.1
'init' is non-null
&& VAR_P (exp)(((enum tree_code) (exp)->base.code) == VAR_DECL)
31
Assuming field 'code' is not equal to VAR_DECL
2278 && COMPOUND_LITERAL_P (init)(((enum tree_code) (init)->base.code) == CONSTRUCTOR &&
(((tree_not_check2 ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2278, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_4)))
)
2279 {
2280 vec<tree, va_gc> *cleanups = NULL__null;
2281 /* If store_init_value returns NULL_TREE, the INIT has been
2282 recorded as the DECL_INITIAL for EXP. That means there's
2283 nothing more we have to do. */
2284 init = store_init_value (exp, init, &cleanups, flags);
2285 if (init)
2286 finish_expr_stmt (init);
2287 gcc_assert (!cleanups)((void)(!(!cleanups) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2287, __FUNCTION__), 0 : 0))
;
2288 return true;
2289 }
2290
2291 /* List-initialization from {} becomes value-initialization for non-aggregate
2292 classes with default constructors. Handle this here when we're
2293 initializing a base, so protected access works. */
2294 if (exp
31.1
'exp' is not equal to 'true_exp'
31.1
'exp' is not equal to 'true_exp'
!= true_exp && init
31.2
'init' is non-null
31.2
'init' is non-null
&& TREE_CODE (init)((enum tree_code) (init)->base.code) == TREE_LIST)
32
Assuming field 'code' is equal to TREE_LIST
33
Taking true branch
2295 {
2296 tree elt = TREE_VALUE (init)((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2296, __FUNCTION__, (TREE_LIST)))->list.value)
;
2297 if (DIRECT_LIST_INIT_P (elt)((((enum tree_code) (elt)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((elt), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2297, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
]) && (((tree_not_check2 (((tree_check ((elt), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2297, __FUNCTION__, (CONSTRUCTOR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2297, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0)))
34
Assuming field 'code' is not equal to CONSTRUCTOR
2298 && CONSTRUCTOR_ELTS (elt)((tree_check ((elt), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2298, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
== 0
2299 && CLASSTYPE_NON_AGGREGATE (type)((((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2299, __FUNCTION__))->type_with_lang_specific.lang_specific
))->non_aggregate)
2300 && TYPE_HAS_DEFAULT_CONSTRUCTOR (type)((((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2300, __FUNCTION__))->type_with_lang_specific.lang_specific
))->has_default_ctor)
)
2301 init = void_type_nodeglobal_trees[TI_VOID_TYPE];
2302 }
2303
2304 /* If an explicit -- but empty -- initializer list was present,
2305 that's value-initialization. */
2306 if (init == void_type_nodeglobal_trees[TI_VOID_TYPE])
35
Assuming the condition is true
2307 {
2308 /* If the type has data but no user-provided default ctor, we need to zero
2309 out the object. */
2310 if (type_has_non_user_provided_default_constructor (type)
36
Assuming the condition is true
38
Taking true branch
2311 && !is_really_empty_class (type, /*ignore_vptr*/true))
37
Assuming the condition is true
2312 {
2313 tree field_size = NULL_TREE(tree) __null;
2314 if (exp
38.1
'exp' is not equal to 'true_exp'
38.1
'exp' is not equal to 'true_exp'
!= true_exp && CLASSTYPE_AS_BASE (type)((((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2314, __FUNCTION__))->type_with_lang_specific.lang_specific
))->as_base)
!= type
)
39
Assuming 'type' is equal to field 'as_base'
40
Taking false branch
2315 /* Don't clobber already initialized virtual bases. */
2316 field_size = TYPE_SIZE (CLASSTYPE_AS_BASE (type))((tree_class_check ((((((tree_class_check ((type), (tcc_type)
, "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2316, __FUNCTION__))->type_with_lang_specific.lang_specific
))->as_base)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2316, __FUNCTION__))->type_common.size)
;
2317 init = build_zero_init_1 (type, NULL_TREE(tree) __null, /*static_storage_p=*/false,
41
Calling 'build_zero_init_1'
2318 field_size);
2319 init = cp_build_init_expr (exp, init);
2320 finish_expr_stmt (init);
2321 }
2322
2323 /* If we don't need to mess with the constructor at all,
2324 then we're done. */
2325 if (! type_build_ctor_call (type))
2326 return true;
2327
2328 /* Otherwise fall through and call the constructor. */
2329 init = NULL_TREE(tree) __null;
2330 }
2331
2332 /* We know that expand_default_init can handle everything we want
2333 at this point. */
2334 return expand_default_init (binfo, true_exp, exp, init, flags, complain);
2335}
2336
2337/* Report an error if TYPE is not a user-defined, class type. If
2338 OR_ELSE is nonzero, give an error message. */
2339
2340int
2341is_class_type (tree type, int or_else)
2342{
2343 if (type == error_mark_nodeglobal_trees[TI_ERROR_MARK])
2344 return 0;
2345
2346 if (! CLASS_TYPE_P (type)(((((enum tree_code) (type)->base.code)) == RECORD_TYPE ||
(((enum tree_code) (type)->base.code)) == UNION_TYPE) &&
((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2346, __FUNCTION__))->type_common.lang_flag_5))
)
2347 {
2348 if (or_else)
2349 error ("%qT is not a class type", type);
2350 return 0;
2351 }
2352 return 1;
2353}
2354
2355/* Returns true iff the initializer INIT represents copy-initialization
2356 (and therefore we must set LOOKUP_ONLYCONVERTING when processing it). */
2357
2358bool
2359is_copy_initialization (tree init)
2360{
2361 return (init && init != void_type_nodeglobal_trees[TI_VOID_TYPE]
2362 && TREE_CODE (init)((enum tree_code) (init)->base.code) != TREE_LIST
2363 && !(TREE_CODE (init)((enum tree_code) (init)->base.code) == TARGET_EXPR
2364 && TARGET_EXPR_DIRECT_INIT_P (init)((tree_not_check2 (((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2364, __FUNCTION__, (TARGET_EXPR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2364, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_2)
)
2365 && !DIRECT_LIST_INIT_P (init)((((enum tree_code) (init)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((init), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2365, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
]) && (((tree_not_check2 (((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2365, __FUNCTION__, (CONSTRUCTOR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2365, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0)))
);
2366}
2367
2368/* Build a reference to a member of an aggregate. This is not a C++
2369 `&', but really something which can have its address taken, and
2370 then act as a pointer to member, for example TYPE :: FIELD can have
2371 its address taken by saying & TYPE :: FIELD. ADDRESS_P is true if
2372 this expression is the operand of "&".
2373
2374 @@ Prints out lousy diagnostics for operator <typename>
2375 @@ fields.
2376
2377 @@ This function should be rewritten and placed in search.cc. */
2378
2379tree
2380build_offset_ref (tree type, tree member, bool address_p,
2381 tsubst_flags_t complain)
2382{
2383 tree decl;
2384 tree basebinfo = NULL_TREE(tree) __null;
2385
2386 /* class templates can come in as TEMPLATE_DECLs here. */
2387 if (TREE_CODE (member)((enum tree_code) (member)->base.code) == TEMPLATE_DECL)
2388 return member;
2389
2390 if (dependent_scope_p (type) || type_dependent_expression_p (member))
2391 return build_qualified_name (NULL_TREE(tree) __null, type, member,
2392 /*template_p=*/false);
2393
2394 gcc_assert (TYPE_P (type))((void)(!((tree_code_type_tmpl <0>::tree_code_type[(int
) (((enum tree_code) (type)->base.code))] == tcc_type)) ? fancy_abort
("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2394, __FUNCTION__), 0 : 0))
;
2395 if (! is_class_type (type, 1))
2396 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2397
2398 gcc_assert (DECL_P (member) || BASELINK_P (member))((void)(!((tree_code_type_tmpl <0>::tree_code_type[(int
) (((enum tree_code) (member)->base.code))] == tcc_declaration
) || (((enum tree_code) (member)->base.code) == BASELINK))
? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2398, __FUNCTION__), 0 : 0))
;
2399 /* Callers should call mark_used before this point, except for functions. */
2400 gcc_assert (!DECL_P (member) || TREE_USED (member)((void)(!(!(tree_code_type_tmpl <0>::tree_code_type[(int
) (((enum tree_code) (member)->base.code))] == tcc_declaration
) || ((member)->base.used_flag) || ((enum tree_code) (member
)->base.code) == FUNCTION_DECL) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2401, __FUNCTION__), 0 : 0))
2401 || TREE_CODE (member) == FUNCTION_DECL)((void)(!(!(tree_code_type_tmpl <0>::tree_code_type[(int
) (((enum tree_code) (member)->base.code))] == tcc_declaration
) || ((member)->base.used_flag) || ((enum tree_code) (member
)->base.code) == FUNCTION_DECL) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2401, __FUNCTION__), 0 : 0))
;
2402
2403 type = TYPE_MAIN_VARIANT (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2403, __FUNCTION__))->type_common.main_variant)
;
2404 if (!COMPLETE_OR_OPEN_TYPE_P (complete_type (type))((((tree_class_check ((complete_type (type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2404, __FUNCTION__))->type_common.size) != (tree) __null
) || ((((((enum tree_code) (complete_type (type))->base.code
)) == RECORD_TYPE || (((enum tree_code) (complete_type (type)
)->base.code)) == UNION_TYPE) && ((tree_class_check
((complete_type (type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2404, __FUNCTION__))->type_common.lang_flag_5)) &&
((((tree_class_check ((complete_type (type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2404, __FUNCTION__))->type_with_lang_specific.lang_specific
))->being_defined)))
)
2405 {
2406 if (complain & tf_error)
2407 error ("incomplete type %qT does not have member %qD", type, member);
2408 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2409 }
2410
2411 /* Entities other than non-static members need no further
2412 processing. */
2413 if (TREE_CODE (member)((enum tree_code) (member)->base.code) == TYPE_DECL)
2414 return member;
2415 if (VAR_P (member)(((enum tree_code) (member)->base.code) == VAR_DECL) || TREE_CODE (member)((enum tree_code) (member)->base.code) == CONST_DECL)
2416 return convert_from_reference (member);
2417
2418 if (TREE_CODE (member)((enum tree_code) (member)->base.code) == FIELD_DECL && DECL_C_BIT_FIELD (member)(((contains_struct_check (((tree_check ((member), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2418, __FUNCTION__, (FIELD_DECL)))), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2418, __FUNCTION__))->decl_common.lang_flag_4) == 1)
)
2419 {
2420 if (complain & tf_error)
2421 error ("invalid pointer to bit-field %qD", member);
2422 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2423 }
2424
2425 /* Set up BASEBINFO for member lookup. */
2426 decl = maybe_dummy_object (type, &basebinfo);
2427
2428 /* A lot of this logic is now handled in lookup_member. */
2429 if (BASELINK_P (member)(((enum tree_code) (member)->base.code) == BASELINK))
2430 {
2431 /* Go from the TREE_BASELINK to the member function info. */
2432 tree t = BASELINK_FUNCTIONS (member)(((struct tree_baselink*) (tree_check ((member), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2432, __FUNCTION__, (BASELINK))))->functions)
;
2433
2434 if (TREE_CODE (t)((enum tree_code) (t)->base.code) != TEMPLATE_ID_EXPR && !really_overloaded_fn (t))
2435 {
2436 /* Get rid of a potential OVERLOAD around it. */
2437 t = OVL_FIRST (t)ovl_first (t);
2438
2439 /* Unique functions are handled easily. */
2440
2441 /* For non-static member of base class, we need a special rule
2442 for access checking [class.protected]:
2443
2444 If the access is to form a pointer to member, the
2445 nested-name-specifier shall name the derived class
2446 (or any class derived from that class). */
2447 bool ok;
2448 if (address_p && DECL_P (t)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code
) (t)->base.code))] == tcc_declaration)
2449 && DECL_NONSTATIC_MEMBER_P (t)((((enum tree_code) (((contains_struct_check ((t), (TS_TYPED)
, "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2449, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE
) || ((enum tree_code) (t)->base.code) == FIELD_DECL)
)
2450 ok = perform_or_defer_access_check (TYPE_BINFO (type)((tree_check3 ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2450, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.maxval)
, t, t,
2451 complain);
2452 else
2453 ok = perform_or_defer_access_check (basebinfo, t, t,
2454 complain);
2455 if (!ok)
2456 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2457 if (DECL_STATIC_FUNCTION_P (t)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (t)->base.code) == TEMPLATE_DECL ? (
(struct tree_template_decl *)(const_cast<union tree_node *
> ((((tree_check ((t), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2457, __FUNCTION__, (TEMPLATE_DECL))))))))->result : t))
, (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2457, __FUNCTION__))->decl_common.lang_specific); if (!(
((enum tree_code) (t)->base.code) == FUNCTION_DECL || (((enum
tree_code) (t)->base.code) == TEMPLATE_DECL && ((
struct tree_template_decl *)(const_cast<union tree_node *>
((((tree_check ((t), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2457, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((t), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2457, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2457, __FUNCTION__); &lt->u.fn; })->static_function
)
)
2458 return member;
2459 member = t;
2460 }
2461 else
2462 TREE_TYPE (member)((contains_struct_check ((member), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2462, __FUNCTION__))->typed.type)
= unknown_type_nodecp_global_trees[CPTI_UNKNOWN_TYPE];
2463 }
2464 else if (address_p && TREE_CODE (member)((enum tree_code) (member)->base.code) == FIELD_DECL)
2465 {
2466 /* We need additional test besides the one in
2467 check_accessibility_of_qualified_id in case it is
2468 a pointer to non-static member. */
2469 if (!perform_or_defer_access_check (TYPE_BINFO (type)((tree_check3 ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2469, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.maxval)
, member, member,
2470 complain))
2471 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2472 }
2473
2474 if (!address_p)
2475 {
2476 /* If MEMBER is non-static, then the program has fallen afoul of
2477 [expr.prim]:
2478
2479 An id-expression that denotes a non-static data member or
2480 non-static member function of a class can only be used:
2481
2482 -- as part of a class member access (_expr.ref_) in which the
2483 object-expression refers to the member's class or a class
2484 derived from that class, or
2485
2486 -- to form a pointer to member (_expr.unary.op_), or
2487
2488 -- in the body of a non-static member function of that class or
2489 of a class derived from that class (_class.mfct.non-static_), or
2490
2491 -- in a mem-initializer for a constructor for that class or for
2492 a class derived from that class (_class.base.init_). */
2493 if (DECL_NONSTATIC_MEMBER_FUNCTION_P (member)(((enum tree_code) (((contains_struct_check ((member), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2493, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE
)
)
2494 {
2495 /* Build a representation of the qualified name suitable
2496 for use as the operand to "&" -- even though the "&" is
2497 not actually present. */
2498 member = build2 (OFFSET_REF, TREE_TYPE (member)((contains_struct_check ((member), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2498, __FUNCTION__))->typed.type)
, decl, member);
2499 /* In Microsoft mode, treat a non-static member function as if
2500 it were a pointer-to-member. */
2501 if (flag_ms_extensionsglobal_options.x_flag_ms_extensions)
2502 {
2503 PTRMEM_OK_P (member)((tree_not_check2 (((tree_check3 (((member)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2503, __FUNCTION__, (ADDR_EXPR), (OFFSET_REF), (SCOPE_REF))
)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2503, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0)
= 1;
2504 return cp_build_addr_expr (member, complain);
2505 }
2506 if (complain & tf_error)
2507 error ("invalid use of non-static member function %qD",
2508 TREE_OPERAND (member, 1)(*((const_cast<tree*> (tree_operand_check ((member), (1
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2508, __FUNCTION__)))))
);
2509 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2510 }
2511 else if (TREE_CODE (member)((enum tree_code) (member)->base.code) == FIELD_DECL)
2512 {
2513 if (complain & tf_error)
2514 error ("invalid use of non-static data member %qD", member);
2515 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2516 }
2517 return member;
2518 }
2519
2520 member = build2 (OFFSET_REF, TREE_TYPE (member)((contains_struct_check ((member), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2520, __FUNCTION__))->typed.type)
, decl, member);
2521 PTRMEM_OK_P (member)((tree_not_check2 (((tree_check3 (((member)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2521, __FUNCTION__, (ADDR_EXPR), (OFFSET_REF), (SCOPE_REF))
)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2521, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0)
= 1;
2522 return member;
2523}
2524
2525/* If DECL is a scalar enumeration constant or variable with a
2526 constant initializer, return the initializer (or, its initializers,
2527 recursively); otherwise, return DECL. If STRICT_P, the
2528 initializer is only returned if DECL is a
2529 constant-expression. If RETURN_AGGREGATE_CST_OK_P, it is ok to
2530 return an aggregate constant. If UNSHARE_P, return an unshared
2531 copy of the initializer. */
2532
2533static tree
2534constant_value_1 (tree decl, bool strict_p, bool return_aggregate_cst_ok_p,
2535 bool unshare_p)
2536{
2537 while (TREE_CODE (decl)((enum tree_code) (decl)->base.code) == CONST_DECL
2538 || decl_constant_var_p (decl)
2539 || (!strict_p && VAR_P (decl)(((enum tree_code) (decl)->base.code) == VAR_DECL)
2540 && CP_TYPE_CONST_NON_VOLATILE_P (TREE_TYPE (decl))((cp_type_quals (((contains_struct_check ((decl), (TS_TYPED),
"/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2540, __FUNCTION__))->typed.type)) & (TYPE_QUAL_CONST
| TYPE_QUAL_VOLATILE)) == TYPE_QUAL_CONST)
))
2541 {
2542 tree init;
2543 /* If DECL is a static data member in a template
2544 specialization, we must instantiate it here. The
2545 initializer for the static data member is not processed
2546 until needed; we need it now. */
2547 mark_used (decl, tf_none);
2548 init = DECL_INITIAL (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2548, __FUNCTION__))->decl_common.initial)
;
2549 if (init == error_mark_nodeglobal_trees[TI_ERROR_MARK])
2550 {
2551 if (TREE_CODE (decl)((enum tree_code) (decl)->base.code) == CONST_DECL
2552 || DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl)(((tree_not_check2 (((tree_check ((decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2552, __FUNCTION__, (VAR_DECL)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2552, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_2))
)
2553 /* Treat the error as a constant to avoid cascading errors on
2554 excessively recursive template instantiation (c++/9335). */
2555 return init;
2556 else
2557 return decl;
2558 }
2559 /* Initializers in templates are generally expanded during
2560 instantiation, so before that for const int i(2)
2561 INIT is a TREE_LIST with the actual initializer as
2562 TREE_VALUE. */
2563 if (processing_template_declscope_chain->x_processing_template_decl
2564 && init
2565 && TREE_CODE (init)((enum tree_code) (init)->base.code) == TREE_LIST
2566 && TREE_CHAIN (init)((contains_struct_check ((init), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2566, __FUNCTION__))->common.chain)
== NULL_TREE(tree) __null)
2567 init = TREE_VALUE (init)((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2567, __FUNCTION__, (TREE_LIST)))->list.value)
;
2568 /* Instantiate a non-dependent initializer for user variables. We
2569 mustn't do this for the temporary for an array compound literal;
2570 trying to instatiate the initializer will keep creating new
2571 temporaries until we crash. Probably it's not useful to do it for
2572 other artificial variables, either. */
2573 if (!DECL_ARTIFICIAL (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2573, __FUNCTION__))->decl_common.artificial_flag)
)
2574 init = instantiate_non_dependent_or_null (init);
2575 if (!init
2576 || !TREE_TYPE (init)((contains_struct_check ((init), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2576, __FUNCTION__))->typed.type)
2577 || !TREE_CONSTANT (init)((non_type_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2577, __FUNCTION__))->base.constant_flag)
2578 || (!return_aggregate_cst_ok_p
2579 /* Unless RETURN_AGGREGATE_CST_OK_P is true, do not
2580 return an aggregate constant (of which string
2581 literals are a special case), as we do not want
2582 to make inadvertent copies of such entities, and
2583 we must be sure that their addresses are the
2584 same everywhere. */
2585 && (TREE_CODE (init)((enum tree_code) (init)->base.code) == CONSTRUCTOR
2586 || TREE_CODE (init)((enum tree_code) (init)->base.code) == STRING_CST)))
2587 break;
2588 /* Don't return a CONSTRUCTOR for a variable with partial run-time
2589 initialization, since it doesn't represent the entire value.
2590 Similarly for VECTOR_CSTs created by cp_folding those
2591 CONSTRUCTORs. */
2592 if ((TREE_CODE (init)((enum tree_code) (init)->base.code) == CONSTRUCTOR
2593 || TREE_CODE (init)((enum tree_code) (init)->base.code) == VECTOR_CST)
2594 && !DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl)(((tree_not_check2 (((tree_check ((decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2594, __FUNCTION__, (VAR_DECL)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2594, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_2))
)
2595 break;
2596 /* If the variable has a dynamic initializer, don't use its
2597 DECL_INITIAL which doesn't reflect the real value. */
2598 if (VAR_P (decl)(((enum tree_code) (decl)->base.code) == VAR_DECL)
2599 && TREE_STATIC (decl)((decl)->base.static_flag)
2600 && !DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl)(((tree_not_check2 (((tree_check ((decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2600, __FUNCTION__, (VAR_DECL)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2600, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_2))
2601 && DECL_NONTRIVIALLY_INITIALIZED_P (decl)(((tree_not_check2 (((tree_check ((decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2601, __FUNCTION__, (VAR_DECL)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2601, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_6))
)
2602 break;
2603 decl = init;
2604 }
2605 return unshare_p ? unshare_expr (decl) : decl;
2606}
2607
2608/* If DECL is a CONST_DECL, or a constant VAR_DECL initialized by constant
2609 of integral or enumeration type, or a constexpr variable of scalar type,
2610 then return that value. These are those variables permitted in constant
2611 expressions by [5.19/1]. */
2612
2613tree
2614scalar_constant_value (tree decl)
2615{
2616 return constant_value_1 (decl, /*strict_p=*/true,
2617 /*return_aggregate_cst_ok_p=*/false,
2618 /*unshare_p=*/true);
2619}
2620
2621/* Like scalar_constant_value, but can also return aggregate initializers.
2622 If UNSHARE_P, return an unshared copy of the initializer. */
2623
2624tree
2625decl_really_constant_value (tree decl, bool unshare_p /*= true*/)
2626{
2627 return constant_value_1 (decl, /*strict_p=*/true,
2628 /*return_aggregate_cst_ok_p=*/true,
2629 /*unshare_p=*/unshare_p);
2630}
2631
2632/* A more relaxed version of decl_really_constant_value, used by the
2633 common C/C++ code. */
2634
2635tree
2636decl_constant_value (tree decl, bool unshare_p)
2637{
2638 return constant_value_1 (decl, /*strict_p=*/processing_template_declscope_chain->x_processing_template_decl,
2639 /*return_aggregate_cst_ok_p=*/true,
2640 /*unshare_p=*/unshare_p);
2641}
2642
2643tree
2644decl_constant_value (tree decl)
2645{
2646 return decl_constant_value (decl, /*unshare_p=*/true);
2647}
2648
2649/* Common subroutines of build_new and build_vec_delete. */
2650
2651/* Build and return a NEW_EXPR. If NELTS is non-NULL, TYPE[NELTS] is
2652 the type of the object being allocated; otherwise, it's just TYPE.
2653 INIT is the initializer, if any. USE_GLOBAL_NEW is true if the
2654 user explicitly wrote "::operator new". PLACEMENT, if non-NULL, is
2655 a vector of arguments to be provided as arguments to a placement
2656 new operator. This routine performs no semantic checks; it just
2657 creates and returns a NEW_EXPR. */
2658
2659static tree
2660build_raw_new_expr (location_t loc, vec<tree, va_gc> *placement, tree type,
2661 tree nelts, vec<tree, va_gc> *init, int use_global_new)
2662{
2663 tree init_list;
2664 tree new_expr;
2665
2666 /* If INIT is NULL, the we want to store NULL_TREE in the NEW_EXPR.
2667 If INIT is not NULL, then we want to store VOID_ZERO_NODE. This
2668 permits us to distinguish the case of a missing initializer "new
2669 int" from an empty initializer "new int()". */
2670 if (init == NULL__null)
2671 init_list = NULL_TREE(tree) __null;
2672 else if (init->is_empty ())
2673 init_list = void_nodeglobal_trees[TI_VOID];
2674 else
2675 init_list = build_tree_list_vec (init);
2676
2677 new_expr = build4_loc (loc, NEW_EXPR, build_pointer_type (type),
2678 build_tree_list_vec (placement), type, nelts,
2679 init_list);
2680 NEW_EXPR_USE_GLOBAL (new_expr)((tree_not_check2 (((tree_check ((new_expr), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2680, __FUNCTION__, (NEW_EXPR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2680, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0)
= use_global_new;
2681 TREE_SIDE_EFFECTS (new_expr)((non_type_check ((new_expr), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2681, __FUNCTION__))->base.side_effects_flag)
= 1;
2682
2683 return new_expr;
2684}
2685
2686/* Diagnose uninitialized const members or reference members of type
2687 TYPE. USING_NEW is used to disambiguate the diagnostic between a
2688 new expression without a new-initializer and a declaration. Returns
2689 the error count. */
2690
2691static int
2692diagnose_uninitialized_cst_or_ref_member_1 (tree type, tree origin,
2693 bool using_new, bool complain)
2694{
2695 tree field;
2696 int error_count = 0;
2697
2698 if (type_has_user_provided_constructor (type))
2699 return 0;
2700
2701 for (field = TYPE_FIELDS (type)((tree_check3 ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2701, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)
; field; field = DECL_CHAIN (field)(((contains_struct_check (((contains_struct_check ((field), (
TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2701, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2701, __FUNCTION__))->common.chain))
)
2702 {
2703 tree field_type;
2704
2705 if (TREE_CODE (field)((enum tree_code) (field)->base.code) != FIELD_DECL)
2706 continue;
2707
2708 field_type = strip_array_types (TREE_TYPE (field)((contains_struct_check ((field), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2708, __FUNCTION__))->typed.type)
);
2709
2710 if (type_has_user_provided_constructor (field_type))
2711 continue;
2712
2713 if (TYPE_REF_P (field_type)(((enum tree_code) (field_type)->base.code) == REFERENCE_TYPE
)
)
2714 {
2715 ++ error_count;
2716 if (complain)
2717 {
2718 if (DECL_CONTEXT (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2718, __FUNCTION__))->decl_minimal.context)
== origin)
2719 {
2720 if (using_new)
2721 error ("uninitialized reference member in %q#T "
2722 "using %<new%> without new-initializer", origin);
2723 else
2724 error ("uninitialized reference member in %q#T", origin);
2725 }
2726 else
2727 {
2728 if (using_new)
2729 error ("uninitialized reference member in base %q#T "
2730 "of %q#T using %<new%> without new-initializer",
2731 DECL_CONTEXT (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2731, __FUNCTION__))->decl_minimal.context)
, origin);
2732 else
2733 error ("uninitialized reference member in base %q#T "
2734 "of %q#T", DECL_CONTEXT (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2734, __FUNCTION__))->decl_minimal.context)
, origin);
2735 }
2736 inform (DECL_SOURCE_LOCATION (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2736, __FUNCTION__))->decl_minimal.locus)
,
2737 "%q#D should be initialized", field);
2738 }
2739 }
2740
2741 if (CP_TYPE_CONST_P (field_type)((cp_type_quals (field_type) & TYPE_QUAL_CONST) != 0))
2742 {
2743 ++ error_count;
2744 if (complain)
2745 {
2746 if (DECL_CONTEXT (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2746, __FUNCTION__))->decl_minimal.context)
== origin)
2747 {
2748 if (using_new)
2749 error ("uninitialized const member in %q#T "
2750 "using %<new%> without new-initializer", origin);
2751 else
2752 error ("uninitialized const member in %q#T", origin);
2753 }
2754 else
2755 {
2756 if (using_new)
2757 error ("uninitialized const member in base %q#T "
2758 "of %q#T using %<new%> without new-initializer",
2759 DECL_CONTEXT (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2759, __FUNCTION__))->decl_minimal.context)
, origin);
2760 else
2761 error ("uninitialized const member in base %q#T "
2762 "of %q#T", DECL_CONTEXT (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2762, __FUNCTION__))->decl_minimal.context)
, origin);
2763 }
2764 inform (DECL_SOURCE_LOCATION (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2764, __FUNCTION__))->decl_minimal.locus)
,
2765 "%q#D should be initialized", field);
2766 }
2767 }
2768
2769 if (CLASS_TYPE_P (field_type)(((((enum tree_code) (field_type)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (field_type)->base.code)) == UNION_TYPE
) && ((tree_class_check ((field_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2769, __FUNCTION__))->type_common.lang_flag_5))
)
2770 error_count
2771 += diagnose_uninitialized_cst_or_ref_member_1 (field_type, origin,
2772 using_new, complain);
2773 }
2774 return error_count;
2775}
2776
2777int
2778diagnose_uninitialized_cst_or_ref_member (tree type, bool using_new, bool complain)
2779{
2780 return diagnose_uninitialized_cst_or_ref_member_1 (type, type, using_new, complain);
2781}
2782
2783/* Call __cxa_bad_array_new_length to indicate that the size calculation
2784 overflowed. Pretend it returns sizetype so that it plays nicely in the
2785 COND_EXPR. */
2786
2787tree
2788throw_bad_array_new_length (void)
2789{
2790 if (!fn)
2791 {
2792 tree name = get_identifier ("__cxa_throw_bad_array_new_length")(__builtin_constant_p ("__cxa_throw_bad_array_new_length") ? get_identifier_with_length
(("__cxa_throw_bad_array_new_length"), strlen ("__cxa_throw_bad_array_new_length"
)) : get_identifier ("__cxa_throw_bad_array_new_length"))
;
2793
2794 fn = get_global_binding (name);
2795 if (!fn)
2796 fn = push_throw_library_fn
2797 (name, build_function_type_list (sizetypesizetype_tab[(int) stk_sizetype], NULL_TREE(tree) __null));
2798 }
2799
2800 return build_cxx_call (fn, 0, NULL__null, tf_warning_or_error);
2801}
2802
2803/* Attempt to verify that the argument, OPER, of a placement new expression
2804 refers to an object sufficiently large for an object of TYPE or an array
2805 of NELTS of such objects when NELTS is non-null, and issue a warning when
2806 it does not. SIZE specifies the size needed to construct the object or
2807 array and captures the result of NELTS * sizeof (TYPE). (SIZE could be
2808 greater when the array under construction requires a cookie to store
2809 NELTS. GCC's placement new expression stores the cookie when invoking
2810 a user-defined placement new operator function but not the default one.
2811 Placement new expressions with user-defined placement new operator are
2812 not diagnosed since we don't know how they use the buffer (this could
2813 be a future extension). */
2814static void
2815warn_placement_new_too_small (tree type, tree nelts, tree size, tree oper)
2816{
2817 location_t loc = cp_expr_loc_or_input_loc (oper);
2818
2819 STRIP_NOPS (oper)(oper) = tree_strip_nop_conversions ((const_cast<union tree_node
*> (((oper)))))
;
2820
2821 /* Using a function argument or a (non-array) variable as an argument
2822 to placement new is not checked since it's unknown what it might
2823 point to. */
2824 if (TREE_CODE (oper)((enum tree_code) (oper)->base.code) == PARM_DECL
2825 || VAR_P (oper)(((enum tree_code) (oper)->base.code) == VAR_DECL)
2826 || TREE_CODE (oper)((enum tree_code) (oper)->base.code) == COMPONENT_REF)
2827 return;
2828
2829 /* Evaluate any constant expressions. */
2830 size = fold_non_dependent_expr (size);
2831
2832 access_ref ref;
2833 ref.eval = [](tree x){ return fold_non_dependent_expr (x); };
2834 ref.trail1special = warn_placement_newglobal_options.x_warn_placement_new < 2;
2835 tree objsize = compute_objsize (oper, 1, &ref);
2836 if (!objsize)
2837 return;
2838
2839 /* We can only draw conclusions if ref.deref == -1,
2840 i.e. oper is the address of the object. */
2841 if (ref.deref != -1)
2842 return;
2843
2844 offset_int bytes_avail = wi::to_offset (objsize);
2845 offset_int bytes_need;
2846
2847 if (CONSTANT_CLASS_P (size)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code
) (size)->base.code))] == tcc_constant)
)
2848 bytes_need = wi::to_offset (size);
2849 else if (nelts && CONSTANT_CLASS_P (nelts)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code
) (nelts)->base.code))] == tcc_constant)
)
2850 bytes_need = (wi::to_offset (nelts)
2851 * wi::to_offset (TYPE_SIZE_UNIT (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2851, __FUNCTION__))->type_common.size_unit)
));
2852 else if (tree_fits_uhwi_p (TYPE_SIZE_UNIT (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2852, __FUNCTION__))->type_common.size_unit)
))
2853 bytes_need = wi::to_offset (TYPE_SIZE_UNIT (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2853, __FUNCTION__))->type_common.size_unit)
);
2854 else
2855 {
2856 /* The type is a VLA. */
2857 return;
2858 }
2859
2860 if (bytes_avail >= bytes_need)
2861 return;
2862
2863 /* True when the size to mention in the warning is exact as opposed
2864 to "at least N". */
2865 const bool exact_size = (ref.offrng[0] == ref.offrng[1]
2866 || ref.sizrng[1] - ref.offrng[0] == 0);
2867
2868 tree opertype = ref.ref ? TREE_TYPE (ref.ref)((contains_struct_check ((ref.ref), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2868, __FUNCTION__))->typed.type)
: TREE_TYPE (oper)((contains_struct_check ((oper), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2868, __FUNCTION__))->typed.type)
;
2869 bool warned = false;
2870 if (nelts)
2871 nelts = fold_for_warn (nelts);
2872 if (nelts)
2873 if (CONSTANT_CLASS_P (nelts)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code
) (nelts)->base.code))] == tcc_constant)
)
2874 warned = warning_at (loc, OPT_Wplacement_new_,
2875 (exact_size
2876 ? G_("placement new constructing an object ""placement new constructing an object " "of type %<%T [%wu]%> and size %qwu "
"in a region of type %qT and size %qwi"
2877 "of type %<%T [%wu]%> and size %qwu ""placement new constructing an object " "of type %<%T [%wu]%> and size %qwu "
"in a region of type %qT and size %qwi"
2878 "in a region of type %qT and size %qwi")"placement new constructing an object " "of type %<%T [%wu]%> and size %qwu "
"in a region of type %qT and size %qwi"
2879 : G_("placement new constructing an object ""placement new constructing an object " "of type %<%T [%wu]%> and size %qwu "
"in a region of type %qT and size " "at most %qwu"
2880 "of type %<%T [%wu]%> and size %qwu ""placement new constructing an object " "of type %<%T [%wu]%> and size %qwu "
"in a region of type %qT and size " "at most %qwu"
2881 "in a region of type %qT and size ""placement new constructing an object " "of type %<%T [%wu]%> and size %qwu "
"in a region of type %qT and size " "at most %qwu"
2882 "at most %qwu")"placement new constructing an object " "of type %<%T [%wu]%> and size %qwu "
"in a region of type %qT and size " "at most %qwu"
),
2883 type, tree_to_uhwi (nelts),
2884 bytes_need.to_uhwi (),
2885 opertype, bytes_avail.to_uhwi ());
2886 else
2887 warned = warning_at (loc, OPT_Wplacement_new_,
2888 (exact_size
2889 ? G_("placement new constructing an array ""placement new constructing an array " "of objects of type %qT and size %qwu "
"in a region of type %qT and size %qwi"
2890 "of objects of type %qT and size %qwu ""placement new constructing an array " "of objects of type %qT and size %qwu "
"in a region of type %qT and size %qwi"
2891 "in a region of type %qT and size %qwi")"placement new constructing an array " "of objects of type %qT and size %qwu "
"in a region of type %qT and size %qwi"
2892 : G_("placement new constructing an array ""placement new constructing an array " "of objects of type %qT and size %qwu "
"in a region of type %qT and size " "at most %qwu"
2893 "of objects of type %qT and size %qwu ""placement new constructing an array " "of objects of type %qT and size %qwu "
"in a region of type %qT and size " "at most %qwu"
2894 "in a region of type %qT and size ""placement new constructing an array " "of objects of type %qT and size %qwu "
"in a region of type %qT and size " "at most %qwu"
2895 "at most %qwu")"placement new constructing an array " "of objects of type %qT and size %qwu "
"in a region of type %qT and size " "at most %qwu"
),
2896 type, bytes_need.to_uhwi (), opertype,
2897 bytes_avail.to_uhwi ());
2898 else
2899 warned = warning_at (loc, OPT_Wplacement_new_,
2900 (exact_size
2901 ? G_("placement new constructing an object ""placement new constructing an object " "of type %qT and size %qwu in a region "
"of type %qT and size %qwi"
2902 "of type %qT and size %qwu in a region ""placement new constructing an object " "of type %qT and size %qwu in a region "
"of type %qT and size %qwi"
2903 "of type %qT and size %qwi")"placement new constructing an object " "of type %qT and size %qwu in a region "
"of type %qT and size %qwi"
2904 : G_("placement new constructing an object ""placement new constructing an object " "of type %qT " "and size %qwu in a region of type %qT "
"and size at most %qwu"
2905 "of type %qT ""placement new constructing an object " "of type %qT " "and size %qwu in a region of type %qT "
"and size at most %qwu"
2906 "and size %qwu in a region of type %qT ""placement new constructing an object " "of type %qT " "and size %qwu in a region of type %qT "
"and size at most %qwu"
2907 "and size at most %qwu")"placement new constructing an object " "of type %qT " "and size %qwu in a region of type %qT "
"and size at most %qwu"
),
2908 type, bytes_need.to_uhwi (), opertype,
2909 bytes_avail.to_uhwi ());
2910
2911 if (!warned || !ref.ref)
2912 return;
2913
2914 if (ref.offrng[0] == 0 || !ref.offset_bounded ())
2915 /* Avoid mentioning the offset when its lower bound is zero
2916 or when it's impossibly large. */
2917 inform (DECL_SOURCE_LOCATION (ref.ref)((contains_struct_check ((ref.ref), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2917, __FUNCTION__))->decl_minimal.locus)
,
2918 "%qD declared here", ref.ref);
2919 else if (ref.offrng[0] == ref.offrng[1])
2920 inform (DECL_SOURCE_LOCATION (ref.ref)((contains_struct_check ((ref.ref), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2920, __FUNCTION__))->decl_minimal.locus)
,
2921 "at offset %wi from %qD declared here",
2922 ref.offrng[0].to_shwi (), ref.ref);
2923 else
2924 inform (DECL_SOURCE_LOCATION (ref.ref)((contains_struct_check ((ref.ref), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2924, __FUNCTION__))->decl_minimal.locus)
,
2925 "at offset [%wi, %wi] from %qD declared here",
2926 ref.offrng[0].to_shwi (), ref.offrng[1].to_shwi (), ref.ref);
2927}
2928
2929/* True if alignof(T) > __STDCPP_DEFAULT_NEW_ALIGNMENT__. */
2930
2931bool
2932type_has_new_extended_alignment (tree t)
2933{
2934 return (aligned_new_thresholdglobal_options.x_aligned_new_threshold
2935 && TYPE_ALIGN_UNIT (t)((((tree_class_check ((t), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2935, __FUNCTION__))->type_common.align) ? ((unsigned)1)
<< (((tree_class_check ((t), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2935, __FUNCTION__))->type_common.align) - 1) : 0) / (8)
)
> (unsigned)aligned_new_thresholdglobal_options.x_aligned_new_threshold);
2936}
2937
2938/* Return the alignment we expect malloc to guarantee. This should just be
2939 MALLOC_ABI_ALIGNMENT, but that macro defaults to only BITS_PER_WORD for some
2940 reason, so don't let the threshold be smaller than max_align_t_align. */
2941
2942unsigned
2943malloc_alignment ()
2944{
2945 return MAX (max_align_t_align(), MALLOC_ABI_ALIGNMENT)((max_align_t_align()) > (((8) * (((global_options.x_ix86_isa_flags
& (1UL << 1)) != 0) ? 8 : 4))) ? (max_align_t_align
()) : (((8) * (((global_options.x_ix86_isa_flags & (1UL <<
1)) != 0) ? 8 : 4))))
;
2946}
2947
2948/* Determine whether an allocation function is a namespace-scope
2949 non-replaceable placement new function. See DR 1748. */
2950static bool
2951std_placement_new_fn_p (tree alloc_fn)
2952{
2953 if (DECL_NAMESPACE_SCOPE_P (alloc_fn)(!(((contains_struct_check ((alloc_fn), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2953, __FUNCTION__))->decl_common.lang_flag_0) &&
(((enum tree_code) (alloc_fn)->base.code) == CONST_DECL ||
((enum tree_code) (alloc_fn)->base.code) == PARM_DECL || (
(enum tree_code) (alloc_fn)->base.code) == TYPE_DECL || ((
enum tree_code) (alloc_fn)->base.code) == TEMPLATE_DECL)) &&
((enum tree_code) ((!(! (((contains_struct_check ((alloc_fn)
, (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2953, __FUNCTION__))->decl_minimal.context)) || ((enum tree_code
) (((contains_struct_check ((alloc_fn), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2953, __FUNCTION__))->decl_minimal.context))->base.code
) == TRANSLATION_UNIT_DECL) ? ((contains_struct_check ((alloc_fn
), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2953, __FUNCTION__))->decl_minimal.context) : cp_global_trees
[CPTI_GLOBAL]))->base.code) == NAMESPACE_DECL)
)
2954 {
2955 tree first_arg = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (alloc_fn)))((contains_struct_check ((((tree_check2 ((((contains_struct_check
((alloc_fn), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2955, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2955, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values)), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2955, __FUNCTION__))->common.chain)
;
2956 if ((TREE_VALUE (first_arg)((tree_check ((first_arg), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2956, __FUNCTION__, (TREE_LIST)))->list.value)
== ptr_type_nodeglobal_trees[TI_PTR_TYPE])
2957 && TREE_CHAIN (first_arg)((contains_struct_check ((first_arg), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2957, __FUNCTION__))->common.chain)
== void_list_nodeglobal_trees[TI_VOID_LIST_NODE])
2958 return true;
2959 }
2960 return false;
2961}
2962
2963/* For element type ELT_TYPE, return the appropriate type of the heap object
2964 containing such element(s). COOKIE_SIZE is the size of cookie in bytes.
2965 Return
2966 struct { size_t[COOKIE_SIZE/sizeof(size_t)]; ELT_TYPE[N]; }
2967 where N is nothing (flexible array member) if ITYPE2 is NULL, otherwise
2968 the array has ITYPE2 as its TYPE_DOMAIN. */
2969
2970tree
2971build_new_constexpr_heap_type (tree elt_type, tree cookie_size, tree itype2)
2972{
2973 gcc_assert (tree_fits_uhwi_p (cookie_size))((void)(!(tree_fits_uhwi_p (cookie_size)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2973, __FUNCTION__), 0 : 0))
;
2974 unsigned HOST_WIDE_INTlong csz = tree_to_uhwi (cookie_size);
2975 csz /= int_size_in_bytes (sizetypesizetype_tab[(int) stk_sizetype]);
2976 tree itype1 = build_index_type (size_int (csz - 1)size_int_kind (csz - 1, stk_sizetype));
2977 tree atype1 = build_cplus_array_type (sizetypesizetype_tab[(int) stk_sizetype], itype1);
2978 tree atype2 = build_cplus_array_type (elt_type, itype2);
2979 tree rtype = cxx_make_type (RECORD_TYPE);
2980 TYPE_NAME (rtype)((tree_class_check ((rtype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2980, __FUNCTION__))->type_common.name)
= heap_identifiercp_global_trees[CPTI_HEAP_IDENTIFIER];
2981 tree fld1 = build_decl (UNKNOWN_LOCATION((location_t) 0), FIELD_DECL, NULL_TREE(tree) __null, atype1);
2982 tree fld2 = build_decl (UNKNOWN_LOCATION((location_t) 0), FIELD_DECL, NULL_TREE(tree) __null, atype2);
2983 DECL_FIELD_CONTEXT (fld1)((tree_check ((fld1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2983, __FUNCTION__, (FIELD_DECL)))->decl_minimal.context
)
= rtype;
2984 DECL_FIELD_CONTEXT (fld2)((tree_check ((fld2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2984, __FUNCTION__, (FIELD_DECL)))->decl_minimal.context
)
= rtype;
2985 DECL_ARTIFICIAL (fld1)((contains_struct_check ((fld1), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2985, __FUNCTION__))->decl_common.artificial_flag)
= true;
2986 DECL_ARTIFICIAL (fld2)((contains_struct_check ((fld2), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2986, __FUNCTION__))->decl_common.artificial_flag)
= true;
2987 TYPE_FIELDS (rtype)((tree_check3 ((rtype), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2987, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)
= fld1;
2988 DECL_CHAIN (fld1)(((contains_struct_check (((contains_struct_check ((fld1), (TS_DECL_MINIMAL
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2988, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 2988, __FUNCTION__))->common.chain))
= fld2;
2989 layout_type (rtype);
2990 return rtype;
2991}
2992
2993/* Help the constexpr code to find the right type for the heap variable
2994 by adding a NOP_EXPR around ALLOC_CALL if needed for cookie_size.
2995 Return ALLOC_CALL or ALLOC_CALL cast to a pointer to
2996 struct { size_t[cookie_size/sizeof(size_t)]; elt_type[]; }. */
2997
2998static tree
2999maybe_wrap_new_for_constexpr (tree alloc_call, tree elt_type, tree cookie_size)
3000{
3001 if (cxx_dialect < cxx20)
3002 return alloc_call;
3003
3004 if (current_function_decl != NULL_TREE(tree) __null
3005 && !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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3005, __FUNCTION__, (TEMPLATE_DECL))))))))->result : current_function_decl
)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3005, __FUNCTION__, (VAR_DECL), (FUNCTION_DECL)))), (TS_DECL_COMMON
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3005, __FUNCTION__))->decl_common.lang_flag_8)
)
3006 return alloc_call;
3007
3008 tree call_expr = extract_call_expr (alloc_call);
3009 if (call_expr == error_mark_nodeglobal_trees[TI_ERROR_MARK])
3010 return alloc_call;
3011
3012 tree alloc_call_fndecl = cp_get_callee_fndecl_nofold (call_expr);
3013 if (alloc_call_fndecl == NULL_TREE(tree) __null
3014 || !IDENTIFIER_NEW_OP_P (DECL_NAME (alloc_call_fndecl))(((((tree_not_check2 (((tree_check ((((contains_struct_check (
(alloc_call_fndecl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3014, __FUNCTION__))->decl_minimal.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3014, __FUNCTION__, (IDENTIFIER_NODE)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3014, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_2)) & (!((tree_not_check2 (((tree_check ((((contains_struct_check
((alloc_call_fndecl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3014, __FUNCTION__))->decl_minimal.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3014, __FUNCTION__, (IDENTIFIER_NODE)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3014, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_1))) && (((&ovl_op_info[((tree_not_check2
(((tree_check ((((contains_struct_check ((alloc_call_fndecl)
, (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3014, __FUNCTION__))->decl_minimal.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3014, __FUNCTION__, (IDENTIFIER_NODE)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3014, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0)][((tree_check ((((contains_struct_check ((alloc_call_fndecl
), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3014, __FUNCTION__))->decl_minimal.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3014, __FUNCTION__, (IDENTIFIER_NODE)))->base.u.bits.address_space
)])->flags) & (OVL_OP_FLAG_ALLOC | OVL_OP_FLAG_DELETE)
) == OVL_OP_FLAG_ALLOC)
3015 || CP_DECL_CONTEXT (alloc_call_fndecl)(!(! (((contains_struct_check ((alloc_call_fndecl), (TS_DECL_MINIMAL
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3015, __FUNCTION__))->decl_minimal.context)) || ((enum tree_code
) (((contains_struct_check ((alloc_call_fndecl), (TS_DECL_MINIMAL
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3015, __FUNCTION__))->decl_minimal.context))->base.code
) == TRANSLATION_UNIT_DECL) ? ((contains_struct_check ((alloc_call_fndecl
), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3015, __FUNCTION__))->decl_minimal.context) : cp_global_trees
[CPTI_GLOBAL])
!= global_namespacecp_global_trees[CPTI_GLOBAL])
3016 return alloc_call;
3017
3018 tree rtype = build_new_constexpr_heap_type (elt_type, cookie_size,
3019 NULL_TREE(tree) __null);
3020 return build_nop (build_pointer_type (rtype), alloc_call);
3021}
3022
3023/* Generate code for a new-expression, including calling the "operator
3024 new" function, initializing the object, and, if an exception occurs
3025 during construction, cleaning up. The arguments are as for
3026 build_raw_new_expr. This may change PLACEMENT and INIT.
3027 TYPE is the type of the object being constructed, possibly an array
3028 of NELTS elements when NELTS is non-null (in "new T[NELTS]", T may
3029 be an array of the form U[inner], with the whole expression being
3030 "new U[NELTS][inner]"). */
3031
3032static tree
3033build_new_1 (vec<tree, va_gc> **placement, tree type, tree nelts,
3034 vec<tree, va_gc> **init, bool globally_qualified_p,
3035 tsubst_flags_t complain)
3036{
3037 tree size, rval;
3038 /* True iff this is a call to "operator new[]" instead of just
3039 "operator new". */
3040 bool array_p = false;
3041 /* If ARRAY_P is true, the element type of the array. This is never
3042 an ARRAY_TYPE; for something like "new int[3][4]", the
3043 ELT_TYPE is "int". If ARRAY_P is false, this is the same type as
3044 TYPE. */
3045 tree elt_type;
3046 /* The type of the new-expression. (This type is always a pointer
3047 type.) */
3048 tree pointer_type;
3049 tree non_const_pointer_type;
3050 /* The most significant array bound in int[OUTER_NELTS][inner]. */
3051 tree outer_nelts = NULL_TREE(tree) __null;
3052 /* For arrays with a non-constant number of elements, a bounds checks
3053 on the NELTS parameter to avoid integer overflow at runtime. */
3054 tree outer_nelts_check = NULL_TREE(tree) __null;
3055 bool outer_nelts_from_type = false;
3056 /* Number of the "inner" elements in "new T[OUTER_NELTS][inner]". */
3057 offset_int inner_nelts_count = 1;
3058 tree alloc_call, alloc_expr;
3059 /* Size of the inner array elements (those with constant dimensions). */
3060 offset_int inner_size;
3061 /* The address returned by the call to "operator new". This node is
3062 a VAR_DECL and is therefore reusable. */
3063 tree alloc_node;
3064 tree alloc_fn;
3065 tree cookie_expr, init_expr;
3066 int nothrow, check_new;
3067 /* If non-NULL, the number of extra bytes to allocate at the
3068 beginning of the storage allocated for an array-new expression in
3069 order to store the number of elements. */
3070 tree cookie_size = NULL_TREE(tree) __null;
3071 tree placement_first;
3072 tree placement_expr = NULL_TREE(tree) __null;
3073 /* True if the function we are calling is a placement allocation
3074 function. */
3075 bool placement_allocation_fn_p;
3076 /* True if the storage must be initialized, either by a constructor
3077 or due to an explicit new-initializer. */
3078 bool is_initialized;
3079 /* The address of the thing allocated, not including any cookie. In
3080 particular, if an array cookie is in use, DATA_ADDR is the
3081 address of the first array element. This node is a VAR_DECL, and
3082 is therefore reusable. */
3083 tree data_addr;
3084 tree orig_type = type;
3085
3086 if (nelts)
3087 {
3088 outer_nelts = nelts;
3089 array_p = true;
3090 }
3091 else if (TREE_CODE (type)((enum tree_code) (type)->base.code) == ARRAY_TYPE)
3092 {
3093 /* Transforms new (T[N]) to new T[N]. The former is a GNU
3094 extension for variable N. (This also covers new T where T is
3095 a VLA typedef.) */
3096 array_p = true;
3097 nelts = array_type_nelts_top (type);
3098 outer_nelts = nelts;
3099 type = TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3099, __FUNCTION__))->typed.type)
;
3100 outer_nelts_from_type = true;
3101 }
3102
3103 /* Lots of logic below depends on whether we have a constant number of
3104 elements, so go ahead and fold it now. */
3105 const_tree cst_outer_nelts = fold_non_dependent_expr (outer_nelts, complain);
3106
3107 /* If our base type is an array, then make sure we know how many elements
3108 it has. */
3109 for (elt_type = type;
3110 TREE_CODE (elt_type)((enum tree_code) (elt_type)->base.code) == ARRAY_TYPE;
3111 elt_type = TREE_TYPE (elt_type)((contains_struct_check ((elt_type), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3111, __FUNCTION__))->typed.type)
)
3112 {
3113 tree inner_nelts = array_type_nelts_top (elt_type);
3114 tree inner_nelts_cst = maybe_constant_value (inner_nelts);
3115 if (TREE_CODE (inner_nelts_cst)((enum tree_code) (inner_nelts_cst)->base.code) == INTEGER_CST)
3116 {
3117 wi::overflow_type overflow;
3118 offset_int result = wi::mul (wi::to_offset (inner_nelts_cst),
3119 inner_nelts_count, SIGNED, &overflow);
3120 if (overflow)
3121 {
3122 if (complain & tf_error)
3123 error ("integer overflow in array size");
3124 nelts = error_mark_nodeglobal_trees[TI_ERROR_MARK];
3125 }
3126 inner_nelts_count = result;
3127 }
3128 else
3129 {
3130 if (complain & tf_error)
3131 {
3132 error_at (cp_expr_loc_or_input_loc (inner_nelts),
3133 "array size in new-expression must be constant");
3134 cxx_constant_value(inner_nelts);
3135 }
3136 nelts = error_mark_nodeglobal_trees[TI_ERROR_MARK];
3137 }
3138 if (nelts != error_mark_nodeglobal_trees[TI_ERROR_MARK])
3139 nelts = cp_build_binary_op (input_location,
3140 MULT_EXPR, nelts,
3141 inner_nelts_cst,
3142 complain);
3143 }
3144
3145 if (!verify_type_context (input_location, TCTX_ALLOCATION, elt_type,
3146 !(complain & tf_error)))
3147 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3148
3149 if (variably_modified_type_p (elt_type, NULL_TREE(tree) __null) && (complain & tf_error))
3150 {
3151 error ("variably modified type not allowed in new-expression");
3152 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3153 }
3154
3155 if (nelts == error_mark_nodeglobal_trees[TI_ERROR_MARK])
3156 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3157
3158 /* Warn if we performed the (T[N]) to T[N] transformation and N is
3159 variable. */
3160 if (outer_nelts_from_type
3161 && !TREE_CONSTANT (cst_outer_nelts)((non_type_check ((cst_outer_nelts), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3161, __FUNCTION__))->base.constant_flag)
)
3162 {
3163 if (complain & tf_warning_or_error)
3164 {
3165 pedwarn (cp_expr_loc_or_input_loc (outer_nelts), OPT_Wvla,
3166 typedef_variant_p (orig_type)
3167 ? G_("non-constant array new length must be specified ""non-constant array new length must be specified " "directly, not by %<typedef%>"
3168 "directly, not by %<typedef%>")"non-constant array new length must be specified " "directly, not by %<typedef%>"
3169 : G_("non-constant array new length must be specified ""non-constant array new length must be specified " "without parentheses around the type-id"
3170 "without parentheses around the type-id")"non-constant array new length must be specified " "without parentheses around the type-id");
3171 }
3172 else
3173 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3174 }
3175
3176 if (VOID_TYPE_P (elt_type)(((enum tree_code) (elt_type)->base.code) == VOID_TYPE))
3177 {
3178 if (complain & tf_error)
3179 error ("invalid type %<void%> for %<new%>");
3180 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3181 }
3182
3183 if (is_std_init_list (elt_type) && !cp_unevaluated_operand)
3184 warning (OPT_Winit_list_lifetime,
3185 "%<new%> of %<initializer_list%> does not "
3186 "extend the lifetime of the underlying array");
3187
3188 if (abstract_virtuals_error (ACU_NEW, elt_type, complain))
3189 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3190
3191 is_initialized = (type_build_ctor_call (elt_type) || *init != NULL__null);
3192
3193 if (*init == NULL__null && cxx_dialect < cxx11)
3194 {
3195 bool maybe_uninitialized_error = false;
3196 /* A program that calls for default-initialization [...] of an
3197 entity of reference type is ill-formed. */
3198 if (CLASSTYPE_REF_FIELDS_NEED_INIT (elt_type)(((tree_class_check ((elt_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3198, __FUNCTION__))->type_with_lang_specific.lang_specific
) ? (((tree_class_check ((elt_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3198, __FUNCTION__))->type_with_lang_specific.lang_specific
))->ref_needs_init : 0)
)
3199 maybe_uninitialized_error = true;
3200
3201 /* A new-expression that creates an object of type T initializes
3202 that object as follows:
3203 - If the new-initializer is omitted:
3204 -- If T is a (possibly cv-qualified) non-POD class type
3205 (or array thereof), the object is default-initialized (8.5).
3206 [...]
3207 -- Otherwise, the object created has indeterminate
3208 value. If T is a const-qualified type, or a (possibly
3209 cv-qualified) POD class type (or array thereof)
3210 containing (directly or indirectly) a member of
3211 const-qualified type, the program is ill-formed; */
3212
3213 if (CLASSTYPE_READONLY_FIELDS_NEED_INIT (elt_type)(((tree_class_check ((elt_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3213, __FUNCTION__))->type_with_lang_specific.lang_specific
) ? (((tree_class_check ((elt_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3213, __FUNCTION__))->type_with_lang_specific.lang_specific
))->const_needs_init : 0)
)
3214 maybe_uninitialized_error = true;
3215
3216 if (maybe_uninitialized_error
3217 && diagnose_uninitialized_cst_or_ref_member (elt_type,
3218 /*using_new=*/true,
3219 complain & tf_error))
3220 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3221 }
3222
3223 if (CP_TYPE_CONST_P (elt_type)((cp_type_quals (elt_type) & TYPE_QUAL_CONST) != 0) && *init == NULL__null
3224 && default_init_uninitialized_part (elt_type))
3225 {
3226 if (complain & tf_error)
3227 error ("uninitialized const in %<new%> of %q#T", elt_type);
3228 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3229 }
3230
3231 size = size_in_bytes (elt_type);
3232 if (array_p)
3233 {
3234 /* Maximum available size in bytes. Half of the address space
3235 minus the cookie size. */
3236 offset_int max_size
3237 = wi::set_bit_in_zero <offset_int> (TYPE_PRECISION (sizetype)((tree_class_check ((sizetype_tab[(int) stk_sizetype]), (tcc_type
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3237, __FUNCTION__))->type_common.precision)
- 1);
3238 /* Maximum number of outer elements which can be allocated. */
3239 offset_int max_outer_nelts;
3240 tree max_outer_nelts_tree;
3241
3242 gcc_assert (TREE_CODE (size) == INTEGER_CST)((void)(!(((enum tree_code) (size)->base.code) == INTEGER_CST
) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3242, __FUNCTION__), 0 : 0))
;
3243 cookie_size = targetm.cxx.get_cookie_size (elt_type);
3244 gcc_assert (TREE_CODE (cookie_size) == INTEGER_CST)((void)(!(((enum tree_code) (cookie_size)->base.code) == INTEGER_CST
) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3244, __FUNCTION__), 0 : 0))
;
3245 gcc_checking_assert (wi::ltu_p (wi::to_offset (cookie_size), max_size))((void)(!(wi::ltu_p (wi::to_offset (cookie_size), max_size)) ?
fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3245, __FUNCTION__), 0 : 0))
;
3246 /* Unconditionally subtract the cookie size. This decreases the
3247 maximum object size and is safe even if we choose not to use
3248 a cookie after all. */
3249 max_size -= wi::to_offset (cookie_size);
3250 wi::overflow_type overflow;
3251 inner_size = wi::mul (wi::to_offset (size), inner_nelts_count, SIGNED,
3252 &overflow);
3253 if (overflow || wi::gtu_p (inner_size, max_size))
3254 {
3255 if (complain & tf_error)
3256 {
3257 cst_size_error error;
3258 if (overflow)
3259 error = cst_size_overflow;
3260 else
3261 {
3262 error = cst_size_too_big;
3263 size = size_binop (MULT_EXPR, size,size_binop_loc (((location_t) 0), MULT_EXPR, size, wide_int_to_tree
(sizetype_tab[(int) stk_sizetype], inner_nelts_count))
3264 wide_int_to_tree (sizetype,size_binop_loc (((location_t) 0), MULT_EXPR, size, wide_int_to_tree
(sizetype_tab[(int) stk_sizetype], inner_nelts_count))
3265 inner_nelts_count))size_binop_loc (((location_t) 0), MULT_EXPR, size, wide_int_to_tree
(sizetype_tab[(int) stk_sizetype], inner_nelts_count))
;
3266 size = cp_fully_fold (size);
3267 }
3268 invalid_array_size_error (input_location, error, size,
3269 /*name=*/NULL_TREE(tree) __null);
3270 }
3271 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3272 }
3273
3274 max_outer_nelts = wi::udiv_trunc (max_size, inner_size);
3275 max_outer_nelts_tree = wide_int_to_tree (sizetypesizetype_tab[(int) stk_sizetype], max_outer_nelts);
3276
3277 size = size_binop (MULT_EXPR, size, fold_convert (sizetype, nelts))size_binop_loc (((location_t) 0), MULT_EXPR, size, fold_convert_loc
(((location_t) 0), sizetype_tab[(int) stk_sizetype], nelts))
;
3278
3279 if (TREE_CODE (cst_outer_nelts)((enum tree_code) (cst_outer_nelts)->base.code) == INTEGER_CST)
3280 {
3281 if (tree_int_cst_lt (max_outer_nelts_tree, cst_outer_nelts))
3282 {
3283 /* When the array size is constant, check it at compile time
3284 to make sure it doesn't exceed the implementation-defined
3285 maximum, as required by C++ 14 (in C++ 11 this requirement
3286 isn't explicitly stated but it's enforced anyway -- see
3287 grokdeclarator in cp/decl.cc). */
3288 if (complain & tf_error)
3289 {
3290 size = cp_fully_fold (size);
3291 invalid_array_size_error (input_location, cst_size_too_big,
3292 size, NULL_TREE(tree) __null);
3293 }
3294 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3295 }
3296 }
3297 else
3298 {
3299 /* When a runtime check is necessary because the array size
3300 isn't constant, keep only the top-most seven bits (starting
3301 with the most significant non-zero bit) of the maximum size
3302 to compare the array size against, to simplify encoding the
3303 constant maximum size in the instruction stream. */
3304
3305 unsigned shift = (max_outer_nelts.get_precision ()) - 7
3306 - wi::clz (max_outer_nelts);
3307 max_outer_nelts = (max_outer_nelts >> shift) << shift;
3308
3309 outer_nelts_check = fold_build2 (LE_EXPR, boolean_type_node,fold_build2_loc (((location_t) 0), LE_EXPR, global_trees[TI_BOOLEAN_TYPE
], outer_nelts, max_outer_nelts_tree )
3310 outer_nelts,fold_build2_loc (((location_t) 0), LE_EXPR, global_trees[TI_BOOLEAN_TYPE
], outer_nelts, max_outer_nelts_tree )
3311 max_outer_nelts_tree)fold_build2_loc (((location_t) 0), LE_EXPR, global_trees[TI_BOOLEAN_TYPE
], outer_nelts, max_outer_nelts_tree )
;
3312 }
3313 }
3314
3315 tree align_arg = NULL_TREE(tree) __null;
3316 if (type_has_new_extended_alignment (elt_type))
3317 {
3318 unsigned align = TYPE_ALIGN_UNIT (elt_type)((((tree_class_check ((elt_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3318, __FUNCTION__))->type_common.align) ? ((unsigned)1)
<< (((tree_class_check ((elt_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3318, __FUNCTION__))->type_common.align) - 1) : 0) / (8)
)
;
3319 /* Also consider the alignment of the cookie, if any. */
3320 if (array_p && TYPE_VEC_NEW_USES_COOKIE (elt_type)((((((enum tree_code) (elt_type)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (elt_type)->base.code)) == UNION_TYPE
) && ((tree_class_check ((elt_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3320, __FUNCTION__))->type_common.lang_flag_5)) &&
(((tree_class_check ((elt_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3320, __FUNCTION__))->type_with_lang_specific.lang_specific
))->vec_new_uses_cookie)
)
3321 align = MAX (align, TYPE_ALIGN_UNIT (size_type_node))((align) > (((((tree_class_check ((global_trees[TI_SIZE_TYPE
]), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3321, __FUNCTION__))->type_common.align) ? ((unsigned)1)
<< (((tree_class_check ((global_trees[TI_SIZE_TYPE]), (
tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3321, __FUNCTION__))->type_common.align) - 1) : 0) / (8)
)) ? (align) : (((((tree_class_check ((global_trees[TI_SIZE_TYPE
]), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3321, __FUNCTION__))->type_common.align) ? ((unsigned)1)
<< (((tree_class_check ((global_trees[TI_SIZE_TYPE]), (
tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3321, __FUNCTION__))->type_common.align) - 1) : 0) / (8)
)))
;
3322 align_arg = build_int_cst (align_type_nodecp_global_trees[CPTI_ALIGN_TYPE], align);
3323 }
3324
3325 alloc_fn = NULL_TREE(tree) __null;
3326
3327 /* If PLACEMENT is a single simple pointer type not passed by
3328 reference, prepare to capture it in a temporary variable. Do
3329 this now, since PLACEMENT will change in the calls below. */
3330 placement_first = NULL_TREE(tree) __null;
3331 if (vec_safe_length (*placement) == 1
3332 && (TYPE_PTR_P (TREE_TYPE ((**placement)[0]))(((enum tree_code) (((contains_struct_check (((**placement)[0
]), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3332, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE
)
))
3333 placement_first = (**placement)[0];
3334
3335 bool member_new_p = false;
3336
3337 /* Allocate the object. */
3338 tree fnname;
3339 tree fns;
3340
3341 fnname = ovl_op_identifier (false, array_p ? VEC_NEW_EXPR : NEW_EXPR);
3342
3343 member_new_p = !globally_qualified_p
3344 && CLASS_TYPE_P (elt_type)(((((enum tree_code) (elt_type)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (elt_type)->base.code)) == UNION_TYPE
) && ((tree_class_check ((elt_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3344, __FUNCTION__))->type_common.lang_flag_5))
3345 && (array_p
3346 ? TYPE_HAS_ARRAY_NEW_OPERATOR (elt_type)((((tree_class_check ((elt_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3346, __FUNCTION__))->type_with_lang_specific.lang_specific
))->has_array_new)
3347 : TYPE_HAS_NEW_OPERATOR (elt_type)((((tree_class_check ((elt_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3347, __FUNCTION__))->type_with_lang_specific.lang_specific
))->has_new)
);
3348
3349 bool member_delete_p = (!globally_qualified_p
3350 && CLASS_TYPE_P (elt_type)(((((enum tree_code) (elt_type)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (elt_type)->base.code)) == UNION_TYPE
) && ((tree_class_check ((elt_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3350, __FUNCTION__))->type_common.lang_flag_5))
3351 && (array_p
3352 ? TYPE_GETS_VEC_DELETE (elt_type)(((((tree_class_check ((elt_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3352, __FUNCTION__))->type_with_lang_specific.lang_specific
))->gets_delete) & 2)
3353 : TYPE_GETS_REG_DELETE (elt_type)(((((tree_class_check ((elt_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3353, __FUNCTION__))->type_with_lang_specific.lang_specific
))->gets_delete) & 1)
));
3354
3355 if (member_new_p)
3356 {
3357 /* Use a class-specific operator new. */
3358 /* If a cookie is required, add some extra space. */
3359 if (array_p && TYPE_VEC_NEW_USES_COOKIE (elt_type)((((((enum tree_code) (elt_type)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (elt_type)->base.code)) == UNION_TYPE
) && ((tree_class_check ((elt_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3359, __FUNCTION__))->type_common.lang_flag_5)) &&
(((tree_class_check ((elt_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3359, __FUNCTION__))->type_with_lang_specific.lang_specific
))->vec_new_uses_cookie)
)
3360 size = size_binop (PLUS_EXPR, size, cookie_size)size_binop_loc (((location_t) 0), PLUS_EXPR, size, cookie_size
)
;
3361 else
3362 {
3363 cookie_size = NULL_TREE(tree) __null;
3364 /* No size arithmetic necessary, so the size check is
3365 not needed. */
3366 if (outer_nelts_check != NULL__null && inner_size == 1)
3367 outer_nelts_check = NULL_TREE(tree) __null;
3368 }
3369 /* Perform the overflow check. */
3370 tree errval = TYPE_MAX_VALUE (sizetype)((tree_check5 ((sizetype_tab[(int) stk_sizetype]), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3370, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE
), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval
)
;
3371 if (cxx_dialect >= cxx11 && flag_exceptionsglobal_options.x_flag_exceptions)
3372 errval = throw_bad_array_new_length ();
3373 if (outer_nelts_check != NULL_TREE(tree) __null)
3374 size = fold_build3 (COND_EXPR, sizetype, outer_nelts_check,fold_build3_loc (((location_t) 0), COND_EXPR, sizetype_tab[(int
) stk_sizetype], outer_nelts_check, size, errval )
3375 size, errval)fold_build3_loc (((location_t) 0), COND_EXPR, sizetype_tab[(int
) stk_sizetype], outer_nelts_check, size, errval )
;
3376 /* Create the argument list. */
3377 vec_safe_insert (*placement, 0, size);
3378 /* Do name-lookup to find the appropriate operator. */
3379 fns = lookup_fnfields (elt_type, fnname, /*protect=*/2, complain);
3380 if (fns == NULL_TREE(tree) __null)
3381 {
3382 if (complain & tf_error)
3383 error ("no suitable %qD found in class %qT", fnname, elt_type);
3384 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3385 }
3386 if (TREE_CODE (fns)((enum tree_code) (fns)->base.code) == TREE_LIST)
3387 {
3388 if (complain & tf_error)
3389 {
3390 error ("request for member %qD is ambiguous", fnname);
3391 print_candidates (fns);
3392 }
3393 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3394 }
3395 tree dummy = build_dummy_object (elt_type);
3396 alloc_call = NULL_TREE(tree) __null;
3397 if (align_arg)
3398 {
3399 vec<tree, va_gc> *align_args
3400 = vec_copy_and_insert (*placement, align_arg, 1);
3401 alloc_call
3402 = build_new_method_call (dummy, fns, &align_args,
3403 /*conversion_path=*/NULL_TREE(tree) __null,
3404 LOOKUP_NORMAL((1 << 0)), &alloc_fn, tf_none);
3405 /* If no matching function is found and the allocated object type
3406 has new-extended alignment, the alignment argument is removed
3407 from the argument list, and overload resolution is performed
3408 again. */
3409 if (alloc_call == error_mark_nodeglobal_trees[TI_ERROR_MARK])
3410 alloc_call = NULL_TREE(tree) __null;
3411 }
3412 if (!alloc_call)
3413 alloc_call = build_new_method_call (dummy, fns, placement,
3414 /*conversion_path=*/NULL_TREE(tree) __null,
3415 LOOKUP_NORMAL((1 << 0)),
3416 &alloc_fn, complain);
3417 }
3418 else
3419 {
3420 /* Use a global operator new. */
3421 /* See if a cookie might be required. */
3422 if (!(array_p && TYPE_VEC_NEW_USES_COOKIE (elt_type)((((((enum tree_code) (elt_type)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (elt_type)->base.code)) == UNION_TYPE
) && ((tree_class_check ((elt_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3422, __FUNCTION__))->type_common.lang_flag_5)) &&
(((tree_class_check ((elt_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3422, __FUNCTION__))->type_with_lang_specific.lang_specific
))->vec_new_uses_cookie)
))
3423 {
3424 cookie_size = NULL_TREE(tree) __null;
3425 /* No size arithmetic necessary, so the size check is
3426 not needed. */
3427 if (outer_nelts_check != NULL__null && inner_size == 1)
3428 outer_nelts_check = NULL_TREE(tree) __null;
3429 }
3430
3431 /* If size is zero e.g. due to type having zero size, try to
3432 preserve outer_nelts for constant expression evaluation
3433 purposes. */
3434 if (integer_zerop (size) && outer_nelts)
3435 size = build2 (MULT_EXPR, TREE_TYPE (size)((contains_struct_check ((size), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3435, __FUNCTION__))->typed.type)
, size, outer_nelts);
3436
3437 alloc_call = build_operator_new_call (fnname, placement,
3438 &size, &cookie_size,
3439 align_arg, outer_nelts_check,
3440 &alloc_fn, complain);
3441 }
3442
3443 if (alloc_call == error_mark_nodeglobal_trees[TI_ERROR_MARK])
3444 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3445
3446 gcc_assert (alloc_fn != NULL_TREE)((void)(!(alloc_fn != (tree) __null) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3446, __FUNCTION__), 0 : 0))
;
3447
3448 /* Now, check to see if this function is actually a placement
3449 allocation function. This can happen even when PLACEMENT is NULL
3450 because we might have something like:
3451
3452 struct S { void* operator new (size_t, int i = 0); };
3453
3454 A call to `new S' will get this allocation function, even though
3455 there is no explicit placement argument. If there is more than
3456 one argument, or there are variable arguments, then this is a
3457 placement allocation function. */
3458 placement_allocation_fn_p
3459 = (type_num_arguments (TREE_TYPE (alloc_fn)((contains_struct_check ((alloc_fn), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3459, __FUNCTION__))->typed.type)
) > 1
3460 || varargs_function_p (alloc_fn));
3461
3462 if (complain & tf_warning_or_error
3463 && warn_aligned_newglobal_options.x_warn_aligned_new
3464 && !placement_allocation_fn_p
3465 && TYPE_ALIGN (elt_type)(((tree_class_check ((elt_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3465, __FUNCTION__))->type_common.align) ? ((unsigned)1)
<< (((tree_class_check ((elt_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3465, __FUNCTION__))->type_common.align) - 1) : 0)
> malloc_alignment ()
3466 && (warn_aligned_newglobal_options.x_warn_aligned_new > 1
3467 || CP_DECL_CONTEXT (alloc_fn)(!(! (((contains_struct_check ((alloc_fn), (TS_DECL_MINIMAL),
"/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3467, __FUNCTION__))->decl_minimal.context)) || ((enum tree_code
) (((contains_struct_check ((alloc_fn), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3467, __FUNCTION__))->decl_minimal.context))->base.code
) == TRANSLATION_UNIT_DECL) ? ((contains_struct_check ((alloc_fn
), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3467, __FUNCTION__))->decl_minimal.context) : cp_global_trees
[CPTI_GLOBAL])
== global_namespacecp_global_trees[CPTI_GLOBAL])
3468 && !aligned_allocation_fn_p (alloc_fn))
3469 {
3470 auto_diagnostic_group d;
3471 if (warning (OPT_Waligned_new_, "%<new%> of type %qT with extended "
3472 "alignment %d", elt_type, TYPE_ALIGN_UNIT (elt_type)((((tree_class_check ((elt_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3472, __FUNCTION__))->type_common.align) ? ((unsigned)1)
<< (((tree_class_check ((elt_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3472, __FUNCTION__))->type_common.align) - 1) : 0) / (8)
)
))
3473 {
3474 inform (input_location, "uses %qD, which does not have an alignment "
3475 "parameter", alloc_fn);
3476 if (!aligned_new_thresholdglobal_options.x_aligned_new_threshold)
3477 inform (input_location, "use %<-faligned-new%> to enable C++17 "
3478 "over-aligned new support");
3479 }
3480 }
3481
3482 /* If we found a simple case of PLACEMENT_EXPR above, then copy it
3483 into a temporary variable. */
3484 if (!processing_template_declscope_chain->x_processing_template_decl
3485 && TREE_CODE (alloc_call)((enum tree_code) (alloc_call)->base.code) == CALL_EXPR
3486 && call_expr_nargs (alloc_call)(((int)((unsigned long) (*tree_int_cst_elt_check (((tree_class_check
((alloc_call), (tcc_vl_exp), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3486, __FUNCTION__))->exp.operands[0]), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3486, __FUNCTION__)))) - 3)
== 2
3487 && TREE_CODE (TREE_TYPE (CALL_EXPR_ARG (alloc_call, 0)))((enum tree_code) (((contains_struct_check (((*((const_cast<
tree*> (tree_operand_check (((tree_check ((alloc_call), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3487, __FUNCTION__, (CALL_EXPR)))), ((0) + 3), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3487, __FUNCTION__)))))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3487, __FUNCTION__))->typed.type))->base.code)
== INTEGER_TYPE
3488 && TYPE_PTR_P (TREE_TYPE (CALL_EXPR_ARG (alloc_call, 1)))(((enum tree_code) (((contains_struct_check (((*((const_cast<
tree*> (tree_operand_check (((tree_check ((alloc_call), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3488, __FUNCTION__, (CALL_EXPR)))), ((1) + 3), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3488, __FUNCTION__)))))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3488, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE
)
)
3489 {
3490 tree placement = CALL_EXPR_ARG (alloc_call, 1)(*((const_cast<tree*> (tree_operand_check (((tree_check
((alloc_call), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3490, __FUNCTION__, (CALL_EXPR)))), ((1) + 3), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3490, __FUNCTION__)))))
;
3491
3492 if (placement_first != NULL_TREE(tree) __null
3493 && (INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (TREE_TYPE (placement)))(((enum tree_code) (((contains_struct_check ((((contains_struct_check
((placement), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3493, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3493, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE
|| (((enum tree_code) (((contains_struct_check ((((contains_struct_check
((placement), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3493, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3493, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (((contains_struct_check ((((contains_struct_check
((placement), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3493, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3493, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE
))
3494 || VOID_TYPE_P (TREE_TYPE (TREE_TYPE (placement)))(((enum tree_code) (((contains_struct_check ((((contains_struct_check
((placement), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3494, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3494, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE
)
))
3495 {
3496 placement_expr = get_target_expr (placement_first);
3497 CALL_EXPR_ARG (alloc_call, 1)(*((const_cast<tree*> (tree_operand_check (((tree_check
((alloc_call), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3497, __FUNCTION__, (CALL_EXPR)))), ((1) + 3), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3497, __FUNCTION__)))))
3498 = fold_convert (TREE_TYPE (placement), placement_expr)fold_convert_loc (((location_t) 0), ((contains_struct_check (
(placement), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3498, __FUNCTION__))->typed.type), placement_expr)
;
3499 }
3500
3501 if (!member_new_p
3502 && VOID_TYPE_P (TREE_TYPE (TREE_TYPE (CALL_EXPR_ARG (alloc_call, 1))))(((enum tree_code) (((contains_struct_check ((((contains_struct_check
(((*((const_cast<tree*> (tree_operand_check (((tree_check
((alloc_call), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3502, __FUNCTION__, (CALL_EXPR)))), ((1) + 3), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3502, __FUNCTION__)))))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3502, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3502, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE
)
)
3503 {
3504 /* Attempt to make the warning point at the operator new argument. */
3505 if (placement_first)
3506 placement = placement_first;
3507
3508 warn_placement_new_too_small (orig_type, nelts, size, placement);
3509 }
3510 }
3511
3512 alloc_expr = alloc_call;
3513 if (cookie_size)
3514 alloc_expr = maybe_wrap_new_for_constexpr (alloc_expr, type,
3515 cookie_size);
3516
3517 /* In the simple case, we can stop now. */
3518 pointer_type = build_pointer_type (type);
3519 if (!cookie_size && !is_initialized && !member_delete_p)
3520 return build_nop (pointer_type, alloc_expr);
3521
3522 /* Store the result of the allocation call in a variable so that we can
3523 use it more than once. */
3524 alloc_expr = get_target_expr (alloc_expr);
3525 alloc_node = TARGET_EXPR_SLOT (alloc_expr)(*(tree_operand_check_code ((alloc_expr), (TARGET_EXPR), (0),
"/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3525, __FUNCTION__)))
;
3526
3527 /* Strip any COMPOUND_EXPRs from ALLOC_CALL. */
3528 while (TREE_CODE (alloc_call)((enum tree_code) (alloc_call)->base.code) == COMPOUND_EXPR)
3529 alloc_call = TREE_OPERAND (alloc_call, 1)(*((const_cast<tree*> (tree_operand_check ((alloc_call)
, (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3529, __FUNCTION__)))))
;
3530
3531 /* Preevaluate the placement args so that we don't reevaluate them for a
3532 placement delete. */
3533 if (placement_allocation_fn_p)
3534 {
3535 tree inits;
3536 stabilize_call (alloc_call, &inits);
3537 if (inits)
3538 alloc_expr = build2 (COMPOUND_EXPR, TREE_TYPE (alloc_expr)((contains_struct_check ((alloc_expr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3538, __FUNCTION__))->typed.type)
, inits,
3539 alloc_expr);
3540 }
3541
3542 /* unless an allocation function is declared with an empty excep-
3543 tion-specification (_except.spec_), throw(), it indicates failure to
3544 allocate storage by throwing a bad_alloc exception (clause _except_,
3545 _lib.bad.alloc_); it returns a non-null pointer otherwise If the allo-
3546 cation function is declared with an empty exception-specification,
3547 throw(), it returns null to indicate failure to allocate storage and a
3548 non-null pointer otherwise.
3549
3550 So check for a null exception spec on the op new we just called. */
3551
3552 nothrow = TYPE_NOTHROW_P (TREE_TYPE (alloc_fn))nothrow_spec_p (((tree_class_check (((tree_check2 ((((contains_struct_check
((alloc_fn), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3552, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3552, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))), (tcc_type
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3552, __FUNCTION__))->type_non_common.lang_1))
;
3553 check_new
3554 = flag_check_newglobal_options.x_flag_check_new || (nothrow && !std_placement_new_fn_p (alloc_fn));
3555
3556 if (cookie_size)
3557 {
3558 tree cookie;
3559 tree cookie_ptr;
3560 tree size_ptr_type;
3561
3562 /* Adjust so we're pointing to the start of the object. */
3563 data_addr = fold_build_pointer_plus (alloc_node, cookie_size)fold_build_pointer_plus_loc (((location_t) 0), alloc_node, cookie_size
)
;
3564
3565 /* Store the number of bytes allocated so that we can know how
3566 many elements to destroy later. We use the last sizeof
3567 (size_t) bytes to store the number of elements. */
3568 cookie_ptr = size_binop (MINUS_EXPR, cookie_size, size_in_bytes (sizetype))size_binop_loc (((location_t) 0), MINUS_EXPR, cookie_size, size_in_bytes
(sizetype_tab[(int) stk_sizetype]))
;
3569 cookie_ptr = fold_build_pointer_plus_loc (input_location,
3570 alloc_node, cookie_ptr);
3571 size_ptr_type = build_pointer_type (sizetypesizetype_tab[(int) stk_sizetype]);
3572 cookie_ptr = fold_convert (size_ptr_type, cookie_ptr)fold_convert_loc (((location_t) 0), size_ptr_type, cookie_ptr
)
;
3573 cookie = cp_build_fold_indirect_ref (cookie_ptr);
3574
3575 cookie_expr = build2 (MODIFY_EXPR, sizetypesizetype_tab[(int) stk_sizetype], cookie, nelts);
3576
3577 if (targetm.cxx.cookie_has_size ())
3578 {
3579 /* Also store the element size. */
3580 cookie_ptr = fold_build_pointer_plus (cookie_ptr,fold_build_pointer_plus_loc (((location_t) 0), cookie_ptr, fold_build1_loc
(input_location, NEGATE_EXPR, sizetype_tab[(int) stk_sizetype
], size_in_bytes (sizetype_tab[(int) stk_sizetype])))
3581 fold_build1_loc (input_location,fold_build_pointer_plus_loc (((location_t) 0), cookie_ptr, fold_build1_loc
(input_location, NEGATE_EXPR, sizetype_tab[(int) stk_sizetype
], size_in_bytes (sizetype_tab[(int) stk_sizetype])))
3582 NEGATE_EXPR, sizetype,fold_build_pointer_plus_loc (((location_t) 0), cookie_ptr, fold_build1_loc
(input_location, NEGATE_EXPR, sizetype_tab[(int) stk_sizetype
], size_in_bytes (sizetype_tab[(int) stk_sizetype])))
3583 size_in_bytes (sizetype)))fold_build_pointer_plus_loc (((location_t) 0), cookie_ptr, fold_build1_loc
(input_location, NEGATE_EXPR, sizetype_tab[(int) stk_sizetype
], size_in_bytes (sizetype_tab[(int) stk_sizetype])))
;
3584
3585 cookie = cp_build_fold_indirect_ref (cookie_ptr);
3586 cookie = build2 (MODIFY_EXPR, sizetypesizetype_tab[(int) stk_sizetype], cookie,
3587 size_in_bytes (elt_type));
3588 cookie_expr = build2 (COMPOUND_EXPR, TREE_TYPE (cookie_expr)((contains_struct_check ((cookie_expr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3588, __FUNCTION__))->typed.type)
,
3589 cookie, cookie_expr);
3590 }
3591 }
3592 else
3593 {
3594 cookie_expr = NULL_TREE(tree) __null;
3595 data_addr = alloc_node;
3596 }
3597
3598 /* Now use a pointer to the type we've actually allocated. */
3599
3600 /* But we want to operate on a non-const version to start with,
3601 since we'll be modifying the elements. */
3602 non_const_pointer_type = build_pointer_type
3603 (cp_build_qualified_type (type, cp_type_quals (type) & ~TYPE_QUAL_CONST));
3604
3605 data_addr = fold_convert (non_const_pointer_type, data_addr)fold_convert_loc (((location_t) 0), non_const_pointer_type, data_addr
)
;
3606 /* Any further uses of alloc_node will want this type, too. */
3607 alloc_node = fold_convert (non_const_pointer_type, alloc_node)fold_convert_loc (((location_t) 0), non_const_pointer_type, alloc_node
)
;
3608
3609 /* Now initialize the allocated object. Note that we preevaluate the
3610 initialization expression, apart from the actual constructor call or
3611 assignment--we do this because we want to delay the allocation as long
3612 as possible in order to minimize the size of the exception region for
3613 placement delete. */
3614 if (is_initialized)
3615 {
3616 bool explicit_value_init_p = false;
3617
3618 if (*init != NULL__null && (*init)->is_empty ())
3619 {
3620 *init = NULL__null;
3621 explicit_value_init_p = true;
3622 }
3623
3624 if (processing_template_declscope_chain->x_processing_template_decl)
3625 {
3626 /* Avoid an ICE when converting to a base in build_simple_base_path.
3627 We'll throw this all away anyway, and build_new will create
3628 a NEW_EXPR. */
3629 tree t = fold_convert (build_pointer_type (elt_type), data_addr)fold_convert_loc (((location_t) 0), build_pointer_type (elt_type
), data_addr)
;
3630 /* build_value_init doesn't work in templates, and we don't need
3631 the initializer anyway since we're going to throw it away and
3632 rebuild it at instantiation time, so just build up a single
3633 constructor call to get any appropriate diagnostics. */
3634 init_expr = cp_build_fold_indirect_ref (t);
3635 if (type_build_ctor_call (elt_type))
3636 init_expr = build_special_member_call (init_expr,
3637 complete_ctor_identifiercp_global_trees[CPTI_COMPLETE_CTOR_IDENTIFIER],
3638 init, elt_type,
3639 LOOKUP_NORMAL((1 << 0)),
3640 complain);
3641 }
3642 else if (array_p)
3643 {
3644 tree vecinit = NULL_TREE(tree) __null;
3645 const size_t len = vec_safe_length (*init);
3646 if (len == 1 && DIRECT_LIST_INIT_P ((**init)[0])((((enum tree_code) ((**init)[0])->base.code) == CONSTRUCTOR
&& ((contains_struct_check (((**init)[0]), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3646, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
]) && (((tree_not_check2 (((tree_check (((**init)[0])
, "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3646, __FUNCTION__, (CONSTRUCTOR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3646, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0)))
)
3647 {
3648 vecinit = (**init)[0];
3649 if (CONSTRUCTOR_NELTS (vecinit)(vec_safe_length (((tree_check ((vecinit), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3649, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
== 0)
3650 /* List-value-initialization, leave it alone. */;
3651 else
3652 {
3653 tree arraytype, domain;
3654 if (TREE_CONSTANT (nelts)((non_type_check ((nelts), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3654, __FUNCTION__))->base.constant_flag)
)
3655 domain = compute_array_index_type (NULL_TREE(tree) __null, nelts,
3656 complain);
3657 else
3658 /* We'll check the length at runtime. */
3659 domain = NULL_TREE(tree) __null;
3660 arraytype = build_cplus_array_type (type, domain);
3661 /* If we have new char[4]{"foo"}, we have to reshape
3662 so that the STRING_CST isn't wrapped in { }. */
3663 vecinit = reshape_init (arraytype, vecinit, complain);
3664 /* The middle end doesn't cope with the location wrapper
3665 around a STRING_CST. */
3666 STRIP_ANY_LOCATION_WRAPPER (vecinit)(vecinit) = tree_strip_any_location_wrapper ((const_cast<union
tree_node *> (((vecinit)))))
;
3667 vecinit = digest_init (arraytype, vecinit, complain);
3668 }
3669 }
3670 else if (*init)
3671 {
3672 if (complain & tf_error)
3673 error ("parenthesized initializer in array new");
3674 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3675 }
3676 init_expr
3677 = build_vec_init (data_addr,
3678 cp_build_binary_op (input_location,
3679 MINUS_EXPR, outer_nelts,
3680 integer_one_nodeglobal_trees[TI_INTEGER_ONE],
3681 complain),
3682 vecinit,
3683 explicit_value_init_p,
3684 /*from_array=*/0,
3685 complain);
3686 }
3687 else
3688 {
3689 init_expr = cp_build_fold_indirect_ref (data_addr);
3690
3691 if (type_build_ctor_call (type) && !explicit_value_init_p)
3692 {
3693 init_expr = build_special_member_call (init_expr,
3694 complete_ctor_identifiercp_global_trees[CPTI_COMPLETE_CTOR_IDENTIFIER],
3695 init, elt_type,
3696 LOOKUP_NORMAL((1 << 0)),
3697 complain|tf_no_cleanup);
3698 }
3699 else if (explicit_value_init_p)
3700 {
3701 /* Something like `new int()'. NO_CLEANUP is needed so
3702 we don't try and build a (possibly ill-formed)
3703 destructor. */
3704 tree val = build_value_init (type, complain | tf_no_cleanup);
3705 if (val == error_mark_nodeglobal_trees[TI_ERROR_MARK])
3706 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3707 init_expr = cp_build_init_expr (init_expr, val);
3708 }
3709 else
3710 {
3711 tree ie;
3712
3713 /* We are processing something like `new int (10)', which
3714 means allocate an int, and initialize it with 10.
3715
3716 In C++20, also handle `new A(1, 2)'. */
3717 if (cxx_dialect >= cxx20
3718 && 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))
3719 && (*init)->length () > 1)
3720 {
3721 ie = build_constructor_from_vec (init_list_type_nodecp_global_trees[CPTI_INIT_LIST_TYPE], *init);
3722 CONSTRUCTOR_IS_DIRECT_INIT (ie)(((tree_not_check2 (((tree_check ((ie), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3722, __FUNCTION__, (CONSTRUCTOR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3722, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0))
= true;
3723 CONSTRUCTOR_IS_PAREN_INIT (ie)((tree_check ((ie), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3723, __FUNCTION__, (CONSTRUCTOR)))->base.private_flag)
= true;
3724 ie = digest_init (type, ie, complain);
3725 }
3726 else
3727 ie = build_x_compound_expr_from_vec (*init, "new initializer",
3728 complain);
3729 init_expr = cp_build_modify_expr (input_location, init_expr,
3730 INIT_EXPR, ie, complain);
3731 }
3732 /* If the initializer uses C++14 aggregate NSDMI that refer to the
3733 object being initialized, replace them now and don't try to
3734 preevaluate. */
3735 bool had_placeholder = false;
3736 if (!processing_template_declscope_chain->x_processing_template_decl
3737 && TREE_CODE (init_expr)((enum tree_code) (init_expr)->base.code) == INIT_EXPR)
3738 TREE_OPERAND (init_expr, 1)(*((const_cast<tree*> (tree_operand_check ((init_expr),
(1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3738, __FUNCTION__)))))
3739 = replace_placeholders (TREE_OPERAND (init_expr, 1)(*((const_cast<tree*> (tree_operand_check ((init_expr),
(1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3739, __FUNCTION__)))))
,
3740 TREE_OPERAND (init_expr, 0)(*((const_cast<tree*> (tree_operand_check ((init_expr),
(0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3740, __FUNCTION__)))))
,
3741 &had_placeholder);
3742 }
3743
3744 if (init_expr == error_mark_nodeglobal_trees[TI_ERROR_MARK])
3745 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3746 }
3747 else
3748 init_expr = NULL_TREE(tree) __null;
3749
3750 /* If any part of the object initialization terminates by throwing an
3751 exception and a suitable deallocation function can be found, the
3752 deallocation function is called to free the memory in which the
3753 object was being constructed, after which the exception continues
3754 to propagate in the context of the new-expression. If no
3755 unambiguous matching deallocation function can be found,
3756 propagating the exception does not cause the object's memory to be
3757 freed. */
3758 if (flag_exceptionsglobal_options.x_flag_exceptions && (init_expr || member_delete_p))
3759 {
3760 enum tree_code dcode = array_p ? VEC_DELETE_EXPR : DELETE_EXPR;
3761 tree cleanup;
3762
3763 /* The Standard is unclear here, but the right thing to do
3764 is to use the same method for finding deallocation
3765 functions that we use for finding allocation functions. */
3766 cleanup = (build_op_delete_call
3767 (dcode,
3768 alloc_node,
3769 size,
3770 globally_qualified_p,
3771 placement_allocation_fn_p ? alloc_call : NULL_TREE(tree) __null,
3772 alloc_fn,
3773 complain));
3774
3775 if (cleanup && init_expr && !processing_template_declscope_chain->x_processing_template_decl)
3776 /* Ack! First we allocate the memory. Then we set our sentry
3777 variable to true, and expand a cleanup that deletes the
3778 memory if sentry is true. Then we run the constructor, and
3779 finally clear the sentry.
3780
3781 We need to do this because we allocate the space first, so
3782 if there are any temporaries with cleanups in the
3783 constructor args, we need this EH region to extend until
3784 end of full-expression to preserve nesting.
3785
3786 We used to try to evaluate the args first to avoid this, but
3787 since C++17 [expr.new] says that "The invocation of the
3788 allocation function is sequenced before the evaluations of
3789 expressions in the new-initializer." */
3790 {
3791 tree end, sentry, begin;
3792
3793 begin = get_target_expr (boolean_true_nodeglobal_trees[TI_BOOLEAN_TRUE]);
3794 CLEANUP_EH_ONLY (begin)((begin)->base.static_flag) = 1;
3795
3796 sentry = TARGET_EXPR_SLOT (begin)(*(tree_operand_check_code ((begin), (TARGET_EXPR), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3796, __FUNCTION__)))
;
3797
3798 /* CLEANUP is compiler-generated, so no diagnostics. */
3799 suppress_warning (cleanup);
3800
3801 TARGET_EXPR_CLEANUP (begin)(*(tree_operand_check_code ((begin), (TARGET_EXPR), (2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3801, __FUNCTION__)))
3802 = build3 (COND_EXPR, void_type_nodeglobal_trees[TI_VOID_TYPE], sentry,
3803 cleanup, void_nodeglobal_trees[TI_VOID]);
3804
3805 end = build2 (MODIFY_EXPR, TREE_TYPE (sentry)((contains_struct_check ((sentry), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3805, __FUNCTION__))->typed.type)
,
3806 sentry, boolean_false_nodeglobal_trees[TI_BOOLEAN_FALSE]);
3807
3808 init_expr
3809 = build2 (COMPOUND_EXPR, void_type_nodeglobal_trees[TI_VOID_TYPE], begin,
3810 build2 (COMPOUND_EXPR, void_type_nodeglobal_trees[TI_VOID_TYPE], init_expr,
3811 end));
3812 /* Likewise, this is compiler-generated. */
3813 suppress_warning (init_expr);
3814 }
3815 }
3816
3817 /* Now build up the return value in reverse order. */
3818
3819 rval = data_addr;
3820
3821 if (init_expr)
3822 rval = build2 (COMPOUND_EXPR, TREE_TYPE (rval)((contains_struct_check ((rval), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3822, __FUNCTION__))->typed.type)
, init_expr, rval);
3823 if (cookie_expr)
3824 rval = build2 (COMPOUND_EXPR, TREE_TYPE (rval)((contains_struct_check ((rval), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3824, __FUNCTION__))->typed.type)
, cookie_expr, rval);
3825
3826 suppress_warning (rval, OPT_Wunused_value);
3827
3828 if (rval == data_addr && TREE_CODE (alloc_expr)((enum tree_code) (alloc_expr)->base.code) == TARGET_EXPR)
3829 /* If we don't have an initializer or a cookie, strip the TARGET_EXPR
3830 and return the call (which doesn't need to be adjusted). */
3831 rval = TARGET_EXPR_INITIAL (alloc_expr)(*(tree_operand_check_code ((alloc_expr), (TARGET_EXPR), (1),
"/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3831, __FUNCTION__)))
;
3832 else
3833 {
3834 if (check_new)
3835 {
3836 tree ifexp = cp_build_binary_op (input_location,
3837 NE_EXPR, alloc_node,
3838 nullptr_nodec_global_trees[CTI_NULLPTR],
3839 complain);
3840 rval = build_conditional_expr (input_location, ifexp, rval,
3841 alloc_node, complain);
3842 }
3843
3844 /* Perform the allocation before anything else, so that ALLOC_NODE
3845 has been initialized before we start using it. */
3846 rval = build2 (COMPOUND_EXPR, TREE_TYPE (rval)((contains_struct_check ((rval), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3846, __FUNCTION__))->typed.type)
, alloc_expr, rval);
3847 }
3848
3849 /* A new-expression is never an lvalue. */
3850 gcc_assert (!obvalue_p (rval))((void)(!(!obvalue_p (rval)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3850, __FUNCTION__), 0 : 0))
;
3851
3852 return convert (pointer_type, rval);
3853}
3854
3855/* Generate a representation for a C++ "new" expression. *PLACEMENT
3856 is a vector of placement-new arguments (or NULL if none). If NELTS
3857 is NULL, TYPE is the type of the storage to be allocated. If NELTS
3858 is not NULL, then this is an array-new allocation; TYPE is the type
3859 of the elements in the array and NELTS is the number of elements in
3860 the array. *INIT, if non-NULL, is the initializer for the new
3861 object, or an empty vector to indicate an initializer of "()". If
3862 USE_GLOBAL_NEW is true, then the user explicitly wrote "::new"
3863 rather than just "new". This may change PLACEMENT and INIT. */
3864
3865tree
3866build_new (location_t loc, vec<tree, va_gc> **placement, tree type,
3867 tree nelts, vec<tree, va_gc> **init, int use_global_new,
3868 tsubst_flags_t complain)
3869{
3870 tree rval;
3871 vec<tree, va_gc> *orig_placement = NULL__null;
3872 tree orig_nelts = NULL_TREE(tree) __null;
3873 vec<tree, va_gc> *orig_init = NULL__null;
3874
3875 if (type == error_mark_nodeglobal_trees[TI_ERROR_MARK])
3876 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3877
3878 if (nelts == NULL_TREE(tree) __null
3879 /* Don't do auto deduction where it might affect mangling. */
3880 && (!processing_template_declscope_chain->x_processing_template_decl || at_function_scope_p ()))
3881 {
3882 tree auto_node = type_uses_auto (type);
3883 if (auto_node)
3884 {
3885 tree d_init = NULL_TREE(tree) __null;
3886 const size_t len = vec_safe_length (*init);
3887 /* E.g. new auto(x) must have exactly one element, or
3888 a {} initializer will have one element. */
3889 if (len == 1)
3890 {
3891 d_init = (**init)[0];
3892 d_init = resolve_nondeduced_context (d_init, complain);
3893 }
3894 /* For the rest, e.g. new A(1, 2, 3), create a list. */
3895 else if (len > 1)
3896 {
3897 unsigned int n;
3898 tree t;
3899 tree *pp = &d_init;
3900 FOR_EACH_VEC_ELT (**init, n, t)for (n = 0; (**init).iterate ((n), &(t)); ++(n))
3901 {
3902 t = resolve_nondeduced_context (t, complain);
3903 *pp = build_tree_list (NULL_TREE(tree) __null, t);
3904 pp = &TREE_CHAIN (*pp)((contains_struct_check ((*pp), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3904, __FUNCTION__))->common.chain)
;
3905 }
3906 }
3907 type = do_auto_deduction (type, d_init, auto_node, complain);
3908 }
3909 }
3910
3911 if (processing_template_declscope_chain->x_processing_template_decl)
3912 {
3913 if (dependent_type_p (type)
3914 || any_type_dependent_arguments_p (*placement)
3915 || (nelts && type_dependent_expression_p (nelts))
3916 || (nelts && *init)
3917 || any_type_dependent_arguments_p (*init))
3918 return build_raw_new_expr (loc, *placement, type, nelts, *init,
3919 use_global_new);
3920
3921 orig_placement = make_tree_vector_copy (*placement);
3922 orig_nelts = nelts;
3923 if (*init)
3924 {
3925 orig_init = make_tree_vector_copy (*init);
3926 /* Also copy any CONSTRUCTORs in *init, since reshape_init and
3927 digest_init clobber them in place. */
3928 for (unsigned i = 0; i < orig_init->length(); ++i)
3929 {
3930 tree e = (**init)[i];
3931 if (TREE_CODE (e)((enum tree_code) (e)->base.code) == CONSTRUCTOR)
3932 (**init)[i] = copy_node (e);
3933 }
3934 }
3935
3936 make_args_non_dependent (*placement);
3937 if (nelts)
3938 nelts = build_non_dependent_expr (nelts);
3939 make_args_non_dependent (*init);
3940 }
3941
3942 if (nelts)
3943 {
3944 location_t nelts_loc = cp_expr_loc_or_loc (nelts, loc);
3945 if (!build_expr_type_conversion (WANT_INT1 | WANT_ENUM4, nelts, false))
3946 {
3947 if (complain & tf_error)
3948 permerror (nelts_loc,
3949 "size in array new must have integral type");
3950 else
3951 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3952 }
3953
3954 /* Try to determine the constant value only for the purposes
3955 of the diagnostic below but continue to use the original
3956 value and handle const folding later. */
3957 const_tree cst_nelts = fold_non_dependent_expr (nelts, complain);
3958
3959 /* The expression in a noptr-new-declarator is erroneous if it's of
3960 non-class type and its value before converting to std::size_t is
3961 less than zero. ... If the expression is a constant expression,
3962 the program is ill-fomed. */
3963 if (TREE_CODE (cst_nelts)((enum tree_code) (cst_nelts)->base.code) == INTEGER_CST
3964 && !valid_array_size_p (nelts_loc, cst_nelts, NULL_TREE(tree) __null,
3965 complain & tf_error))
3966 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3967
3968 nelts = mark_rvalue_use (nelts);
3969 nelts = cp_save_expr (cp_convert (sizetypesizetype_tab[(int) stk_sizetype], nelts, complain));
3970 }
3971
3972 /* ``A reference cannot be created by the new operator. A reference
3973 is not an object (8.2.2, 8.4.3), so a pointer to it could not be
3974 returned by new.'' ARM 5.3.3 */
3975 if (TYPE_REF_P (type)(((enum tree_code) (type)->base.code) == REFERENCE_TYPE))
3976 {
3977 if (complain & tf_error)
3978 error_at (loc, "new cannot be applied to a reference type");
3979 else
3980 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3981 type = TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 3981, __FUNCTION__))->typed.type)
;
3982 }
3983
3984 if (TREE_CODE (type)((enum tree_code) (type)->base.code) == FUNCTION_TYPE)
3985 {
3986 if (complain & tf_error)
3987 error_at (loc, "new cannot be applied to a function type");
3988 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3989 }
3990
3991 /* P1009: Array size deduction in new-expressions. */
3992 const bool array_p = TREE_CODE (type)((enum tree_code) (type)->base.code) == ARRAY_TYPE;
3993 if (*init
3994 /* If ARRAY_P, we have to deduce the array bound. For C++20 paren-init,
3995 we have to process the parenthesized-list. But don't do it for (),
3996 which is value-initialization, and INIT should stay empty. */
3997 && (array_p || (cxx_dialect >= cxx20 && nelts && !(*init)->is_empty ())))
3998 {
3999 /* This means we have 'new T[]()'. */
4000 if ((*init)->is_empty ())
4001 {
4002 tree ctor = build_constructor (init_list_type_nodecp_global_trees[CPTI_INIT_LIST_TYPE], NULL__null);
4003 CONSTRUCTOR_IS_DIRECT_INIT (ctor)(((tree_not_check2 (((tree_check ((ctor), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4003, __FUNCTION__, (CONSTRUCTOR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4003, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0))
= true;
4004 vec_safe_push (*init, ctor);
4005 }
4006 tree &elt = (**init)[0];
4007 /* The C++20 'new T[](e_0, ..., e_k)' case allowed by P0960. */
4008 if (!DIRECT_LIST_INIT_P (elt)((((enum tree_code) (elt)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((elt), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4008, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
]) && (((tree_not_check2 (((tree_check ((elt), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4008, __FUNCTION__, (CONSTRUCTOR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4008, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0)))
&& cxx_dialect >= cxx20)
4009 {
4010 tree ctor = build_constructor_from_vec (init_list_type_nodecp_global_trees[CPTI_INIT_LIST_TYPE], *init);
4011 CONSTRUCTOR_IS_DIRECT_INIT (ctor)(((tree_not_check2 (((tree_check ((ctor), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4011, __FUNCTION__, (CONSTRUCTOR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4011, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0))
= true;
4012 CONSTRUCTOR_IS_PAREN_INIT (ctor)((tree_check ((ctor), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4012, __FUNCTION__, (CONSTRUCTOR)))->base.private_flag)
= true;
4013 elt = ctor;
4014 /* We've squashed all the vector elements into the first one;
4015 truncate the rest. */
4016 (*init)->truncate (1);
4017 }
4018 /* Otherwise we should have 'new T[]{e_0, ..., e_k}'. */
4019 if (array_p && !TYPE_DOMAIN (type)((tree_check ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4019, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
)
)
4020 {
4021 /* We need to reshape before deducing the bounds to handle code like
4022
4023 struct S { int x, y; };
4024 new S[]{1, 2, 3, 4};
4025
4026 which should deduce S[2]. But don't change ELT itself: we want to
4027 pass a list-initializer to build_new_1, even for STRING_CSTs. */
4028 tree e = elt;
4029 if (BRACE_ENCLOSED_INITIALIZER_P (e)(((enum tree_code) (e)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((e), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4029, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
)
4030 e = reshape_init (type, e, complain);
4031 cp_complete_array_type (&type, e, /*do_default*/false);
4032 }
4033 }
4034
4035 /* The type allocated must be complete. If the new-type-id was
4036 "T[N]" then we are just checking that "T" is complete here, but
4037 that is equivalent, since the value of "N" doesn't matter. */
4038 if (!complete_type_or_maybe_complain (type, NULL_TREE(tree) __null, complain))
4039 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
4040
4041 rval = build_new_1 (placement, type, nelts, init, use_global_new, complain);
4042 if (rval == error_mark_nodeglobal_trees[TI_ERROR_MARK])
4043 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
4044
4045 if (processing_template_declscope_chain->x_processing_template_decl)
4046 {
4047 tree ret = build_raw_new_expr (loc, orig_placement, type, orig_nelts,
4048 orig_init, use_global_new);
4049 release_tree_vector (orig_placement);
4050 release_tree_vector (orig_init);
4051 return ret;
4052 }
4053
4054 /* Wrap it in a NOP_EXPR so warn_if_unused_value doesn't complain. */
4055 rval = build1_loc (loc, NOP_EXPR, TREE_TYPE (rval)((contains_struct_check ((rval), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4055, __FUNCTION__))->typed.type)
, rval);
4056 suppress_warning (rval, OPT_Wunused_value);
4057
4058 return rval;
4059}
4060
4061static tree
4062build_vec_delete_1 (location_t loc, tree base, tree maxindex, tree type,
4063 special_function_kind auto_delete_vec,
4064 int use_global_delete, tsubst_flags_t complain,
4065 bool in_cleanup = false)
4066{
4067 tree virtual_size;
4068 tree ptype = build_pointer_type (type = complete_type (type));
4069 tree size_exp;
4070
4071 /* Temporary variables used by the loop. */
4072 tree tbase, tbase_init;
4073
4074 /* This is the body of the loop that implements the deletion of a
4075 single element, and moves temp variables to next elements. */
4076 tree body;
4077
4078 /* This is the LOOP_EXPR that governs the deletion of the elements. */
4079 tree loop = 0;
4080
4081 /* This is the thing that governs what to do after the loop has run. */
4082 tree deallocate_expr = 0;
4083
4084 /* This is the BIND_EXPR which holds the outermost iterator of the
4085 loop. It is convenient to set this variable up and test it before
4086 executing any other code in the loop.
4087 This is also the containing expression returned by this function. */
4088 tree controller = NULL_TREE(tree) __null;
4089 tree tmp;
4090
4091 /* We should only have 1-D arrays here. */
4092 gcc_assert (TREE_CODE (type) != ARRAY_TYPE)((void)(!(((enum tree_code) (type)->base.code) != ARRAY_TYPE
) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4092, __FUNCTION__), 0 : 0))
;
4093
4094 if (base == error_mark_nodeglobal_trees[TI_ERROR_MARK] || maxindex == error_mark_nodeglobal_trees[TI_ERROR_MARK])
4095 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
4096
4097 if (!verify_type_context (loc, TCTX_DEALLOCATION, type,
4098 !(complain & tf_error)))
4099 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
4100
4101 if (!COMPLETE_TYPE_P (type)(((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4101, __FUNCTION__))->type_common.size) != (tree) __null
)
)
4102 {
4103 if (complain & tf_warning)
4104 {
4105 auto_diagnostic_group d;
4106 if (warning_at (loc, OPT_Wdelete_incomplete,
4107 "possible problem detected in invocation of "
4108 "operator %<delete []%>"))
4109 {
4110 cxx_incomplete_type_diagnostic (base, type, DK_WARNING);
4111 inform (loc, "neither the destructor nor the "
4112 "class-specific operator %<delete []%> will be called, "
4113 "even if they are declared when the class is defined");
4114 }
4115 }
4116 /* This size won't actually be used. */
4117 size_exp = size_one_nodeglobal_trees[TI_SIZE_ONE];
4118 goto no_destructor;
4119 }
4120
4121 size_exp = size_in_bytes (type);
4122
4123 if (! MAYBE_CLASS_TYPE_P (type)((((enum tree_code) (type)->base.code) == TEMPLATE_TYPE_PARM
|| ((enum tree_code) (type)->base.code) == TYPENAME_TYPE ||
((enum tree_code) (type)->base.code) == TYPEOF_TYPE || ((
enum tree_code) (type)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM
|| ((enum tree_code) (type)->base.code) == DECLTYPE_TYPE ||
((enum tree_code) (type)->base.code) == TRAIT_TYPE || ((enum
tree_code) (type)->base.code) == DEPENDENT_OPERATOR_TYPE)
|| (((((enum tree_code) (type)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (type)->base.code)) == UNION_TYPE) &&
((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4123, __FUNCTION__))->type_common.lang_flag_5)))
)
4124 goto no_destructor;
4125 else if (TYPE_HAS_TRIVIAL_DESTRUCTOR (type)(!(((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4125, __FUNCTION__))->type_common.lang_flag_4)))
)
4126 {
4127 /* Make sure the destructor is callable. */
4128 if (type_build_dtor_call (type))
4129 {
4130 tmp = build_delete (loc, ptype, base, sfk_complete_destructor,
4131 LOOKUP_NORMAL((1 << 0))|LOOKUP_DESTRUCTOR(1 << 5), 1,
4132 complain);
4133 if (tmp == error_mark_nodeglobal_trees[TI_ERROR_MARK])
4134 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
4135 }
4136 goto no_destructor;
4137 }
4138
4139 /* The below is short by the cookie size. */
4140 virtual_size = size_binop (MULT_EXPR, size_exp,size_binop_loc (((location_t) 0), MULT_EXPR, size_exp, fold_convert_loc
(((location_t) 0), sizetype_tab[(int) stk_sizetype], maxindex
))
4141 fold_convert (sizetype, maxindex))size_binop_loc (((location_t) 0), MULT_EXPR, size_exp, fold_convert_loc
(((location_t) 0), sizetype_tab[(int) stk_sizetype], maxindex
))
;
4142
4143 tbase = create_temporary_var (ptype);
4144 DECL_INITIAL (tbase)((contains_struct_check ((tbase), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4144, __FUNCTION__))->decl_common.initial)
4145 = fold_build_pointer_plus_loc (loc, fold_convert (ptype, base)fold_convert_loc (((location_t) 0), ptype, base),
4146 virtual_size);
4147 tbase_init = build_stmt (loc, DECL_EXPR, tbase);
4148 controller = build3 (BIND_EXPR, void_type_nodeglobal_trees[TI_VOID_TYPE], tbase, NULL_TREE(tree) __null, NULL_TREE(tree) __null);
4149 TREE_SIDE_EFFECTS (controller)((non_type_check ((controller), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4149, __FUNCTION__))->base.side_effects_flag)
= 1;
4150 BIND_EXPR_VEC_DTOR (controller)((tree_not_check2 (((tree_check ((controller), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4150, __FUNCTION__, (BIND_EXPR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4150, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_1)
= true;
4151
4152 body = build1 (EXIT_EXPR, void_type_nodeglobal_trees[TI_VOID_TYPE],
4153 build2 (EQ_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], tbase,
4154 fold_convert (ptype, base)fold_convert_loc (((location_t) 0), ptype, base)));
4155 tmp = fold_build1_loc (loc, NEGATE_EXPR, sizetypesizetype_tab[(int) stk_sizetype], size_exp);
4156 tmp = fold_build_pointer_plus (tbase, tmp)fold_build_pointer_plus_loc (((location_t) 0), tbase, tmp);
4157 tmp = cp_build_modify_expr (loc, tbase, NOP_EXPR, tmp, complain);
4158 if (tmp == error_mark_nodeglobal_trees[TI_ERROR_MARK])
4159 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
4160 body = build_compound_expr (loc, body, tmp);
4161 tmp = build_delete (loc, ptype, tbase, sfk_complete_destructor,
4162 LOOKUP_NORMAL((1 << 0))|LOOKUP_DESTRUCTOR(1 << 5), 1,
4163 complain);
4164 if (tmp == error_mark_nodeglobal_trees[TI_ERROR_MARK])
4165 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
4166 body = build_compound_expr (loc, body, tmp);
4167
4168 loop = build1 (LOOP_EXPR, void_type_nodeglobal_trees[TI_VOID_TYPE], body);
4169
4170 /* If one destructor throws, keep trying to clean up the rest, unless we're
4171 already in a build_vec_init cleanup. */
4172 if (flag_exceptionsglobal_options.x_flag_exceptions && !in_cleanup && !expr_noexcept_p (tmp, tf_none))
4173 {
4174 loop = build2 (TRY_CATCH_EXPR, void_type_nodeglobal_trees[TI_VOID_TYPE], loop,
4175 unshare_expr (loop));
4176 /* Tell honor_protect_cleanup_actions to discard this on the
4177 exceptional path. */
4178 TRY_CATCH_IS_CLEANUP (loop)((tree_check ((loop), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4178, __FUNCTION__, (TRY_CATCH_EXPR)))->base.static_flag
)
= true;
4179 }
4180
4181 loop = build_compound_expr (loc, tbase_init, loop);
4182
4183 no_destructor:
4184 /* Delete the storage if appropriate. */
4185 if (auto_delete_vec == sfk_deleting_destructor)
4186 {
4187 tree base_tbd;
4188
4189 /* The below is short by the cookie size. */
4190 virtual_size = size_binop (MULT_EXPR, size_exp,size_binop_loc (((location_t) 0), MULT_EXPR, size_exp, fold_convert_loc
(((location_t) 0), sizetype_tab[(int) stk_sizetype], maxindex
))
4191 fold_convert (sizetype, maxindex))size_binop_loc (((location_t) 0), MULT_EXPR, size_exp, fold_convert_loc
(((location_t) 0), sizetype_tab[(int) stk_sizetype], maxindex
))
;
4192
4193 if (! TYPE_VEC_NEW_USES_COOKIE (type)((((((enum tree_code) (type)->base.code)) == RECORD_TYPE ||
(((enum tree_code) (type)->base.code)) == UNION_TYPE) &&
((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4193, __FUNCTION__))->type_common.lang_flag_5)) &&
(((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4193, __FUNCTION__))->type_with_lang_specific.lang_specific
))->vec_new_uses_cookie)
)
4194 /* no header */
4195 base_tbd = base;
4196 else
4197 {
4198 tree cookie_size;
4199
4200 cookie_size = targetm.cxx.get_cookie_size (type);
4201 base_tbd = cp_build_binary_op (loc,
4202 MINUS_EXPR,
4203 cp_convert (string_type_nodec_global_trees[CTI_STRING_TYPE],
4204 base, complain),
4205 cookie_size,
4206 complain);
4207 if (base_tbd == error_mark_nodeglobal_trees[TI_ERROR_MARK])
4208 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
4209 base_tbd = cp_convert (ptype, base_tbd, complain);
4210 /* True size with header. */
4211 virtual_size = size_binop (PLUS_EXPR, virtual_size, cookie_size)size_binop_loc (((location_t) 0), PLUS_EXPR, virtual_size, cookie_size
)
;
4212 }
4213
4214 deallocate_expr = build_op_delete_call (VEC_DELETE_EXPR,
4215 base_tbd, virtual_size,
4216 use_global_delete & 1,
4217 /*placement=*/NULL_TREE(tree) __null,
4218 /*alloc_fn=*/NULL_TREE(tree) __null,
4219 complain);
4220 }
4221
4222 body = loop;
4223 if (deallocate_expr == error_mark_nodeglobal_trees[TI_ERROR_MARK])
4224 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
4225 else if (!deallocate_expr)
4226 ;
4227 else if (!body)
4228 body = deallocate_expr;
4229 else
4230 /* The delete operator must be called, even if a destructor
4231 throws. */
4232 body = build2 (TRY_FINALLY_EXPR, void_type_nodeglobal_trees[TI_VOID_TYPE], body, deallocate_expr);
4233
4234 if (!body)
4235 body = integer_zero_nodeglobal_trees[TI_INTEGER_ZERO];
4236
4237 /* Outermost wrapper: If pointer is null, punt. */
4238 tree cond = build2_loc (loc, NE_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], base,
4239 fold_convert (TREE_TYPE (base), nullptr_node)fold_convert_loc (((location_t) 0), ((contains_struct_check (
(base), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4239, __FUNCTION__))->typed.type), c_global_trees[CTI_NULLPTR
])
);
4240 /* This is a compiler generated comparison, don't emit
4241 e.g. -Wnonnull-compare warning for it. */
4242 suppress_warning (cond, OPT_Wnonnull_compare);
4243 body = build3_loc (loc, COND_EXPR, void_type_nodeglobal_trees[TI_VOID_TYPE],
4244 cond, body, integer_zero_nodeglobal_trees[TI_INTEGER_ZERO]);
4245 COND_EXPR_IS_VEC_DELETE (body)((tree_not_check2 (((tree_check ((body), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4245, __FUNCTION__, (COND_EXPR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4245, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0)
= true;
4246 body = build1 (NOP_EXPR, void_type_nodeglobal_trees[TI_VOID_TYPE], body);
4247
4248 if (controller)
4249 {
4250 TREE_OPERAND (controller, 1)(*((const_cast<tree*> (tree_operand_check ((controller)
, (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4250, __FUNCTION__)))))
= body;
4251 body = controller;
4252 }
4253
4254 if (TREE_CODE (base)((enum tree_code) (base)->base.code) == SAVE_EXPR)
4255 /* Pre-evaluate the SAVE_EXPR outside of the BIND_EXPR. */
4256 body = build2 (COMPOUND_EXPR, void_type_nodeglobal_trees[TI_VOID_TYPE], base, body);
4257
4258 return convert_to_void (body, ICV_CAST, complain);
4259}
4260
4261/* Create an unnamed variable of the indicated TYPE. */
4262
4263tree
4264create_temporary_var (tree type)
4265{
4266 tree decl;
4267
4268 decl = build_decl (input_location,
4269 VAR_DECL, NULL_TREE(tree) __null, type);
4270 TREE_USED (decl)((decl)->base.used_flag) = 1;
4271 DECL_ARTIFICIAL (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4271, __FUNCTION__))->decl_common.artificial_flag)
= 1;
4272 DECL_IGNORED_P (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4272, __FUNCTION__))->decl_common.ignored_flag)
= 1;
4273 DECL_CONTEXT (decl)((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4273, __FUNCTION__))->decl_minimal.context)
= current_function_decl;
4274
4275 return decl;
4276}
4277
4278/* Create a new temporary variable of the indicated TYPE, initialized
4279 to INIT.
4280
4281 It is not entered into current_binding_level, because that breaks
4282 things when it comes time to do final cleanups (which take place
4283 "outside" the binding contour of the function). */
4284
4285tree
4286get_temp_regvar (tree type, tree init)
4287{
4288 tree decl;
4289
4290 decl = create_temporary_var (type);
4291 add_decl_expr (decl);
4292
4293 finish_expr_stmt (cp_build_modify_expr (input_location, decl, INIT_EXPR,
4294 init, tf_warning_or_error));
4295
4296 return decl;
4297}
4298
4299/* Subroutine of build_vec_init. Returns true if assigning to an array of
4300 INNER_ELT_TYPE from INIT is trivial. */
4301
4302static bool
4303vec_copy_assign_is_trivial (tree inner_elt_type, tree init)
4304{
4305 tree fromtype = inner_elt_type;
4306 if (lvalue_p (init))
4307 fromtype = cp_build_reference_type (fromtype, /*rval*/false);
4308 return is_trivially_xible (MODIFY_EXPR, inner_elt_type, fromtype);
4309}
4310
4311/* Subroutine of build_vec_init: Check that the array has at least N
4312 elements. Other parameters are local variables in build_vec_init. */
4313
4314void
4315finish_length_check (tree atype, tree iterator, tree obase, unsigned n)
4316{
4317 tree nelts = build_int_cst (ptrdiff_type_nodeglobal_trees[TI_PTRDIFF_TYPE], n - 1);
4318 if (TREE_CODE (atype)((enum tree_code) (atype)->base.code) != ARRAY_TYPE)
4319 {
4320 if (flag_exceptionsglobal_options.x_flag_exceptions)
4321 {
4322 tree c = fold_build2 (LT_EXPR, boolean_type_node, iterator,fold_build2_loc (((location_t) 0), LT_EXPR, global_trees[TI_BOOLEAN_TYPE
], iterator, nelts )
4323 nelts)fold_build2_loc (((location_t) 0), LT_EXPR, global_trees[TI_BOOLEAN_TYPE
], iterator, nelts )
;
4324 c = build3 (COND_EXPR, void_type_nodeglobal_trees[TI_VOID_TYPE], c,
4325 throw_bad_array_new_length (), void_nodeglobal_trees[TI_VOID]);
4326 finish_expr_stmt (c);
4327 }
4328 /* Don't check an array new when -fno-exceptions. */
4329 }
4330 else if (sanitize_flags_p (SANITIZE_BOUNDS)
4331 && current_function_decl != NULL_TREE(tree) __null)
4332 {
4333 /* Make sure the last element of the initializer is in bounds. */
4334 finish_expr_stmt
4335 (ubsan_instrument_bounds
4336 (input_location, obase, &nelts, /*ignore_off_by_one*/false));
4337 }
4338}
4339
4340/* walk_tree callback to collect temporaries in an expression. */
4341
4342tree
4343find_temps_r (tree *tp, int *walk_subtrees, void *data)
4344{
4345 vec<tree*> &temps = *static_cast<auto_vec<tree*> *>(data);
4346 tree t = *tp;
4347 if (TREE_CODE (t)((enum tree_code) (t)->base.code) == TARGET_EXPR
4348 && !TARGET_EXPR_ELIDING_P (t)((tree_not_check2 (((tree_check ((t), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4348, __FUNCTION__, (TARGET_EXPR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4348, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_3)
)
4349 temps.safe_push (tp);
4350 else if (TYPE_P (t)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code
) (t)->base.code))] == tcc_type)
)
4351 *walk_subtrees = 0;
4352
4353 return NULL_TREE(tree) __null;
4354}
4355
4356/* walk_tree callback to collect temporaries in an expression that
4357 are allocator arguments to standard library classes. */
4358
4359static tree
4360find_allocator_temps_r (tree *tp, int *walk_subtrees, void *data)
4361{
4362 vec<tree*> &temps = *static_cast<auto_vec<tree*> *>(data);
4363 tree t = *tp;
4364 if (TYPE_P (t)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code
) (t)->base.code))] == tcc_type)
)
4365 {
4366 *walk_subtrees = 0;
4367 return NULL_TREE(tree) __null;
4368 }
4369
4370 /* If this is a call to a constructor for a std:: class, look for
4371 a reference-to-allocator argument. */
4372 tree fn = cp_get_callee_fndecl_nofold (t);
4373 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4373, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4373, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
4374 && decl_in_std_namespace_p (TYPE_NAME (DECL_CONTEXT (fn))((tree_class_check ((((contains_struct_check ((fn), (TS_DECL_MINIMAL
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4374, __FUNCTION__))->decl_minimal.context)), (tcc_type)
, "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4374, __FUNCTION__))->type_common.name)
))
4375 {
4376 int nargs = call_expr_nargs (t)(((int)((unsigned long) (*tree_int_cst_elt_check (((tree_class_check
((t), (tcc_vl_exp), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4376, __FUNCTION__))->exp.operands[0]), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4376, __FUNCTION__)))) - 3)
;
4377 for (int i = 1; i < nargs; ++i)
4378 {
4379 tree arg = get_nth_callarg (t, i);
4380 tree atype = TREE_TYPE (arg)((contains_struct_check ((arg), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4380, __FUNCTION__))->typed.type)
;
4381 if (TREE_CODE (atype)((enum tree_code) (atype)->base.code) == REFERENCE_TYPE
4382 && is_std_allocator (TREE_TYPE (atype)((contains_struct_check ((atype), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4382, __FUNCTION__))->typed.type)
))
4383 {
4384 STRIP_NOPS (arg)(arg) = tree_strip_nop_conversions ((const_cast<union tree_node
*> (((arg)))))
;
4385 if (TREE_CODE (arg)((enum tree_code) (arg)->base.code) == ADDR_EXPR)
4386 {
4387 tree *ap = &TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4387, __FUNCTION__)))))
;
4388 if (TREE_CODE (*ap)((enum tree_code) (*ap)->base.code) == TARGET_EXPR)
4389 temps.safe_push (ap);
4390 }
4391 }
4392 }
4393 }
4394
4395 return NULL_TREE(tree) __null;
4396}
4397
4398/* If INIT initializes a standard library class, and involves a temporary
4399 std::allocator<T>, use ALLOC_OBJ for all such temporaries.
4400
4401 Note that this can clobber the input to build_vec_init; no unsharing is
4402 done. To make this safe we use the TARGET_EXPR in all places rather than
4403 pulling out the TARGET_EXPR_SLOT.
4404
4405 Used by build_vec_init when initializing an array of e.g. strings to reuse
4406 the same temporary allocator for all of the strings. We can do this because
4407 std::allocator has no data and the standard library doesn't care about the
4408 address of allocator objects.
4409
4410 ??? Add an attribute to allow users to assert the same property for other
4411 classes, i.e. one object of the type is interchangeable with any other? */
4412
4413static void
4414combine_allocator_temps (tree &init, tree &alloc_obj)
4415{
4416 auto_vec<tree*> temps;
4417 cp_walk_tree_without_duplicates (&init, find_allocator_temps_r, &temps)walk_tree_without_duplicates_1 (&init, find_allocator_temps_r
, &temps, cp_walk_subtrees)
;
4418 for (tree *p : temps)
4419 {
4420 if (!alloc_obj)
4421 alloc_obj = *p;
4422 else
4423 *p = alloc_obj;
4424 }
4425}
4426
4427/* `build_vec_init' returns tree structure that performs
4428 initialization of a vector of aggregate types.
4429
4430 BASE is a reference to the vector, of ARRAY_TYPE, or a pointer
4431 to the first element, of POINTER_TYPE.
4432 MAXINDEX is the maximum index of the array (one less than the
4433 number of elements). It is only used if BASE is a pointer or
4434 TYPE_DOMAIN (TREE_TYPE (BASE)) == NULL_TREE.
4435
4436 INIT is the (possibly NULL) initializer.
4437
4438 If EXPLICIT_VALUE_INIT_P is true, then INIT must be NULL. All
4439 elements in the array are value-initialized.
4440
4441 FROM_ARRAY is 0 if we should init everything with INIT
4442 (i.e., every element initialized from INIT).
4443 FROM_ARRAY is 1 if we should index into INIT in parallel
4444 with initialization of DECL.
4445 FROM_ARRAY is 2 if we should index into INIT in parallel,
4446 but use assignment instead of initialization. */
4447
4448tree
4449build_vec_init (tree base, tree maxindex, tree init,
4450 bool explicit_value_init_p,
4451 int from_array,
4452 tsubst_flags_t complain,
4453 vec<tree, va_gc>** cleanup_flags /* = nullptr */)
4454{
4455 tree rval;
4456 tree base2 = NULL_TREE(tree) __null;
4457 tree itype = NULL_TREE(tree) __null;
4458 tree iterator;
4459 /* The type of BASE. */
4460 tree atype = TREE_TYPE (base)((contains_struct_check ((base), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4460, __FUNCTION__))->typed.type)
;
4461 /* The type of an element in the array. */
4462 tree type = TREE_TYPE (atype)((contains_struct_check ((atype), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4462, __FUNCTION__))->typed.type)
;
4463 /* The element type reached after removing all outer array
4464 types. */
4465 tree inner_elt_type;
4466 /* The type of a pointer to an element in the array. */
4467 tree ptype;
4468 tree stmt_expr;
4469 tree compound_stmt;
4470 int destroy_temps;
4471 HOST_WIDE_INTlong num_initialized_elts = 0;
4472 bool is_global;
4473 tree obase = base;
4474 bool xvalue = false;
4475 bool errors = false;
4476 location_t loc = (init ? cp_expr_loc_or_input_loc (init)
4477 : location_of (base));
4478
4479 if (TREE_CODE (atype)((enum tree_code) (atype)->base.code) == ARRAY_TYPE && TYPE_DOMAIN (atype)((tree_check ((atype), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4479, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
)
)
4480 maxindex = array_type_nelts (atype);
4481
4482 if (maxindex == NULL_TREE(tree) __null || maxindex == error_mark_nodeglobal_trees[TI_ERROR_MARK])
4483 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
4484
4485 maxindex = maybe_constant_value (maxindex);
4486 if (explicit_value_init_p)
4487 gcc_assert (!init)((void)(!(!init) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4487, __FUNCTION__), 0 : 0))
;
4488
4489 inner_elt_type = strip_array_types (type);
4490
4491 /* Look through the TARGET_EXPR around a compound literal. */
4492 if (init && TREE_CODE (init)((enum tree_code) (init)->base.code) == TARGET_EXPR
4493 && TREE_CODE (TARGET_EXPR_INITIAL (init))((enum tree_code) ((*(tree_operand_check_code ((init), (TARGET_EXPR
), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4493, __FUNCTION__))))->base.code)
== CONSTRUCTOR
4494 && from_array != 2)
4495 init = TARGET_EXPR_INITIAL (init)(*(tree_operand_check_code ((init), (TARGET_EXPR), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4495, __FUNCTION__)))
;
4496
4497 if (tree vi = get_vec_init_expr (init))
4498 init = VEC_INIT_EXPR_INIT (vi)(*((const_cast<tree*> (tree_operand_check (((tree_check
((vi), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4498, __FUNCTION__, (VEC_INIT_EXPR)))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4498, __FUNCTION__)))))
;
4499
4500 bool direct_init = false;
4501 if (from_array && init && BRACE_ENCLOSED_INITIALIZER_P (init)(((enum tree_code) (init)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((init), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4501, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
4502 && CONSTRUCTOR_NELTS (init)(vec_safe_length (((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4502, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
== 1)
4503 {
4504 tree elt = CONSTRUCTOR_ELT (init, 0)(&(*((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4504, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
0])
->value;
4505 if (TREE_CODE (TREE_TYPE (elt))((enum tree_code) (((contains_struct_check ((elt), (TS_TYPED)
, "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4505, __FUNCTION__))->typed.type))->base.code)
== ARRAY_TYPE
4506 && TREE_CODE (elt)((enum tree_code) (elt)->base.code) != VEC_INIT_EXPR)
4507 {
4508 direct_init = DIRECT_LIST_INIT_P (init)((((enum tree_code) (init)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((init), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4508, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
]) && (((tree_not_check2 (((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4508, __FUNCTION__, (CONSTRUCTOR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4508, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0)))
;
4509 init = elt;
4510 }
4511 }
4512
4513 /* from_array doesn't apply to initialization from CONSTRUCTOR. */
4514 if (init && TREE_CODE (init)((enum tree_code) (init)->base.code) == CONSTRUCTOR)
4515 from_array = 0;
4516
4517 /* If we have a braced-init-list or string constant, make sure that the array
4518 is big enough for all the initializers. */
4519 bool length_check = (init
4520 && (TREE_CODE (init)((enum tree_code) (init)->base.code) == STRING_CST
4521 || (TREE_CODE (init)((enum tree_code) (init)->base.code) == CONSTRUCTOR
4522 && CONSTRUCTOR_NELTS (init)(vec_safe_length (((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4522, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
> 0))
4523 && !TREE_CONSTANT (maxindex)((non_type_check ((maxindex), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4523, __FUNCTION__))->base.constant_flag)
);
4524
4525 if (init
4526 && TREE_CODE (atype)((enum tree_code) (atype)->base.code) == ARRAY_TYPE
4527 && TREE_CONSTANT (maxindex)((non_type_check ((maxindex), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4527, __FUNCTION__))->base.constant_flag)
4528 && !vla_type_p (type)
4529 && (from_array == 2
4530 ? vec_copy_assign_is_trivial (inner_elt_type, init)
4531 : !TYPE_NEEDS_CONSTRUCTING (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4531, __FUNCTION__))->type_common.needs_constructing_flag
)
)
4532 && ((TREE_CODE (init)((enum tree_code) (init)->base.code) == CONSTRUCTOR
4533 && (BRACE_ENCLOSED_INITIALIZER_P (init)(((enum tree_code) (init)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((init), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4533, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
4534 || (same_type_ignoring_top_level_qualifiers_p
4535 (atype, TREE_TYPE (init)((contains_struct_check ((init), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4535, __FUNCTION__))->typed.type)
)))
4536 /* Don't do this if the CONSTRUCTOR might contain something
4537 that might throw and require us to clean up. */
4538 && (vec_safe_is_empty (CONSTRUCTOR_ELTS (init)((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4538, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
)
4539 || ! TYPE_HAS_NONTRIVIAL_DESTRUCTOR (inner_elt_type)(((tree_class_check ((inner_elt_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4539, __FUNCTION__))->type_common.lang_flag_4))
))
4540 || from_array))
4541 {
4542 /* Do non-default initialization of trivial arrays resulting from
4543 brace-enclosed initializers. In this case, digest_init and
4544 store_constructor will handle the semantics for us. */
4545
4546 if (BRACE_ENCLOSED_INITIALIZER_P (init)(((enum tree_code) (init)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((init), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4546, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
)
4547 init = digest_init (atype, init, complain);
4548 stmt_expr = cp_build_init_expr (base, init);
4549 return stmt_expr;
4550 }
4551
4552 maxindex = cp_convert (ptrdiff_type_nodeglobal_trees[TI_PTRDIFF_TYPE], maxindex, complain);
4553 maxindex = fold_simple (maxindex);
4554
4555 if (TREE_CODE (atype)((enum tree_code) (atype)->base.code) == ARRAY_TYPE)
4556 {
4557 ptype = build_pointer_type (type);
4558 base = decay_conversion (base, complain);
4559 if (base == error_mark_nodeglobal_trees[TI_ERROR_MARK])
4560 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
4561 base = cp_convert (ptype, base, complain);
4562 }
4563 else
4564 ptype = atype;
4565
4566 if (integer_all_onesp (maxindex))
4567 {
4568 /* Shortcut zero element case to avoid unneeded constructor synthesis. */
4569 if (init && TREE_SIDE_EFFECTS (init)((non_type_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4569, __FUNCTION__))->base.side_effects_flag)
)
4570 base = build2 (COMPOUND_EXPR, ptype, init, base);
4571 return base;
4572 }
4573
4574 /* The code we are generating looks like:
4575 ({
4576 T* t1 = (T*) base;
4577 T* rval = t1;
4578 ptrdiff_t iterator = maxindex;
4579 try {
4580 for (; iterator != -1; --iterator) {
4581 ... initialize *t1 ...
4582 ++t1;
4583 }
4584 } catch (...) {
4585 ... destroy elements that were constructed ...
4586 }
4587 rval;
4588 })
4589
4590 We can omit the try and catch blocks if we know that the
4591 initialization will never throw an exception, or if the array
4592 elements do not have destructors. We can omit the loop completely if
4593 the elements of the array do not have constructors.
4594
4595 We actually wrap the entire body of the above in a STMT_EXPR, for
4596 tidiness.
4597
4598 When copying from array to another, when the array elements have
4599 only trivial copy constructors, we should use __builtin_memcpy
4600 rather than generating a loop. That way, we could take advantage
4601 of whatever cleverness the back end has for dealing with copies
4602 of blocks of memory. */
4603
4604 is_global = begin_init_stmts (&stmt_expr, &compound_stmt);
4605 destroy_temps = stmts_are_full_exprs_p ();
4606 current_stmt_tree ()->stmts_are_full_exprs_p = 0;
4607 rval = get_temp_regvar (ptype, base);
4608 base = get_temp_regvar (ptype, rval);
4609 tree iterator_targ = get_target_expr (maxindex);
4610 add_stmt (iterator_targ);
4611 iterator = TARGET_EXPR_SLOT (iterator_targ)(*(tree_operand_check_code ((iterator_targ), (TARGET_EXPR), (
0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4611, __FUNCTION__)))
;
4612
4613 /* If initializing one array from another, initialize element by
4614 element. We rely upon the below calls to do the argument
4615 checking. Evaluate the initializer before entering the try block. */
4616 if (from_array)
4617 {
4618 if (lvalue_kind (init) & clk_rvalueref)
4619 xvalue = true;
4620 base2 = decay_conversion (init, complain);
4621 if (base2 == error_mark_nodeglobal_trees[TI_ERROR_MARK])
4622 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
4623 itype = TREE_TYPE (base2)((contains_struct_check ((base2), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4623, __FUNCTION__))->typed.type)
;
4624 base2 = get_temp_regvar (itype, base2);
4625 itype = TREE_TYPE (itype)((contains_struct_check ((itype), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4625, __FUNCTION__))->typed.type)
;
4626 }
4627
4628 /* Protect the entire array initialization so that we can destroy
4629 the partially constructed array if an exception is thrown.
4630 But don't do this if we're assigning. */
4631 if (flag_exceptionsglobal_options.x_flag_exceptions && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)(((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4631, __FUNCTION__))->type_common.lang_flag_4))
4632 && from_array != 2)
4633 {
4634 tree e;
4635 tree m = cp_build_binary_op (input_location,
4636 MINUS_EXPR, maxindex, iterator,
4637 complain);
4638
4639 /* Flatten multi-dimensional array since build_vec_delete only
4640 expects one-dimensional array. */
4641 if (TREE_CODE (type)((enum tree_code) (type)->base.code) == ARRAY_TYPE)
4642 m = cp_build_binary_op (input_location,
4643 MULT_EXPR, m,
4644 /* Avoid mixing signed and unsigned. */
4645 convert (TREE_TYPE (m)((contains_struct_check ((m), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4645, __FUNCTION__))->typed.type)
,
4646 array_type_nelts_total (type)),
4647 complain);
4648
4649 e = build_vec_delete_1 (input_location, rval, m,
4650 inner_elt_type, sfk_complete_destructor,
4651 /*use_global_delete=*/0, complain,
4652 /*in_cleanup*/true);
4653 if (e == error_mark_nodeglobal_trees[TI_ERROR_MARK])
4654 errors = true;
4655 TARGET_EXPR_CLEANUP (iterator_targ)(*(tree_operand_check_code ((iterator_targ), (TARGET_EXPR), (
2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4655, __FUNCTION__)))
= e;
4656 CLEANUP_EH_ONLY (iterator_targ)((iterator_targ)->base.static_flag) = true;
4657
4658 /* Since we push this cleanup before doing any initialization, cleanups
4659 for any temporaries in the initialization are naturally within our
4660 cleanup region, so we don't want wrap_temporary_cleanups to do
4661 anything for arrays. But if the array is a subobject, we need to
4662 tell split_nonconstant_init how to turn off this cleanup in favor of
4663 the cleanup for the complete object. */
4664 if (cleanup_flags)
4665 vec_safe_push (*cleanup_flags, build_tree_list (iterator, maxindex));
4666 }
4667
4668 /* Should we try to create a constant initializer? */
4669 bool try_const = (TREE_CODE (atype)((enum tree_code) (atype)->base.code) == ARRAY_TYPE
4670 && TREE_CONSTANT (maxindex)((non_type_check ((maxindex), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4670, __FUNCTION__))->base.constant_flag)
4671 && (init ? TREE_CODE (init)((enum tree_code) (init)->base.code) == CONSTRUCTOR
4672 : (type_has_constexpr_default_constructor
4673 (inner_elt_type)))
4674 && (literal_type_p (inner_elt_type)
4675 || TYPE_HAS_CONSTEXPR_CTOR (inner_elt_type)((((tree_class_check ((inner_elt_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4675, __FUNCTION__))->type_with_lang_specific.lang_specific
))->has_constexpr_ctor)
));
4676 vec<constructor_elt, va_gc> *const_vec = NULL__null;
4677 bool saw_non_const = false;
4678 /* If we're initializing a static array, we want to do static
4679 initialization of any elements with constant initializers even if
4680 some are non-constant. */
4681 bool do_static_init = (DECL_P (obase)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code
) (obase)->base.code))] == tcc_declaration)
&& TREE_STATIC (obase)((obase)->base.static_flag));
4682
4683 bool empty_list = false;
4684 if (init && BRACE_ENCLOSED_INITIALIZER_P (init)(((enum tree_code) (init)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((init), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4684, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
4685 && CONSTRUCTOR_NELTS (init)(vec_safe_length (((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/init.cc"
, 4685, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
== 0)
4686