diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-03-09 13:48:05 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-03-09 13:48:05 +0000 |
commit | 2838513a2cbe3dabed7f5e5e229099de9618833d (patch) | |
tree | c6c4257bc6daf8e297d1d5763c98b90120605f30 /gcc/ada/gcc-interface/trans.c | |
parent | 39b6232eee3cf86162d5a58982017499e0f815eb (diff) | |
download | gcc-2838513a2cbe3dabed7f5e5e229099de9618833d.tar.gz |
2013-03-09 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 196572 using svnmerge.py
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@196574 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/gcc-interface/trans.c')
-rw-r--r-- | gcc/ada/gcc-interface/trans.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 1d25b0f94a1..39e455b83ea 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -2066,13 +2066,8 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) break; default: - /* Say we have an unimplemented attribute. Then set the value to be - returned to be a zero and hope that's something we can convert to - the type of this attribute. */ - post_error ("unimplemented attribute", gnat_node); - gnu_result_type = get_unpadded_type (Etype (gnat_node)); - gnu_result = integer_zero_node; - break; + /* This abort means that we have an unimplemented attribute. */ + gcc_unreachable (); } /* If this is an attribute where the prefix was unused, force a use of it if @@ -4944,7 +4939,7 @@ Raise_Error_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) { rci->low_bound = gnu_low_bound; rci->high_bound = gnu_high_bound; - rci->type = gnat_to_gnu_type (gnat_type); + rci->type = get_unpadded_type (gnat_type); rci->invariant_cond = build1 (SAVE_EXPR, boolean_type_node, boolean_true_node); gnu_cond = build_binary_op (TRUTH_ANDIF_EXPR, @@ -8119,8 +8114,6 @@ static tree emit_range_check (tree gnu_expr, Entity_Id gnat_range_type, Node_Id gnat_node) { tree gnu_range_type = get_unpadded_type (gnat_range_type); - tree gnu_low = TYPE_MIN_VALUE (gnu_range_type); - tree gnu_high = TYPE_MAX_VALUE (gnu_range_type); tree gnu_compare_type = get_base_type (TREE_TYPE (gnu_expr)); /* If GNU_EXPR has GNAT_RANGE_TYPE as its base type, no check is needed. @@ -8128,6 +8121,10 @@ emit_range_check (tree gnu_expr, Entity_Id gnat_range_type, Node_Id gnat_node) if (gnu_compare_type == gnu_range_type) return gnu_expr; + /* Range checks can only be applied to types with ranges. */ + gcc_assert (INTEGRAL_TYPE_P (gnu_range_type) + || SCALAR_FLOAT_TYPE_P (gnu_range_type)); + /* If GNU_EXPR has an integral type that is narrower than GNU_RANGE_TYPE, we can't do anything since we might be truncating the bounds. No check is needed in this case. */ @@ -8147,13 +8144,16 @@ emit_range_check (tree gnu_expr, Entity_Id gnat_range_type, Node_Id gnat_node) (build_binary_op (TRUTH_ORIF_EXPR, boolean_type_node, invert_truthvalue (build_binary_op (GE_EXPR, boolean_type_node, - convert (gnu_compare_type, gnu_expr), - convert (gnu_compare_type, gnu_low))), + convert (gnu_compare_type, gnu_expr), + convert (gnu_compare_type, + TYPE_MIN_VALUE + (gnu_range_type)))), invert_truthvalue (build_binary_op (LE_EXPR, boolean_type_node, convert (gnu_compare_type, gnu_expr), convert (gnu_compare_type, - gnu_high)))), + TYPE_MAX_VALUE + (gnu_range_type))))), gnu_expr, CE_Range_Check_Failed, gnat_node); } |