public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Eric Botcazou <ebotcazou@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Arnaud Charlet <charlet@adacore.com>, Robert Dewar <dewar@adacore.com>
Subject: Re: [Ada] New attribute typ'Deref (address-expr)
Date: Thu, 26 Mar 2015 21:13:00 -0000	[thread overview]
Message-ID: <4252752.5jnP7rpxbL@polaris> (raw)
In-Reply-To: <20150324122620.GA26210@adacore.com>

[-- Attachment #1: Type: text/plain, Size: 379 bytes --]

> 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.

-- 
Eric Botcazou

[-- Attachment #2: p.diff --]
[-- Type: text/x-patch, Size: 841 bytes --]

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 ();

      reply	other threads:[~2015-03-26 21:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-24 12:26 Arnaud Charlet
2015-03-26 21:13 ` Eric Botcazou [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4252752.5jnP7rpxbL@polaris \
    --to=ebotcazou@adacore.com \
    --cc=charlet@adacore.com \
    --cc=dewar@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).