From patchwork Wed Jul 20 18:51:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Pan2 via Gcc-patches" X-Patchwork-Id: 82 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e252:0:0:0:0:0 with SMTP id bl18csp1091143wrb; Wed, 20 Jul 2022 11:51:56 -0700 (PDT) X-Google-Smtp-Source: AGRyM1um/nepEVHMhfgzz9YFy2pVnTdvZZybb4DJKrZ5p6+TT9cuJTpIgUaA0p3wBZ8Nc/T4dhRD X-Received: by 2002:a17:907:7e87:b0:72b:4af3:bf57 with SMTP id qb7-20020a1709077e8700b0072b4af3bf57mr37330972ejc.9.1658343116548; Wed, 20 Jul 2022 11:51:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658343116; cv=none; d=google.com; s=arc-20160816; b=Ep5tGIeCmQZ15sb33Jfvb4Ix1E4QoBV9cj9qg3JkjhnHZqoj02jGpvEW9aF3RMExBd nCGnabjhl38KpUnwoVCljP1wIuAKKcSR3nOx/wN2a2JHO8ea0w8zk6fVEzmQKEpcgqvQ Tbb0T0K5aXCBsmoMB/sKvXAEZLQppDyuTfozZqeCQeV9Qi4Lt59WvW2vIPBQhh1mem4L 5wtJYEAXEUQN5eOa1uvMq0ldliUdggrNUEizpb6dVvuRKELMW4aUhXnZDxG6XDgqFyMx TXQuL8qJt/bSYU0vb/XFZg1v2vOikfPaEg41GvrCybPrIne9rPpgtsBUIHOGYMolUvCf 5P8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:sensitivity :importance:date:subject:to:message-id:mime-version:dmarc-filter :delivered-to:dkim-signature:dkim-filter; bh=/gWXeXUClpS4zCrE5fe20yU9vegNLd4VPCNJU+v/tFQ=; b=dnfqO++kxmTyvyUMYLPgx/Kugc85k3Gr69WZF8lko2dZKW1twi+UNR5kBo3hw8cm6b oaIDvjF8vCkDowiO5RJ1QCfto0tKRjYcbw/ALaGPM43UD0fzJFA/LTcDnhdjTyvbnWFN T+eX3Upf8brAYQptvpc7uodGi01GIH/0d/72Mfn30fRLW8qeXH3rs0e5BFPA5lqy5rPF Nxb6ew94a1+HemyDZ1BXUA4PUZiYTQZFWLp+Emh/VTBegJOODV7ZWobwvgTVfKmL05KF Sbmv4eIjiBGk25mQE2grqX2KhNfoy3Be8vbGC8S9BEEB7hg1BDq0b+PgUmBW+xR3kjma uMlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=HCuE4Oa8; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id dt12-20020a170907728c00b0072b5895f57bsi2732481ejc.12.2022.07.20.11.51.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 11:51:56 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=HCuE4Oa8; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4DE313858285 for ; Wed, 20 Jul 2022 18:51:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4DE313858285 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1658343115; bh=/gWXeXUClpS4zCrE5fe20yU9vegNLd4VPCNJU+v/tFQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=HCuE4Oa8KpQbgrf2chuwArl+x8FgcdL4WOzrY1wBwn9u4Tk51YBVXLESjn0IN6dHg rdCoqDTNSFw3pbfBRVI3GDSbPWV37gNAWXqlaHvdRl33zGQQZzirHctYyEFWrD8038 Ab3EsDtFCZjQOgw/+Gw9XMqvdV1p5fIcCD7C3Q3Y= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) by sourceware.org (Postfix) with ESMTPS id BAD123858D28; Wed, 20 Jul 2022 18:51:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BAD123858D28 X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [93.207.80.50] ([93.207.80.50]) by web-mail.gmx.net (3c-app-gmx-bap04.server.lan [172.19.172.74]) (via HTTP); Wed, 20 Jul 2022 20:51:10 +0200 MIME-Version: 1.0 Message-ID: To: fortran , gcc-patches Subject: [PATCH, committed] Fortran: fix parsing of omp task affinity iterator clause [PR101330] Date: Wed, 20 Jul 2022 20:51:10 +0200 Importance: normal Sensitivity: Normal X-Priority: 3 X-Provags-ID: V03:K1:1b0lA5DMGsAUeuurDLyxsKDxxR0S+DF9cIsk+5eOnPyCh2TBH7qsmf/H7lClXX5vHtdTd noKK1rAhRyfWw5yVfv7Mx5ar8G82rcA2ZMhDNXKQi3u5Q31uLEEx/TOukAmgIJYtvzFzHBCK3gZ/ JMgbAHoE67ngej+IogoXFjz7O2xuYegtoCzY21hxW9kS1ZdaqsM+RfVbDiIAWZ1w1DncwreIvRG3 TeyDwXeXc8mlaty9vlGkzp+g2CCUCJO1qDx/ZZvvp6hOigfZ05iU8ducBBzg3i1wxfnqaJhkafua 68= X-UI-Out-Filterresults: notjunk:1;V03:K0:GEgvDej543g=:9IlViEI7lhPHq4L5FnypWj lRA1XsIDpnLpYhhns4XZTQ73o66FJBmA3FBLJVFNhE+YgEcuiwaGAnLMB/+V8Mqo2IpHshED7 K0eTfPEEI0nVnxlN9LEK/B/2Mv07IEzLQXzhk6xPSH2HJI+mEXIisyyY/w++d2d5qeWelQ6H1 4vuof/MY/ixsb+Hx3O28hd5Bfm8VV0+sT0U2/3/t2D4CyAL9po3AkRO72UwnOIZ1W/1JdYoGF bag1Sgh/JCWGFUmTUi2RMTi9lFB7WkjCh3fkrwAsBlIXK8W8v/JCAVj2LkabgLaFf9DYt6eck dD8UPp2hFKPfNdhooq/0fiaenynkyupRqtDju2qrTlsE6my0HK80KWwapRK0i+REIk078Fho4 6kkFuSZsEDwczQXobRztMG9YmZcwhgruGX6Sh95BllC8sY+s6Kx5WWP6Wc2zVKr5bIEggAVKK 5qZ198KSpx60ZUSaYNVLc4gmqfjZeONF8OqwoFWXEN5GkHTK1vVT6lH9CZBQEyim+8VZLbyoB p5u9955SBZ4vQZH49fM/kEgVbrZuEiocu5mtPHTcNtYIIVnIs/v3uFTI148X/GeRO7ixXfEe6 qTYUHuMEv7jRjRrh/RBPr7Dy+A2UEMx3PzUO0yPQU/ZRkDL2Or+5h81AklmYYCIQCGS018vrb 9B5SrdmLXK8llxvAIb/FZH5n+0v8REauDqa6NaedGFtFzW/u0UMoxlGzRQezenz4tzls9H432 ZjLkpfjvDkcUmiNvEVhXagUToidW7NrvEIgcLnl2cSM1c4ISPR2epQsf5MU= X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP 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: Harald Anlauf via Gcc-patches From: "Li, Pan2 via Gcc-patches" Reply-To: Harald Anlauf Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1738898791596755489?= X-GMAIL-MSGID: =?utf-8?q?1738898791596755489?= Dear all, there was some left-over code - likely from development - that could lead to a compiler segfault when given invalid input. Steve found the offending line. Removing it solves the issue. The fix was acknowledged by Tobias in the PR. Regtested on x86_64-pc-linux-gnu. Pushed as: r13-1767-g26bbe78f77f73bb66af1ac13d0deec888a3c6510 Will backport to 12-branch, as the offending code was introduced there. Thanks, Harald From 26bbe78f77f73bb66af1ac13d0deec888a3c6510 Mon Sep 17 00:00:00 2001 From: Harald Anlauf Date: Wed, 20 Jul 2022 20:40:23 +0200 Subject: [PATCH] Fortran: fix parsing of omp task affinity iterator clause [PR101330] gcc/fortran/ChangeLog: PR fortran/101330 * openmp.cc (gfc_match_iterator): Remove left-over code from development that could lead to a crash on invalid input. gcc/testsuite/ChangeLog: PR fortran/101330 * gfortran.dg/gomp/affinity-clause-7.f90: New test. --- gcc/fortran/openmp.cc | 1 - .../gfortran.dg/gomp/affinity-clause-7.f90 | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/gomp/affinity-clause-7.f90 diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc index bd4ff259fe0..df9cdf43eb7 100644 --- a/gcc/fortran/openmp.cc +++ b/gcc/fortran/openmp.cc @@ -1181,7 +1181,6 @@ gfc_match_iterator (gfc_namespace **ns, bool permit_var) } if (':' == gfc_peek_ascii_char ()) { - step = gfc_get_expr (); if (gfc_match (": %e ", &step) != MATCH_YES) { gfc_free_expr (begin); diff --git a/gcc/testsuite/gfortran.dg/gomp/affinity-clause-7.f90 b/gcc/testsuite/gfortran.dg/gomp/affinity-clause-7.f90 new file mode 100644 index 00000000000..5b1ca85aba3 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/affinity-clause-7.f90 @@ -0,0 +1,19 @@ +! { dg-do compile } +! PR fortran/101330 - ICE in free_expr0(): Bad expr type +! Contributed by G.Steinmetz + + implicit none + integer :: j, b(10) +!$omp task affinity (iterator(j=1:2:1) : b(j)) +!$omp end task +!$omp task affinity (iterator(j=1:2:) : b(j)) ! { dg-error "Invalid character" } +!!$omp end task +!$omp task affinity (iterator(j=1:2: ! { dg-error "Invalid character" } +!!$omp end task +!$omp task affinity (iterator(j=1:2:) ! { dg-error "Invalid character" } +!!$omp end task +!$omp task affinity (iterator(j=1:2::) ! { dg-error "Invalid character" } +!!$omp end task +!$omp task affinity (iterator(j=1:2:)) ! { dg-error "Invalid character" } +!!$omp end task +end -- 2.35.3