Commit da49a783 by Eric Botcazou Committed by Eric Botcazou

trans.c (gnat_to_gnu): Set the source location of the operator on both branches…

trans.c (gnat_to_gnu): Set the source location of the operator on both branches of the test in the...

	* gcc-interface/trans.c (gnat_to_gnu) <N_In>: Set the source location
	of the operator on both branches of the test in the generic case.

From-SVN: r154677
parent a61f9cc0
2009-11-26 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/trans.c (gnat_to_gnu) <N_In>: Set the source location
of the operator on both branches of the test in the generic case.
2009-11-25 Eric Botcazou <ebotcazou@adacore.com> 2009-11-25 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/trans.c (unchecked_conversion_lhs_nop): Rename into... * gcc-interface/trans.c (unchecked_conversion_lhs_nop): Rename into...
......
...@@ -4196,13 +4196,12 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -4196,13 +4196,12 @@ gnat_to_gnu (Node_Id gnat_node)
case N_In: case N_In:
case N_Not_In: case N_Not_In:
{ {
tree gnu_object = gnat_to_gnu (Left_Opnd (gnat_node)); tree gnu_obj = gnat_to_gnu (Left_Opnd (gnat_node));
Node_Id gnat_range = Right_Opnd (gnat_node); Node_Id gnat_range = Right_Opnd (gnat_node);
tree gnu_low; tree gnu_low, gnu_high;
tree gnu_high;
/* GNAT_RANGE is either an N_Range node or an identifier /* GNAT_RANGE is either an N_Range node or an identifier denoting a
denoting a subtype. */ subtype. */
if (Nkind (gnat_range) == N_Range) if (Nkind (gnat_range) == N_Range)
{ {
gnu_low = gnat_to_gnu (Low_Bound (gnat_range)); gnu_low = gnat_to_gnu (Low_Bound (gnat_range));
...@@ -4221,21 +4220,24 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -4221,21 +4220,24 @@ gnat_to_gnu (Node_Id gnat_node)
gnu_result_type = get_unpadded_type (Etype (gnat_node)); gnu_result_type = get_unpadded_type (Etype (gnat_node));
/* If LOW and HIGH are identical, perform an equality test. /* If LOW and HIGH are identical, perform an equality test. Otherwise,
Otherwise, ensure that GNU_OBJECT is only evaluated once ensure that GNU_OBJ is evaluated only once and perform a full range
and perform a full range test. */ test. */
if (operand_equal_p (gnu_low, gnu_high, 0)) if (operand_equal_p (gnu_low, gnu_high, 0))
gnu_result = build_binary_op (EQ_EXPR, gnu_result_type, gnu_result
gnu_object, gnu_low); = build_binary_op (EQ_EXPR, gnu_result_type, gnu_obj, gnu_low);
else else
{ {
gnu_object = protect_multiple_eval (gnu_object); tree t1, t2;
gnu_obj = protect_multiple_eval (gnu_obj);
t1 = build_binary_op (GE_EXPR, gnu_result_type, gnu_obj, gnu_low);
if (EXPR_P (t1))
set_expr_location_from_node (t1, gnat_node);
t2 = build_binary_op (LE_EXPR, gnu_result_type, gnu_obj, gnu_high);
if (EXPR_P (t2))
set_expr_location_from_node (t2, gnat_node);
gnu_result gnu_result
= build_binary_op (TRUTH_ANDIF_EXPR, gnu_result_type, = build_binary_op (TRUTH_ANDIF_EXPR, gnu_result_type, t1, t2);
build_binary_op (GE_EXPR, gnu_result_type,
gnu_object, gnu_low),
build_binary_op (LE_EXPR, gnu_result_type,
gnu_object, gnu_high));
} }
if (kind == N_Not_In) if (kind == N_Not_In)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment