summaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2013-05-26 10:02:33 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2013-05-26 10:02:33 +0000
commit60acbc93d55713812ebcd2434d52c10a3b92de22 (patch)
treea6319d47db8c250fc694c234b661ad297e69d96d /gcc/ada/gcc-interface
parent081f18cfdb753e275e50fc7970586caf0191db23 (diff)
downloadgcc-60acbc93d55713812ebcd2434d52c10a3b92de22.tar.gz
* gcc-interface/trans.c (Attribute_to_gnu) <Attr_Last_Bit>: Add kludge
to avoid generating an overflow for -1. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@199339 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/gcc-interface')
-rw-r--r--gcc/ada/gcc-interface/trans.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index 13767e9dd9b..4b71568b8ba 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -2080,14 +2080,19 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
gnu_result = bitsize_int (bitpos % BITS_PER_UNIT);
gnu_result = size_binop (PLUS_EXPR, gnu_result,
TYPE_SIZE (TREE_TYPE (gnu_prefix)));
- gnu_result = size_binop (MINUS_EXPR, gnu_result,
- bitsize_one_node);
+ /* ??? Avoid a large unsigned result that will overflow when
+ converted to the signed universal_integer. */
+ if (integer_zerop (gnu_result))
+ gnu_result = integer_minus_one_node;
+ else
+ gnu_result
+ = size_binop (MINUS_EXPR, gnu_result, bitsize_one_node);
break;
case Attr_Bit_Position:
gnu_result = gnu_field_bitpos;
break;
- }
+ }
/* If this has a PLACEHOLDER_EXPR, qualify it by the object we are
handling. */