Commit b693daa7 by Eric Botcazou Committed by Eric Botcazou

re PR ada/26797 (ACATS cxh1001 fails)

	PR ada/26797
	PR ada/32407
	* utils.c (unchecked_convert): Use a subtype as the intermediate type
	in the special VIEW_CONVERT_EXPR case.

From-SVN: r128441
parent 94dabea7
2007-09-12 Eric Botcazou <ebotcazou@adacore.com>
PR ada/26797
PR ada/32407
* utils.c (unchecked_convert): Use a subtype as the intermediate type
in the special VIEW_CONVERT_EXPR case.
2007-09-12 Robert Dewar <dewar@adacore.com> 2007-09-12 Robert Dewar <dewar@adacore.com>
* types.ads, a-charac.ads, freeze.adb: Minor reformatting. * types.ads, a-charac.ads, freeze.adb: Minor reformatting.
...@@ -3808,7 +3808,7 @@ unchecked_convert (tree type, tree expr, bool notrunc_p) ...@@ -3808,7 +3808,7 @@ unchecked_convert (tree type, tree expr, bool notrunc_p)
TYPE_MAIN_VARIANT (rtype) = rtype; TYPE_MAIN_VARIANT (rtype) = rtype;
} }
/* We have another special case. If we are unchecked converting subtype /* We have another special case: if we are unchecked converting subtype
into a base type, we need to ensure that VRP doesn't propagate range into a base type, we need to ensure that VRP doesn't propagate range
information since this conversion may be done precisely to validate information since this conversion may be done precisely to validate
that the object is within the range it is supposed to have. */ that the object is within the range it is supposed to have. */
...@@ -3818,21 +3818,18 @@ unchecked_convert (tree type, tree expr, bool notrunc_p) ...@@ -3818,21 +3818,18 @@ unchecked_convert (tree type, tree expr, bool notrunc_p)
|| TREE_CODE (etype) == ENUMERAL_TYPE || TREE_CODE (etype) == ENUMERAL_TYPE
|| TREE_CODE (etype) == BOOLEAN_TYPE)) || TREE_CODE (etype) == BOOLEAN_TYPE))
{ {
/* ??? The pattern to be "preserved" by the middle-end and the /* The optimization barrier is a VIEW_CONVERT_EXPR node; moreover,
optimizers is a VIEW_CONVERT_EXPR between a pair of different in order not to be deemed an useless type conversion, it must
"base" types (integer types without TREE_TYPE). But this may be from subtype to base type.
raise addressability/aliasing issues because VIEW_CONVERT_EXPR
gets gimplified as an lvalue, thus causing the address of its ??? This may raise addressability and/or aliasing issues because
operand to be taken if it is deemed addressable and not already VIEW_CONVERT_EXPR gets gimplified as an lvalue, thus causing the
in GIMPLE form. */ address of its operand to be taken if it is deemed addressable
and not already in GIMPLE form. */
rtype = gnat_type_for_mode (TYPE_MODE (type), TYPE_UNSIGNED (type)); rtype = gnat_type_for_mode (TYPE_MODE (type), TYPE_UNSIGNED (type));
rtype = copy_type (rtype);
if (rtype == type) TYPE_MAIN_VARIANT (rtype) = rtype;
{ TREE_TYPE (rtype) = type;
rtype = copy_type (rtype);
TYPE_MAIN_VARIANT (rtype) = rtype;
}
final_unchecked = true; final_unchecked = true;
} }
......
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