From patchwork Tue Jan 24 20:47:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harald Anlauf X-Patchwork-Id: 47890 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2366732wrn; Tue, 24 Jan 2023 12:48:57 -0800 (PST) X-Google-Smtp-Source: AMrXdXsCaYsgz3hGI8oBGgSByqPmdMP2VJAZuCyhQR/3Wc5feaatMDCh6exMtTwMClT4KvQisAsa X-Received: by 2002:a17:907:d40c:b0:872:af53:a028 with SMTP id vi12-20020a170907d40c00b00872af53a028mr29749860ejc.61.1674593337144; Tue, 24 Jan 2023 12:48:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674593337; cv=none; d=google.com; s=arc-20160816; b=m3P0Z+BWNqwqf+Gzbk6iRFvtS/HdIPktODHDVnmttS1gFIMNOSGvLgu8w1CJL7DWCP tiWuzxgQLSgM62sRfBihUbHdXScN8Kk6abm7mspB7sa+/GqB/3rIu+W+fJRKFsJBB668 PhpHa/XO9WhkGoFxP6Q2H6zeb2QIvpQWOWFeqGAYP/8Ev5sSQZewyFTMeLsANNzUqGO9 JIxGcmGFTJxf+GfmACqQ5aZowDUqvpoEvh78tTvY0OHaHMs9TRRpSDHmyEHwqSlLqebB wHr13/KS7WpoHXcG5iAZgwtZTmdRMzRfrcS0GwBgIDrO6A6+qatuphSX3ytnWfDsox8T kiDQ== 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:ui-outboundreport :sensitivity:importance:date:subject:to:message-id:mime-version :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=lCyJI+Av77YWtgwJyruu8tUywPXKx02fHRjDtbzHEBI=; b=qMI7S3ZlRTTddCgvnUROExSqS8KCYW53Yg3kMO0J+N2aOFMerRsPgPlkMHAg4N1C8h 2+eMoiJxYzdg0tApeucZKlKjQqL8EaPFasfxqsi+HP4ZlX9vc/0f2iOI6iYvOnbTFMIa T8FgDI6srdphgmY0p+lnw8FvSDS3kalEuvM8j2+6QSY6ikoX7h+aTkoUUOaqA1aVOh+e LEA53/rm6/ZnH4WC2yPpBgQAYsxLJe3o3aenOhu2eKgRvlsHQOYwxWDpew7Abz6K5lyw c1YBlSVM9mRnTZ+3WG89v1xV1HbHrYqHWKib5PN/SUJGv4q0Kj4172SccPM9CC+8PF1E Q6VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=VSkmOnPy; 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 ec28-20020a0564020d5c00b0049e199070cbsi3656116edb.23.2023.01.24.12.48.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Jan 2023 12:48:57 -0800 (PST) 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=VSkmOnPy; 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 F3294385700E for ; Tue, 24 Jan 2023 20:48:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F3294385700E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674593298; bh=lCyJI+Av77YWtgwJyruu8tUywPXKx02fHRjDtbzHEBI=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=VSkmOnPyk4EhMqXbBl/wl3SfiWzGe1Xd04/v2CXTmLKT28OGQDZTck7XfkouL+0Qm ceqtieV2E9rDXjyol/UGSHlilNRkMTJMJBun6WVkNOEZG9VyzSDd6pQPygL2OJqckU 8NOsQLkvHQ15LerBOcIRXzLlesCzw1uRLiCzADUk= 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.15.19]) by sourceware.org (Postfix) with ESMTPS id 562A43858D28; Tue, 24 Jan 2023 20:47:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 562A43858D28 X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [93.207.87.68] ([93.207.87.68]) by web-mail.gmx.net (3c-app-gmx-bs66.server.lan [172.19.170.210]) (via HTTP); Tue, 24 Jan 2023 21:47:31 +0100 MIME-Version: 1.0 Message-ID: To: fortran , gcc-patches Subject: [PATCH, committed] Fortran: ICE in transformational_result [PR108529] Date: Tue, 24 Jan 2023 21:47:31 +0100 Importance: normal Sensitivity: Normal X-Priority: 3 X-Provags-ID: V03:K1:0wZp49uAH47t868WvoljbH7QnR1ppD56jrSAKMQexKU2GfpiSRiDTx7vZCgPK06PbRtZQ ILSDv37o7HSma1wwXcQSxtXXsCwI3+sb9n9EOOh+qzuGZvVWw/lzhsvl3fuLodGSefDA30fUWGpY xNxaZ6SZ17eHuwL3b+qn0+2wrQ8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ests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, 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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755938383168187849?= X-GMAIL-MSGID: =?utf-8?q?1755938383168187849?= Dear all, we ICE'd in the simplification of the transformational intrinsic ANY when the passed ARRAY argument had an invalid declaration. The reason was a reference to array->shape which was NULL. Obvious solution: then just don't attempt to simplify. Regtested on x86_64-pc-linux-gnu and pushed to mainline as https://gcc.gnu.org/g:6c96382eed96a9285611f2e3e2e59557094172b8 The PR is marked as a 10/11/12/13 regression, thus I plan to backport. Thanks, Harald From 6c96382eed96a9285611f2e3e2e59557094172b8 Mon Sep 17 00:00:00 2001 From: Harald Anlauf Date: Tue, 24 Jan 2023 21:39:43 +0100 Subject: [PATCH] Fortran: ICE in transformational_result [PR108529] gcc/fortran/ChangeLog: PR fortran/108529 * simplify.cc (simplify_transformation): Do not try to simplify transformational intrinsic when the ARRAY argument has a NULL shape. gcc/testsuite/ChangeLog: PR fortran/108529 * gfortran.dg/pr108529.f90: New test. --- gcc/fortran/simplify.cc | 1 + gcc/testsuite/gfortran.dg/pr108529.f90 | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/pr108529.f90 diff --git a/gcc/fortran/simplify.cc b/gcc/fortran/simplify.cc index f413f132b3f..20ea38e0007 100644 --- a/gcc/fortran/simplify.cc +++ b/gcc/fortran/simplify.cc @@ -720,6 +720,7 @@ simplify_transformation (gfc_expr *array, gfc_expr *dim, gfc_expr *mask, size_zero = gfc_is_size_zero_array (array); if (!(is_constant_array_expr (array) || size_zero) + || array->shape == NULL || !gfc_is_constant_expr (dim)) return NULL; diff --git a/gcc/testsuite/gfortran.dg/pr108529.f90 b/gcc/testsuite/gfortran.dg/pr108529.f90 new file mode 100644 index 00000000000..34c9691fae1 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr108529.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } +! PR fortran/108529 - ICE in transformational_result +! Contributed by G.Steinmetz + +program p + integer, parameter :: a(*,*) = reshape([1, 2, 3, 4], [2, 2]) + logical, parameter :: b(2,*) = a > 2 ! { dg-error "Assumed size" } + logical, parameter :: c(*) = all(b, 1) ! { dg-error "Bad shape" } +end -- 2.35.3