From patchwork Wed Dec 15 15:54:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frederik Harwath X-Patchwork-Id: 48947 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 E87233857823 for ; Wed, 15 Dec 2021 15:58:46 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id BA266385802B for ; Wed, 15 Dec 2021 15:55:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BA266385802B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: KXrBP8k8GqzmrDoeY5ts2zus/ZLS1FElFxxVdXAz0HXOzzGRwn7xDrz/bTIOajjWvqWN+L8JhG JSRMwMWhGPkmT4sAuB3OdK1fR30DzMWF8lAJJVNQ55mDT7VR61kWMPFM/n7IddZQUjP2Xk8Bol GKODYMuTG0e2JPmAQw7hmWqIlwgWkGIeurhU1PnYKG9QQ74+zmXUazD7qwc/mkay7K6TQrhqvu Pgxbc9o0LsmWrIGCGiuZ3DJ9sYEEjbwLpNYXYhNPfXGxS3nBuEGE+aVpyVYwK2W01Og4YsU53i SCwXLIzA2Vnm9h85uMAnHSHY X-IronPort-AV: E=Sophos;i="5.88,207,1635235200"; d="scan'208";a="69736536" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa2.mentor.iphmx.com with ESMTP; 15 Dec 2021 07:55:17 -0800 IronPort-SDR: EAEGbk4N26KmbB2x5f3fLR8hOgRU7xTZOHKzGybzqRyRZTKENBAgokvpdsRveqjHJfTvPkLyKP eUv6t4WA05LemRO/AaRvwvDNhLuQoRP7ylzn3A92SMPd6Pay62LXvBbeDbkqv8vTInW+pk1q9y rFoG2jJot7CW96nnlLMjVyAbIGHcLFe/nSIg4IJIAsQytNr6T8ZK4qpZl863xQ+BAncYGkocYQ qHLnVWD/GDeP6rq92oZnzioZvmrNRYK0DwdxI6z1G+/m7qILMe59ZQ0F9NAQQaiLmV1mQ0tg8W ok4= From: Frederik Harwath To: Subject: [PATCH 05/40] Fix bug in processing of array dimensions in data clauses. Date: Wed, 15 Dec 2021 16:54:12 +0100 Message-ID: <20211215155447.19379-6-frederik@codesourcery.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211215155447.19379-1-frederik@codesourcery.com> References: <20211215155447.19379-1-frederik@codesourcery.com> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) To SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_SHORT, SPF_HELO_PASS, SPF_PASS, TXREP 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: , Cc: Sandra Loosemore , thomas@codesourcery.com, nathan@acm.org Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" From: Sandra Loosemore The g++ front end wraps the array length and low_bound values in NON_LVALUE_EXPR, causing the subsequent tests for INTEGER_CST to fail. The test case c-c++-common/goacc/kernels-loop-annotation-1.c was tickling this bug and giving bogus errors in g++ because it was falling through to dynamic array code instead of recognizing the constant bounds. This patch was posted upstream here https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542694.html but not yet committed. It may be that some other fix for this problem is implemented on mainline instead; check before merging this patch. 2020-03-31 Sandra Loosemore gcc/cp/ * semantics.c (handle_omp_array_sections_1): Call STRIP_NOPS on length and low_bound; (handle_omp_array_sections): Likewise. --- gcc/cp/semantics.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.33.0 ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 2443d0327498..c2643d0a7a24 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -5145,6 +5145,10 @@ handle_omp_array_sections_1 (tree c, tree t, vec &types, if (length) length = mark_rvalue_use (length); /* We need to reduce to real constant-values for checks below. */ + if (length) + STRIP_NOPS (length); + if (low_bound) + STRIP_NOPS (low_bound); if (length) length = fold_simple (length); if (low_bound) @@ -5457,6 +5461,11 @@ handle_omp_array_sections (tree c, enum c_omp_region_type ort) tree low_bound = TREE_PURPOSE (t); tree length = TREE_VALUE (t); + if (length) + STRIP_NOPS (length); + if (low_bound) + STRIP_NOPS (low_bound); + i--; if (low_bound && TREE_CODE (low_bound) == INTEGER_CST