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 r12-6302] [Ada] Avoid building malformed component constraints Date: Thu, 6 Jan 2022 17:13:52 +0000 (GMT) [thread overview] Message-ID: <20220106171352.CADD8385802A@sourceware.org> (raw) https://gcc.gnu.org/g:5bad97d7445d679921e87bc0f94286c3ade02d27 commit r12-6302-g5bad97d7445d679921e87bc0f94286c3ade02d27 Author: Steve Baird <baird@adacore.com> Date: Mon Dec 6 13:42:51 2021 -0800 [Ada] Avoid building malformed component constraints gcc/ada/ * sem_util.adb (Build_Discriminant_Reference): In the unexpected case where we previously would fail an assertion, we instead revert to the old behavior. Diff: --- gcc/ada/sem_util.adb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 2bc3c95dbeb..e07e48749d6 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -2107,11 +2107,7 @@ package body Sem_Util is -- Start of processing for Build_Discriminant_Reference begin - if Obj_Is_Good_Prefix then - return Make_Selected_Component (Loc, - Prefix => Copy_And_Maybe_Dereference (Obj), - Selector_Name => New_Occurrence_Of (Discrim, Loc)); - else + if not Obj_Is_Good_Prefix then -- If the given discriminant is not a component of the given -- object, then try the enclosing object. @@ -2128,10 +2124,15 @@ package body Sem_Util is (Discrim_Name => Discrim_Name, Obj => Name (Parent (Entity (Obj)))); else - pragma Assert (False); - raise Program_Error; + -- We are in some unexpected case here, so revert to the + -- old behavior (by falling through to it). + null; end if; end if; + + return Make_Selected_Component (Loc, + Prefix => Copy_And_Maybe_Dereference (Obj), + Selector_Name => New_Occurrence_Of (Discrim, Loc)); end Build_Discriminant_Reference; ------------------------------------
reply other threads:[~2022-01-06 17:13 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=20220106171352.CADD8385802A@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).