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-5674] [Ada] Fix issues with ignored ghost code and unnesting Date: Wed, 1 Dec 2021 10:26:50 +0000 (GMT) [thread overview] Message-ID: <20211201102650.D75B93858006@sourceware.org> (raw) https://gcc.gnu.org/g:be6bb3fc57e2af376e5c18eeca51119e87a55ee3 commit r12-5674-gbe6bb3fc57e2af376e5c18eeca51119e87a55ee3 Author: Richard Kenner <kenner@adacore.com> Date: Tue Nov 16 09:39:57 2021 -0500 [Ada] Fix issues with ignored ghost code and unnesting gcc/ada/ * frontend.adb (Frontend): Do unnesting after ignored ghost code has been removed. * inline.adb (Analyze_Inlined_Bodies): Don't put ignored ghost entities on inlined subprogram list. Diff: --- gcc/ada/frontend.adb | 15 ++++++++------- gcc/ada/inline.adb | 11 ++++++++--- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/gcc/ada/frontend.adb b/gcc/ada/frontend.adb index a65b3e1b410..b78fc9cf30d 100644 --- a/gcc/ada/frontend.adb +++ b/gcc/ada/frontend.adb @@ -473,12 +473,6 @@ begin Check_Elaboration_Scenarios; end if; - -- At this stage we can unnest subprogram bodies if required - - if Total_Errors_Detected = 0 then - Exp_Unst.Unnest_Subprograms (Cunit (Main_Unit)); - end if; - -- List library units if requested if List_Units then @@ -494,12 +488,19 @@ begin Sem_Warn.Output_Unused_Warnings_Off_Warnings; -- Remove any ignored Ghost code as it must not appear in the - -- executable. This action must be performed last because it + -- executable. This action must be performed very late because it -- heavily alters the tree. if Operating_Mode = Generate_Code or else GNATprove_Mode then Remove_Ignored_Ghost_Code; end if; + + -- At this stage we can unnest subprogram bodies if required + + if Total_Errors_Detected = 0 then + Exp_Unst.Unnest_Subprograms (Cunit (Main_Unit)); + end if; + end if; end if; end; diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb index 08c454d366e..11a5523f4b7 100644 --- a/gcc/ada/inline.adb +++ b/gcc/ada/inline.adb @@ -1087,9 +1087,14 @@ package body Inline is -- subprograms for the unit. for Index in Inlined.First .. Inlined.Last loop - if Is_Called (Inlined.Table (Index).Name) then - Add_Inlined_Subprogram (Inlined.Table (Index).Name); - end if; + declare + E : constant Subprogram_Kind_Id := Inlined.Table (Index).Name; + + begin + if Is_Called (E) and then not Is_Ignored_Ghost_Entity (E) then + Add_Inlined_Subprogram (E); + end if; + end; end loop; Pop_Scope;
reply other threads:[~2021-12-01 10:26 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=20211201102650.D75B93858006@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).