This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: wide-int, ada
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Mike Stump <mikestump at comcast dot net>, Kenneth Zadeck <zadeck at naturalbridge dot com>
- Date: Tue, 13 May 2014 23:12:26 +0200
- Subject: Re: wide-int, ada
- Authentication-results: sourceware.org; auth=none
- References: <0075C6DB-B432-4E6F-8A48-3AE0C4D842FE at comcast dot net> <1464599 dot QpNUskFgRu at polaris>
> I don't think that the mechanical change in UI_From_gnu is correct, see the
> comment just above. The annotate_value change is very likely correct, but
> please double check and, upon positive outcome, remove the last sentence of
> the comment just above.
The annotate_value change was wrong, fixed thusly, applied on the mainline.
* gcc-interface/decl.c (annotate_value): Fix thinko in latest change.
--
Eric Botcazou
Index: gcc-interface/decl.c
===================================================================
--- gcc-interface/decl.c (revision 210350)
+++ gcc-interface/decl.c (working copy)
@@ -7515,15 +7515,16 @@ annotate_value (tree gnu_size)
case BIT_AND_EXPR:
tcode = Bit_And_Expr;
- /* For negative values, build NEGATE_EXPR of the opposite. Such values
- appear in expressions containing aligning patterns. Note that, since
- sizetype is unsigned, we have to jump through some hoops. */
+ /* For negative values in sizetype, build NEGATE_EXPR of the opposite.
+ Such values appear in expressions with aligning patterns. Note that,
+ since sizetype is unsigned, we have to jump through some hoops. */
if (TREE_CODE (TREE_OPERAND (gnu_size, 1)) == INTEGER_CST)
{
tree op1 = TREE_OPERAND (gnu_size, 1);
- if (wi::neg_p (op1))
+ wide_int signed_op1 = wi::sext (op1, TYPE_PRECISION (sizetype));
+ if (wi::neg_p (signed_op1))
{
- op1 = wide_int_to_tree (sizetype, wi::neg (op1));
+ op1 = wide_int_to_tree (sizetype, wi::neg (signed_op1));
pre_op1 = annotate_value (build1 (NEGATE_EXPR, sizetype, op1));
}
}