aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/class.c
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2009-07-16 22:29:52 +0000
committerManuel López-Ibáñez <manu@gcc.gnu.org>2009-07-16 22:29:52 +0000
commitdb3927fb49c9f13a0da61a75d771f51dc7c45b92 (patch)
treee4de0ffc0a0ca77f35b03bf9e8a248a4b5735f6a /gcc/cp/class.c
parentc32097d8b4fb21997c571cf6520431fa7d06090f (diff)
downloadgcc-db3927fb49c9f13a0da61a75d771f51dc7c45b92.zip
gcc-db3927fb49c9f13a0da61a75d771f51dc7c45b92.tar.gz
gcc-db3927fb49c9f13a0da61a75d771f51dc7c45b92.tar.bz2
re PR c/40435 (Revision 148442 caused many regressions on trunk)
2009-07-17 Aldy Hernandez <aldyh@redhat.com> Manuel López-Ibáñez <manu@gcc.gnu.org> PR 40435 * tree-complex.c, tree-loop-distribution.c, tree.c, tree.h, builtins.c, fold-const.c, omp-low.c, cgraphunit.c, tree-ssa-ccp.c, tree-ssa-dom.c, gimple-low.c, expr.c, tree-ssa-ifcombine.c, c-decl.c, stor-layout.c, tree-if-conv.c, c-typeck.c, gimplify.c, calls.c, tree-sra.c, tree-mudflap.c, tree-ssa-copy.c, tree-ssa-forwprop.c, c-convert.c, c-omp.c, varasm.c, tree-inline.c, c-common.c, c-common.h, gimple.c, tree-switch-conversion.c, gimple.h, tree-cfg.c, c-parser.c, convert.c: Add location argument to fold_{unary,binary,ternary}, fold_build[123], build_call_expr, build_size_arg, build_fold_addr_expr, build_call_array, non_lvalue, size_diffop, fold_build1_initializer, fold_build2_initializer, fold_build3_initializer, fold_build_call_array, fold_build_call_array_initializer, fold_single_bit_test, omit_one_operand, omit_two_operands, invert_truthvalue, fold_truth_not_expr, build_fold_indirect_ref, fold_indirect_ref, combine_comparisons, fold_builtin_*, fold_call_expr, build_range_check, maybe_fold_offset_to_address, round_up, round_down. objc/ * objc-act.c: Add location argument to all calls to build_fold_addr_expr. testsuite/ * gcc.dg/pr36902.c: Add column info. * g++.dg/gcov/gcov-2.C: Change count for definition. cp/ * typeck.c, init.c, class.c, method.c, rtti.c, except.c, error.c, tree.c, cp-gimplify.c, cxx-pretty-print.c, pt.c, semantics.c, call.c, cvt.c, mangle.c: Add location argument to fold_{unary,binary,ternary}, fold_build[123], build_call_expr, build_size_arg, build_fold_addr_expr, build_call_array, non_lvalue, size_diffop, fold_build1_initializer, fold_build2_initializer, fold_build3_initializer, fold_build_call_array, fold_build_call_array_initializer, fold_single_bit_test, omit_one_operand, omit_two_operands, invert_truthvalue, fold_truth_not_expr, build_fold_indirect_ref, fold_indirect_ref, combine_comparisons, fold_builtin_*, fold_call_expr, build_range_check, maybe_fold_offset_to_address, round_up, round_down. fortran/ * trans-expr.c, trans-array.c, trans-openmp.c, trans-stmt.c, trans.c, trans-io.c, trans-decl.c, trans-intrinsic.c: Add location argument to fold_{unary,binary,ternary}, fold_build[123], build_call_expr, build_size_arg, build_fold_addr_expr, build_call_array, non_lvalue, size_diffop, fold_build1_initializer, fold_build2_initializer, fold_build3_initializer, fold_build_call_array, fold_build_call_array_initializer, fold_single_bit_test, omit_one_operand, omit_two_operands, invert_truthvalue, fold_truth_not_expr, build_fold_indirect_ref, fold_indirect_ref, combine_comparisons, fold_builtin_*, fold_call_expr, build_range_check, maybe_fold_offset_to_address, round_up, round_down. Co-Authored-By: Manuel López-Ibáñez <manu@gcc.gnu.org> From-SVN: r149722
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r--gcc/cp/class.c61
1 files changed, 37 insertions, 24 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 373f457..9a76883 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -333,7 +333,7 @@ build_base_path (enum tree_code code,
if (null_test)
{
tree zero = cp_convert (TREE_TYPE (expr), integer_zero_node);
- null_test = fold_build2 (NE_EXPR, boolean_type_node,
+ null_test = fold_build2_loc (input_location, NE_EXPR, boolean_type_node,
expr, zero);
}
@@ -385,7 +385,7 @@ build_base_path (enum tree_code code,
TREE_CONSTANT (v_offset) = 1;
offset = convert_to_integer (ptrdiff_type_node,
- size_diffop (offset,
+ size_diffop_loc (input_location, offset,
BINFO_OFFSET (v_binfo)));
if (!integer_zerop (offset))
@@ -417,7 +417,7 @@ build_base_path (enum tree_code code,
{
offset = fold_convert (sizetype, offset);
if (code == MINUS_EXPR)
- offset = fold_build1 (NEGATE_EXPR, sizetype, offset);
+ offset = fold_build1_loc (input_location, NEGATE_EXPR, sizetype, offset);
expr = build2 (POINTER_PLUS_EXPR, ptr_target_type, expr, offset);
}
else
@@ -428,8 +428,8 @@ build_base_path (enum tree_code code,
out:
if (null_test)
- expr = fold_build3 (COND_EXPR, target_type, null_test, expr,
- fold_build1 (NOP_EXPR, target_type,
+ expr = fold_build3_loc (input_location, COND_EXPR, target_type, null_test, expr,
+ fold_build1_loc (input_location, NOP_EXPR, target_type,
integer_zero_node));
return expr;
@@ -553,10 +553,11 @@ convert_to_base_statically (tree expr, tree base)
expr = cp_build_unary_op (ADDR_EXPR, expr, /*noconvert=*/1,
tf_warning_or_error);
if (!integer_zerop (BINFO_OFFSET (base)))
- expr = fold_build2 (POINTER_PLUS_EXPR, pointer_type, expr,
+ expr = fold_build2_loc (input_location,
+ POINTER_PLUS_EXPR, pointer_type, expr,
fold_convert (sizetype, BINFO_OFFSET (base)));
expr = fold_convert (build_pointer_type (BINFO_TYPE (base)), expr);
- expr = build_fold_indirect_ref (expr);
+ expr = build_fold_indirect_ref_loc (input_location, expr);
}
return expr;
@@ -1396,7 +1397,8 @@ determine_primary_bases (tree t)
/* A virtual binfo might have been copied from within
another hierarchy. As we're about to use it as a
primary base, make sure the offsets match. */
- delta = size_diffop (convert (ssizetype,
+ delta = size_diffop_loc (input_location,
+ convert (ssizetype,
BINFO_OFFSET (base_binfo)),
convert (ssizetype,
BINFO_OFFSET (this_primary)));
@@ -1459,7 +1461,7 @@ determine_primary_bases (tree t)
/* A virtual binfo might have been copied from within
another hierarchy. As we're about to use it as a primary
base, make sure the offsets match. */
- delta = size_diffop (ssize_int (0),
+ delta = size_diffop_loc (input_location, ssize_int (0),
convert (ssizetype, BINFO_OFFSET (primary)));
propagate_binfo_offsets (primary, delta);
@@ -2162,9 +2164,10 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
{
/* We convert via virtual base. Adjust the fixed
offset to be from there. */
- offset = size_diffop
- (offset, convert
- (ssizetype, BINFO_OFFSET (virtual_offset)));
+ offset =
+ size_diffop (offset,
+ convert (ssizetype,
+ BINFO_OFFSET (virtual_offset)));
}
if (fixed_offset)
/* There was an existing fixed offset, this must be
@@ -2247,7 +2250,8 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
if (virtual_base)
/* The `this' pointer needs to be adjusted from the declaration to
the nearest virtual base. */
- delta = size_diffop (convert (ssizetype, BINFO_OFFSET (virtual_base)),
+ delta = size_diffop_loc (input_location,
+ convert (ssizetype, BINFO_OFFSET (virtual_base)),
convert (ssizetype, BINFO_OFFSET (first_defn)));
else if (lost)
/* If the nearest definition is in a lost primary, we don't need an
@@ -2260,7 +2264,8 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
BINFO to pointing at the base where the final overrider
appears. */
virtual_covariant:
- delta = size_diffop (convert (ssizetype,
+ delta = size_diffop_loc (input_location,
+ convert (ssizetype,
BINFO_OFFSET (TREE_VALUE (overrider))),
convert (ssizetype, BINFO_OFFSET (binfo)));
@@ -3574,7 +3579,8 @@ layout_nonempty_base_or_field (record_layout_info rli,
hierarchy. Therefore, we may not need to add the entire
OFFSET. */
propagate_binfo_offsets (binfo,
- size_diffop (convert (ssizetype, offset),
+ size_diffop_loc (input_location,
+ convert (ssizetype, offset),
convert (ssizetype,
BINFO_OFFSET (binfo))));
}
@@ -3611,7 +3617,8 @@ layout_empty_base (record_layout_info rli, tree binfo,
{
if (abi_version_at_least (2))
propagate_binfo_offsets
- (binfo, size_diffop (size_zero_node, BINFO_OFFSET (binfo)));
+ (binfo, size_diffop_loc (input_location,
+ size_zero_node, BINFO_OFFSET (binfo)));
else
warning (OPT_Wabi,
"offset of empty base %qT may not be ABI-compliant and may"
@@ -3717,7 +3724,8 @@ build_base_field (record_layout_info rli, tree binfo,
/* On some platforms (ARM), even empty classes will not be
byte-aligned. */
- eoc = round_up (rli_size_unit_so_far (rli),
+ eoc = round_up_loc (input_location,
+ rli_size_unit_so_far (rli),
CLASSTYPE_ALIGN_UNIT (basetype));
atend = layout_empty_base (rli, binfo, eoc, offsets);
/* A nearly-empty class "has no proper base class that is empty,
@@ -4637,7 +4645,8 @@ layout_virtual_bases (record_layout_info rli, splay_tree offsets)
&& first_vbase
&& (tree_int_cst_lt
(size_binop (CEIL_DIV_EXPR,
- round_up (CLASSTYPE_SIZE (t),
+ round_up_loc (input_location,
+ CLASSTYPE_SIZE (t),
CLASSTYPE_ALIGN (basetype)),
bitsize_unit_node),
BINFO_OFFSET (vbase))))
@@ -5070,7 +5079,7 @@ layout_class_type (tree t, tree *virtuals_p)
/* Make sure that we are on a byte boundary so that the size of
the class without virtual bases will always be a round number
of bytes. */
- rli->bitpos = round_up (rli->bitpos, BITS_PER_UNIT);
+ rli->bitpos = round_up_loc (input_location, rli->bitpos, BITS_PER_UNIT);
normalize_rli (rli);
}
@@ -7765,11 +7774,12 @@ build_vbase_offset_vtbl_entries (tree binfo, vtbl_init_data* vid)
The vbase offsets go in reverse inheritance-graph order, and
we are walking in inheritance graph order so these end up in
the right order. */
- delta = size_diffop (BINFO_OFFSET (b), BINFO_OFFSET (non_primary_binfo));
+ delta = size_diffop_loc (input_location,
+ BINFO_OFFSET (b), BINFO_OFFSET (non_primary_binfo));
*vid->last_init
= build_tree_list (NULL_TREE,
- fold_build1 (NOP_EXPR,
+ fold_build1_loc (input_location, NOP_EXPR,
vtable_entry_type,
delta));
vid->last_init = &TREE_CHAIN (*vid->last_init);
@@ -7999,9 +8009,11 @@ add_vcall_offset (tree orig_fn, tree binfo, vtbl_init_data *vid)
vid->binfo. But it might be a lost primary, so its
BINFO_OFFSET might be wrong, so we just use the
BINFO_OFFSET from vid->binfo. */
- vcall_offset = size_diffop (BINFO_OFFSET (base),
+ vcall_offset = size_diffop_loc (input_location,
+ BINFO_OFFSET (base),
BINFO_OFFSET (vid->binfo));
- vcall_offset = fold_build1 (NOP_EXPR, vtable_entry_type,
+ vcall_offset = fold_build1_loc (input_location,
+ NOP_EXPR, vtable_entry_type,
vcall_offset);
}
/* Add the initializer to the vtable. */
@@ -8040,7 +8052,8 @@ build_rtti_vtbl_entries (tree binfo, vtbl_init_data* vid)
&& BINFO_INHERITANCE_CHAIN (primary_base) == b);
b = primary_base;
}
- offset = size_diffop (BINFO_OFFSET (vid->rtti_binfo), BINFO_OFFSET (b));
+ offset = size_diffop_loc (input_location,
+ BINFO_OFFSET (vid->rtti_binfo), BINFO_OFFSET (b));
/* The second entry is the address of the typeinfo object. */
if (flag_rtti)