From patchwork Thu Feb 10 10:07:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Sayle X-Patchwork-Id: 50998 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 328FA385840E for ; Thu, 10 Feb 2022 10:08:27 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from server.nextmovesoftware.com (server.nextmovesoftware.com [162.254.253.69]) by sourceware.org (Postfix) with ESMTPS id CF7D43858D28; Thu, 10 Feb 2022 10:07:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CF7D43858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=nextmovesoftware.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nextmovesoftware.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nextmovesoftware.com; s=default; h=Content-Type:MIME-Version:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=+SIgonP+an0WVTeCQnXsGmXXbx3ObydlVYUGUUbGyls=; b=EOrkMy1Bmv8S1WU3DTg7bBet9L Xx6rLEOjxqwVgWxfs+9WGHEWZWu5f6e1uCLyvxiPIVDo+Q3zLFVaCDiklMCl3B35oB1JZyjgaecKl UEGbLGN/k/cu9w2DopLLc22pGjMPefaFeDOHp3hfhirWD/PIoy4r1f1YiYhbDTRMqjgQ+bx2mhaL+ +DPKbyqbP1qQfKFG6/EHAhYlm4PC8zEpfZigPOZd9LjchOvmXHFIOTdRvOZ9eCTx5uN0gaFQV0tjn B0c+72uAJzD6XxWecg1d8Z9LgyvNwL1moLBtOgll9QApJHVywvIZ/S19EVf/jrwL0aQGWuEo/ZeCc 0+8qhCrA==; Received: from host86-160-23-130.range86-160.btcentralplus.com ([86.160.23.130]:51750 helo=Dell) by server.nextmovesoftware.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nI6Mj-00014d-4r; Thu, 10 Feb 2022 05:07:53 -0500 From: "Roger Sayle" To: , Subject: [PATCH] gfortran: Respect target's NO_DOT_IN_LABEL in trans-common.cc Date: Thu, 10 Feb 2022 10:07:50 -0000 Message-ID: <016801d81e66$10d48410$327d8c30$@nextmovesoftware.com> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AdgeZY2pqCr0xPwUSiSnzHKogZPK6g== Content-Language: en-gb X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server.nextmovesoftware.com X-AntiAbuse: Original Domain - gcc.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - nextmovesoftware.com X-Get-Message-Sender-Via: server.nextmovesoftware.com: authenticated_id: roger@nextmovesoftware.com X-Authenticated-Sender: server.nextmovesoftware.com: roger@nextmovesoftware.com X-Source: X-Source-Args: X-Source-Dir: X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" This patch fixes 9 unexpected failures in the gfortran testsuite on nvptx-none. The issue is that gfortran's EQUIVALENCE internally uses symbols such as "equiv.0" even on platforms that define NO_DOT_IN_LABEL. On nvptx-none, this then results in the following error message(s): ptxas application ptx input, fatal: Parsing error near '.0': syntax error ptxas fatal : Ptx assembly aborted due to errors The fix is to tweak trans-common.cc to respect the target's NO_DOT_IN_LABEL (and NO_DOLLAR_IN_LABEL) when generating internal equiv.%d symbols. Only the nvptx, mmix and xtensa backends define NO_DOT_IN_LABEL which explains why no-one has spotted/fixed this issue since the problematic code was last changed back in 2005(!). This patch has been tested on nvptx-none hosted by x86_64-pc-linux-gnu with make and make -k check with no new failures, and the nine fewer failures in the gfortran testsuite described above. Ok for mainline? 2022-02-10 Roger Sayle gcc/fortran/ChangeLog * trans-common.cc (GFC_EQUIV_FMT): New macro respecting the target's NO_DOT_IN_LABEL and NO_DOLLAR_IN_LABEL preferences. (build_equiv_decl): Use GFC_EQUIV_FMT here. Thanks in advance, Roger diff --git a/gcc/fortran/trans-common.cc b/gcc/fortran/trans-common.cc index 7b4d198..184a976 100644 --- a/gcc/fortran/trans-common.cc +++ b/gcc/fortran/trans-common.cc @@ -338,6 +338,13 @@ build_field (segment_info *h, tree union_type, record_layout_info rli) h->field = field; } +#if !defined (NO_DOT_IN_LABEL) +#define GFC_EQUIV_FMT "equiv.%d" +#elif !defined (NO_DOLLAR_IN_LABEL) +#define GFC_EQUIV_FMT "equiv$%d" +#else +#define GFC_EQUIV_FMT "equiv_%d" +#endif /* Get storage for local equivalence. */ @@ -356,7 +363,7 @@ build_equiv_decl (tree union_type, bool is_init, bool is_saved, bool is_auto) return decl; } - snprintf (name, sizeof (name), "equiv.%d", serial++); + snprintf (name, sizeof (name), GFC_EQUIV_FMT, serial++); decl = build_decl (input_location, VAR_DECL, get_identifier (name), union_type); DECL_ARTIFICIAL (decl) = 1;