public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "simon at pushface dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ada/70867] [9/10/11/12 regression] access discriminant in return aggregate wrongly detected as dangling
Date: Sat, 31 Jul 2021 20:11:15 +0000 [thread overview]
Message-ID: <bug-70867-4-IKKwzcaqYF@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-70867-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70867
simon at pushface dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |simon at pushface dot org
--- Comment #14 from simon at pushface dot org ---
(In reply to Nicolas Boulenguez from comment #0)
> Hello.
> With GCC-6 (Debian 6.0.1-2) 6.0.1 20160423 (prerelease),
> compiling the following package with "gcc-6 -c p.adb" fails:
> p.adb:4:20: access discriminant in return aggregate would be a dangling
> reference
> The code compiles
> - if the "generic" line is removed
> - or if ".all" is inserted between "Position" and ".Item'Access"
> I am not sure whether returning this reference is allowed by the Ada
> Reference Manual,
> but the semantics of "generic" and ".all" should certainly not affect the
> answer.
GCC 11.1.0, x86_64-apple-darwin on macOS 11.6 (Big Sur):
This compiles without error, and the example below executes correctly.
with P;
with Ada.Text_IO;
procedure P_Test is
package Q is new P;
R : aliased Q.R := (Item => 42);
T : Q.T := Q.F (R'Access);
begin
Ada.Text_IO.Put_Line (T.D.all'Image);
end P_Test;
next prev parent reply other threads:[~2021-07-31 20:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <bug-70867-4@http.gcc.gnu.org/bugzilla/>
2021-05-14 9:48 ` jakub at gcc dot gnu.org
2021-06-01 8:07 ` rguenth at gcc dot gnu.org
2021-06-10 17:25 ` demoonlit at panathenaia dot halfmoon.jp
2021-07-31 20:11 ` simon at pushface dot org [this message]
2021-09-10 11:17 ` ebotcazou at gcc dot gnu.org
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=bug-70867-4-IKKwzcaqYF@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@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).