diff options
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r-- | gcc/cp/init.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 54a1dae..5538eeb 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -1756,7 +1756,8 @@ build_aggr_init (tree exp, tree init, int flags, tsubst_flags_t complain) { from_array = 1; init = mark_rvalue_use (init); - if (init && DECL_P (init) + if (init + && DECL_P (tree_strip_any_location_wrapper (init)) && !(flags & LOOKUP_ONLYCONVERTING)) { /* Wrap the initializer in a CONSTRUCTOR so that build_vec_init @@ -2604,6 +2605,7 @@ warn_placement_new_too_small (tree type, tree nelts, tree size, tree oper) Otherwise, use the size of the entire array as an optimistic estimate (this may lead to false negatives). */ tree adj = TREE_OPERAND (oper, 1); + adj = fold_for_warn (adj); if (CONSTANT_CLASS_P (adj)) adjust += wi::to_offset (convert (ssizetype, adj)); else @@ -2667,11 +2669,13 @@ warn_placement_new_too_small (tree type, tree nelts, tree size, tree oper) tree op0 = oper; while (TREE_CODE (op0 = TREE_OPERAND (op0, 0)) == COMPONENT_REF); + STRIP_ANY_LOCATION_WRAPPER (op0); if (VAR_P (op0)) var_decl = op0; oper = TREE_OPERAND (oper, 1); } + STRIP_ANY_LOCATION_WRAPPER (oper); tree opertype = TREE_TYPE (oper); if ((addr_expr || !INDIRECT_TYPE_P (opertype)) && (VAR_P (oper) @@ -2762,6 +2766,9 @@ warn_placement_new_too_small (tree type, tree nelts, tree size, tree oper) others. */ offset_int bytes_need; + if (nelts) + nelts = fold_for_warn (nelts); + if (CONSTANT_CLASS_P (size)) bytes_need = wi::to_offset (size); else if (nelts && CONSTANT_CLASS_P (nelts)) |