From: Pierre-Marie de Rodat <derodat@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Eric Botcazou <ebotcazou@adacore.com>
Subject: [Ada] Generate debug info entry for user-defined access subtype
Date: Wed, 13 Jul 2022 10:03:04 +0000 [thread overview]
Message-ID: <20220713100304.GA994799@adacore.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 226 bytes --]
This is consistent with the other kinds of subtypes.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Access_Subtype>: Do
not reuse the TYPE_DECL of the base type.
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 1743 bytes --]
diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc
--- a/gcc/ada/gcc-interface/decl.cc
+++ b/gcc/ada/gcc-interface/decl.cc
@@ -3867,7 +3867,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
case E_Access_Subtype:
/* We treat this as identical to its base type; any constraint is
meaningful only to the front-end. */
- gnu_decl = gnat_to_gnu_entity (gnat_equiv_type, NULL_TREE, false);
+ gnu_type = gnat_to_gnu_type (gnat_equiv_type);
maybe_present = true;
/* The designated subtype must be elaborated as well, if it does
@@ -3877,11 +3877,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
&& Is_Frozen (Directly_Designated_Type (gnat_entity))
&& No (Freeze_Node (Directly_Designated_Type (gnat_entity))))
{
- tree gnu_base_type = TREE_TYPE (gnu_decl);
- tree gnu_desig_base_type
- = TYPE_IS_FAT_POINTER_P (gnu_base_type)
- ? TREE_TYPE (TREE_TYPE (TYPE_FIELDS (gnu_base_type)))
- : TREE_TYPE (gnu_base_type);
+ tree gnu_desig_type
+ = TYPE_IS_FAT_POINTER_P (gnu_type)
+ ? TREE_TYPE (TREE_TYPE (TYPE_FIELDS (gnu_type)))
+ : TREE_TYPE (gnu_type);
/* If we are to defer elaborating incomplete types, make a dummy
type node and elaborate it later. */
@@ -3898,7 +3897,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
/* Otherwise elaborate the designated subtype only if its base type
has already been elaborated. */
- else if (!TYPE_IS_DUMMY_P (gnu_desig_base_type))
+ else if (!TYPE_IS_DUMMY_P (gnu_desig_type))
gnat_to_gnu_entity (Directly_Designated_Type (gnat_entity),
NULL_TREE, false);
}
reply other threads:[~2022-07-13 10:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220713100304.GA994799@adacore.com \
--to=derodat@adacore.com \
--cc=ebotcazou@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).