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: Harald Anlauf X-Patchwork-Id: 1658755 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=NL/D+dUj; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lp4YQ0jsXz9sFk for ; Thu, 21 Jul 2022 04:51:34 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3E3823858437 for ; Wed, 20 Jul 2022 18:51:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3E3823858437 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1658343092; 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=NL/D+dUjmSY+5SCRRkN+PwJqWcVj34f3Ug21A/HjwU3691s/ZkCyaBqp5qhALL5iH hwqtftZ3RlfS7XrvNL2NlOZAEXB7bnQaCdVryAXT7XRenPFWvx8AutjyyYIicy+R7G ycrIi2M4R9pmYBg2WD8vofaVsZIAkw4oPGFC/5Fc= 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: Harald Anlauf Reply-To: Harald Anlauf Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" 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