diff mbox

[Ada] New attribute typ'Deref (address-expr)

Message ID 4252752.5jnP7rpxbL@polaris
State New
Headers show

Commit Message

Eric Botcazou March 26, 2015, 9:11 p.m. UTC
> For now it will blow up with a GCC error in the back end, which does
> not know about this attribute yet.

I guess that we don't want to have a half-backed implementation so I have 
installed the gigi part.  Tested on x86_64-suse-linux.


2015-03-26  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/trans.c (Attribute_to_gnu) <Attr_Deref>: New case.
diff mbox

Patch

Index: gcc-interface/trans.c
===================================================================
--- gcc-interface/trans.c	(revision 221709)
+++ gcc-interface/trans.c	(working copy)
@@ -2469,6 +2469,18 @@  Attribute_to_gnu (Node_Id gnat_node, tre
 	}
       break;
 
+    case Attr_Deref:
+      prefix_unused = true;
+      gnu_expr = gnat_to_gnu (First (Expressions (gnat_node)));
+      gnu_result_type = get_unpadded_type (Etype (gnat_node));
+      /* This can be a random address so build an alias-all pointer type.  */
+      gnu_expr
+	= convert (build_pointer_type_for_mode (gnu_result_type, ptr_mode,
+						true),
+		   gnu_expr);
+      gnu_result = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_expr);
+      break;
+
     default:
       /* This abort means that we have an unimplemented attribute.  */
       gcc_unreachable ();