trans.c (emit_range_check): Assert that the range type is a numerical type and remove useless local variables.
* gcc-interface/trans.c (emit_range_check): Assert that the range type is a numerical type and remove useless local variables. From-SVN: r196500
This commit is contained in:
parent
9772c47ab0
commit
b6ea6dbdc0
2 changed files with 16 additions and 7 deletions
|
@ -1,3 +1,8 @@
|
|||
2013-03-06 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* gcc-interface/trans.c (emit_range_check): Assert that the range type
|
||||
is a numerical type and remove useless local variables.
|
||||
|
||||
2013-02-25 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* gcc-interface/ada-tree.h: Back out change accidentally committed.
|
||||
|
@ -6,8 +11,7 @@
|
|||
|
||||
PR bootstrap/56258
|
||||
* gnat-style.texi (@title): Remove @hfill.
|
||||
* projects.texi: Avoid line wrapping inside of @pxref or
|
||||
@xref.
|
||||
* projects.texi: Avoid line wrapping inside of @pxref or @xref.
|
||||
|
||||
2013-02-14 Rainer Emrich <rainer@emrich-ebersheim.de>
|
||||
|
||||
|
|
|
@ -8119,8 +8119,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 +8126,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 +8149,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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue