Commit 3fd9ae96 by Eric Botcazou Committed by Eric Botcazou

trans.c (Attribute_to_gnu): Do not strip conversions around prefixes that are not references.

	* gcc-interface/trans.c (Attribute_to_gnu) <Attr_Address>: Do not strip
	conversions around prefixes that are not references.

From-SVN: r251704
parent 1f073c92
2017-09-05 Eric Botcazou <ebotcazou@adacore.com> 2017-09-05 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/trans.c (Attribute_to_gnu) <Attr_Address>: Do not strip
conversions around prefixes that are not references.
2017-09-05 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/utils.c (unchecked_convert): When the result type is a * gcc-interface/utils.c (unchecked_convert): When the result type is a
non-biased integral type with size 0, set the result to 0 directly. non-biased integral type with size 0, set the result to 0 directly.
......
...@@ -1629,10 +1629,14 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) ...@@ -1629,10 +1629,14 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
case Attr_Address: case Attr_Address:
case Attr_Unrestricted_Access: case Attr_Unrestricted_Access:
/* Conversions don't change addresses but can cause us to miss the /* Conversions don't change the address of references but can cause
COMPONENT_REF case below, so strip them off. */ build_unary_op to miss the references below, so strip them off.
gnu_prefix = remove_conversions (gnu_prefix, On the contrary, if the address-of operation causes a temporary
!Must_Be_Byte_Aligned (gnat_node)); to be created, then it must be created with the proper type. */
gnu_expr = remove_conversions (gnu_prefix,
!Must_Be_Byte_Aligned (gnat_node));
if (REFERENCE_CLASS_P (gnu_expr))
gnu_prefix = gnu_expr;
/* If we are taking 'Address of an unconstrained object, this is the /* If we are taking 'Address of an unconstrained object, this is the
pointer to the underlying array. */ pointer to the underlying array. */
......
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