From patchwork Fri May 13 09:35:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 53918 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0F7C1383E822 for ; Fri, 13 May 2022 09:36:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0F7C1383E822 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1652434598; bh=8eJ0GiXevDRpKX5B/Axhe8pkSS4V5FbcRMIxAudCScU=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=mcrBLQxh4nVcdALySuDvklUnoVxf0Mi1I+t9522/W0XCA2GX3v02GFMuHhsL+l8GT znnNrwUEbjx85hHz6I1vh4w1YTsvr4/PYPn4CL7dsvZBMaHZmp5BDEA2ggEmS67ZTM w9+Wz6PdLCHZBWdWC3LUjILRWbFw601KJ37+kJPc= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from rock.gnat.com (rock.gnat.com [205.232.38.15]) by sourceware.org (Postfix) with ESMTPS id 3FB0E38425BC for ; Fri, 13 May 2022 09:35:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3FB0E38425BC Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 13F13116AA1; Fri, 13 May 2022 05:35:22 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id rRJ1TfB4VDhj; Fri, 13 May 2022 05:35:22 -0400 (EDT) Received: from free.home (tron.gnat.com [IPv6:2620:20:4000:0:46a8:42ff:fe0e:e294]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPS id D059E1168BF; Fri, 13 May 2022 05:35:21 -0400 (EDT) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 24D9ZDLv156992 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 May 2022 06:35:13 -0300 To: gcc-patches@gcc.gnu.org Subject: [PATCH] ada: gcc-if: build proper String_Pointer for Get_External_Name Organization: Free thinker, does not speak for AdaCore Date: Fri, 13 May 2022 06:35:13 -0300 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, 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-Patchwork-Original-From: Alexandre Oliva via Gcc-patches From: Alexandre Oliva Reply-To: Alexandre Oliva Cc: botcazou@adacore.com Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" The compiler is allowed to assume it can access String bounds, such as the prefix passed to Get_External_Name, even in circumstances in which the prefix is not going to be used and has_prefix is false, so, from the C side, we have to build a proper String_Template for the String_Pointer. Regstrapped on x86_64-linux-gnu. Approved by Eric. I'm checking it in. for gcc/ada/ChangeLog * gcc-interface/decl.cc (is_cplusplus_method): Build proper String for Get_External_Name. --- gcc/ada/gcc-interface/decl.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc index 56ad4998e2286..28e1ab7ce8159 100644 --- a/gcc/ada/gcc-interface/decl.cc +++ b/gcc/ada/gcc-interface/decl.cc @@ -4956,7 +4956,8 @@ is_cplusplus_method (Entity_Id gnat_entity) 'this' parameter is not encoded in the mangled name of a method. */ if (Is_Subprogram (gnat_entity) && Present (Interface_Name (gnat_entity))) { - String_Pointer sp = { NULL, NULL }; + String_Template temp = { 0, 0 }; + String_Pointer sp = { "", &temp }; Get_External_Name (gnat_entity, false, sp); void *mem;