public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <derodat@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Eric Botcazou <ebotcazou@adacore.com>
Subject: [Ada] Never make symbols for thunks public
Date: Thu, 2 Jun 2022 09:09:12 +0000	[thread overview]
Message-ID: <20220602090912.GA1010969@adacore.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 220 bytes --]

Thunks are only referenced locally by dispatch tables and never inlined.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Clear the Is_Public
	flag on thunks.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 598 bytes --]

diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -4772,6 +4772,13 @@ package body Sem_Ch6 is
          if Nkind (N) /= N_Subprogram_Body
            or else not Was_Expression_Function (N)
          then
+            --  First clear the Is_Public flag on thunks since they are only
+            --  referenced locally by dispatch tables and thus never inlined.
+
+            if Is_Thunk (Body_Id) then
+               Set_Is_Public (Body_Id, False);
+            end if;
+
             Freeze_Before (N, Body_Id);
          end if;
 



                 reply	other threads:[~2022-06-02  9:09 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=20220602090912.GA1010969@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).