public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-598] [Ada] Errors missed on ACATS test B650007 Date: Wed, 18 May 2022 08:44:03 +0000 (GMT) [thread overview] Message-ID: <20220518084403.18F693858016@sourceware.org> (raw) https://gcc.gnu.org/g:5b0e8d6937f7857e3dc7486a989e0c72d478c1ed commit r13-598-g5b0e8d6937f7857e3dc7486a989e0c72d478c1ed Author: Arnaud Charlet <charlet@adacore.com> Date: Sat Apr 2 17:29:09 2022 +0000 [Ada] Errors missed on ACATS test B650007 This ACATS test shows that we need to call Is_Immutably_Limited_Type in Analyze_Function_Return and also that we have a latent bug in Is_Immutably_Limited_Type which shouldn't look through private types. gcc/ada/ * sem_aux.adb (Is_Immutably_Limited_Type): Do not look through private types as per RM 7.5(8.1). * sem_ch6.adb (Analyze_Function_Return): Use Is_Immutably_Limited_Type as per RM 6.5(5.10). Diff: --- gcc/ada/sem_aux.adb | 10 +--------- gcc/ada/sem_ch6.adb | 11 ++++++----- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/gcc/ada/sem_aux.adb b/gcc/ada/sem_aux.adb index ffbfc712b31..43c33b45928 100644 --- a/gcc/ada/sem_aux.adb +++ b/gcc/ada/sem_aux.adb @@ -1059,15 +1059,7 @@ package body Sem_Aux is end if; else - declare - Utyp : constant Entity_Id := Underlying_Type (Btype); - begin - if No (Utyp) then - return False; - else - return Is_Immutably_Limited_Type (Utyp); - end if; - end; + return False; end if; elsif Is_Concurrent_Type (Btype) then diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 2939394d88d..c9e57e95b10 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -1566,17 +1566,18 @@ package body Sem_Ch6 is -- Check RM 6.5 (5.9/3) - if Has_Aliased then + if Has_Aliased and then not Is_Immutably_Limited_Type (R_Type) then if Ada_Version < Ada_2012 and then Warn_On_Ada_2012_Compatibility then Error_Msg_N - ("ALIASED only allowed for limited return objects " - & "in Ada 2012?y?", N); + ("ALIASED only allowed for immutably limited return " & + "objects in Ada 2012?y?", N); - elsif not Is_Limited_View (R_Type) then + else Error_Msg_N - ("ALIASED only allowed for limited return objects", N); + ("ALIASED only allowed for immutably limited return " & + "objects", N); end if; end if;
reply other threads:[~2022-05-18 8:44 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=20220518084403.18F693858016@sourceware.org \ --to=pmderodat@gcc.gnu.org \ --cc=gcc-cvs@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: linkBe 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).