From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by sourceware.org (Postfix) with ESMTPS id 3637A3954C4A for ; Thu, 2 Jun 2022 09:09:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3637A3954C4A Received: by mail-ed1-x532.google.com with SMTP id h19so5463886edj.0 for ; Thu, 02 Jun 2022 02:09:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=6ZW1lOHNPibI1wv9AcPerdkKpchL1dKSlGgAZqctwnI=; b=h282kPNcfbsdOm+LypkcfO3n8zDRbX3yQejCfeDlZehsuAd3OEVaEHFu6c7Z+m8LvI uCzGF1UZJbg+NOqFlb9iGxO8gbrdarpi3aYRNmzXsKr93t3YIqMvnkxjM1oicu/evpGz 9nor9fGxAoTig6ou/fXTftt6f96u33SgajimgvVVWh2k6ekOasyLc/YFkTWPwRj6vlBU TAyLReUeqjqyKyxyala0JxFc6c77xHuVpSMjd4rTnn6P9R8PqKxf5lfORvFx6UseYzQB W302FhGUIr0UOgCEWDSFDJYq4KD00Aev90/Uy9IHpnPOGBvHL6r00wBVLRQ7EqcoBxPv vkpg== X-Gm-Message-State: AOAM530y9Wduosf2ztN/iP7kNr6dV/SjJoR9gMbmRG41vBCjant6p1qv WHjOCBGXj5cqqkfGz81siltJkvHRvnpG7Q== X-Google-Smtp-Source: ABdhPJxqJ4oR2NyLgiBAVBgp/syk/CzRxSKaurBCCUfZf35u4H7bJaXCNh48ME+e1h8PyLR3Nu8V6g== X-Received: by 2002:a05:6402:5212:b0:42e:2fa:41a7 with SMTP id s18-20020a056402521200b0042e02fa41a7mr4193205edd.22.1654160946000; Thu, 02 Jun 2022 02:09:06 -0700 (PDT) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id 12-20020a170906058c00b006fed787478asm1525103ejn.92.2022.06.02.02.09.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jun 2022 02:09:05 -0700 (PDT) Date: Thu, 2 Jun 2022 09:09:05 +0000 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [Ada] Fix spurious use of trampolines with interface types Message-ID: <20220602090905.GA1010831@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="cNdxnHkX5QqsyA0e" Content-Disposition: inline X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2022 09:09:08 -0000 --cNdxnHkX5QqsyA0e Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Function pointers must always be built with '[Unrestricted_]Access. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch3.adb (Init_Secondary_Tags.Initialize_Tag): Initialize the Offset_Func component by means of 'Unrestricted_Access. --cNdxnHkX5QqsyA0e Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="patch.diff" diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -9506,7 +9506,7 @@ package body Exp_Ch3 is -- Prim_T => Typ'Tag, -- Interface_T => Iface'Tag, -- Offset_Value => n, - -- Offset_Func => Fn'Address) + -- Offset_Func => Fn'Unrestricted_Access) Append_To (Stmts_List, Make_Procedure_Call_Statement (Loc, @@ -9541,7 +9541,7 @@ package body Exp_Ch3 is Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (DT_Offset_To_Top_Func (Tag_Comp), Loc), - Attribute_Name => Name_Address))))); + Attribute_Name => Name_Unrestricted_Access))))); -- In this case the next component stores the value of the offset -- to the top. --cNdxnHkX5QqsyA0e--