diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-05-02 11:22:31 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-05-02 11:22:31 +0000 |
commit | 85d86b55bfb790e3079c4ab50b5eac3bff212bf0 (patch) | |
tree | 3260d223788c7f661eef298b55f74eb6033bc7f0 /gcc/varasm.c | |
parent | 8b3fb720f80336b39a0312ea95a79e7ab7fbcea3 (diff) | |
download | gcc-85d86b55bfb790e3079c4ab50b5eac3bff212bf0.tar.gz |
2012-05-02 Richard Guenther <rguenther@suse.de>
* tree.c (valid_constant_size_p): New function.
* tree.h (valid_constant_size_p): Declare.
* cfgexpand.c (expand_one_var): Adjust check for too large
variables by using valid_constant_size_p.
* varasm.c (assemble_variable): Likewise.
c/
* c-decl.c (grokdeclarator): Properly check for sizes that
cover more than half of the address-space.
cp/
* decl.c (grokdeclarator): Properly check for sizes that
cover more than half of the address-space.
2012-05-02 Richard Guenther <rguenther@suse.de>
* fold-const.c (div_if_zero_remainder): sizetypes no longer
sign-extend.
(int_const_binop_1): New worker for int_const_binop with
overflowable parameter. Pass it through
to force_fit_type_double.
(int_const_binop): Wrap around int_const_binop_1 with overflowable
equal to one.
(size_binop_loc): Call int_const_binop_1 with overflowable equal
to minus one, forcing overflow detection for even unsigned types.
(extract_muldiv_1): Remove bogus TYPE_IS_SIZETYPE special-casing.
(fold_binary_loc): Call try_move_mult_to_index with signed offset.
* stor-layout.c (initialize_sizetypes): sizetypes no longer
sign-extend.
(layout_type): For zero-sized arrays ignore overflow on the
size calculations.
* tree-ssa-ccp.c (bit_value_unop_1): Likewise.
(bit_value_binop_1): Likewise.
* tree.c (double_int_to_tree): Likewise.
(double_int_fits_to_tree_p): Likewise.
(force_fit_type_double): Likewise.
(host_integerp): Likewise.
(int_fits_type_p): Likewise.
* varasm.c (output_constructor_regular_field): Sign-extend the
field-offset to cater for negative offsets produced by the Ada frontend.
* omp-low.c (extract_omp_for_data): Convert the loop step to
signed for pointer adjustments.
* g++.dg/tree-ssa/pr19807.C: Adjust.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@187042 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r-- | gcc/varasm.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c index 03ac49b4677..ce9e3280364 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -1992,7 +1992,7 @@ assemble_variable (tree decl, int top_level ATTRIBUTE_UNUSED, return; if (! dont_output_data - && ! host_integerp (DECL_SIZE_UNIT (decl), 1)) + && ! valid_constant_size_p (DECL_SIZE_UNIT (decl))) { error ("size of variable %q+D is too large", decl); return; @@ -4773,9 +4773,13 @@ output_constructor_regular_field (oc_local_state *local) if (local->index != NULL_TREE) { + /* Perform the index calculation in modulo arithmetic but + sign-extend the result because Ada has negative DECL_FIELD_OFFSETs + but we are using an unsigned sizetype. */ + unsigned prec = TYPE_PRECISION (sizetype); double_int idx = double_int_sub (tree_to_double_int (local->index), tree_to_double_int (local->min_index)); - gcc_assert (double_int_fits_in_shwi_p (idx)); + idx = double_int_sext (idx, prec); fieldpos = (tree_low_cst (TYPE_SIZE_UNIT (TREE_TYPE (local->val)), 1) * idx.low); } |