From patchwork Wed Sep 21 18:34:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harald Anlauf X-Patchwork-Id: 1680799 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=) Authentication-Results: legolas.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=MycYrSo1; dkim-atps=neutral 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 ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MXnCD3S3Nz1yqP for ; Thu, 22 Sep 2022 04:35:02 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6606A3858022 for ; Wed, 21 Sep 2022 18:34:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6606A3858022 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663785298; bh=2/uTswKX/B5Y+AVxXj8S84JgpZ0aSADf82bJyZtPtx8=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=MycYrSo1Ant37ZGVFBG7+EpEKpN/4sOjpsjVhd4XjD3KhA7ncIMWzecoCnO6Kv/VL wnK+m5GaEBx6tIFxx1jpsHNO4oc6MKgU27BTxaJ15peifPoCWNYNFTU/FX58rwBGpT bf/rYj1GxvNDQZbOSJeOHu7zPANhjES8YG+RAyYw= 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 73EDA3858C53; Wed, 21 Sep 2022 18:34:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 73EDA3858C53 X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [93.207.89.8] ([93.207.89.8]) by web-mail.gmx.net (3c-app-gmx-bap37.server.lan [172.19.172.107]) (via HTTP); Wed, 21 Sep 2022 20:34:30 +0200 MIME-Version: 1.0 Message-ID: To: fortran , gcc-patches Subject: [PATCH] Fortran: fix ICE in generate_coarray_sym_init [PR82868] Date: Wed, 21 Sep 2022 20:34:30 +0200 Importance: normal Sensitivity: Normal X-Priority: 3 X-Provags-ID: V03:K1:jrI7k8dJJJ6Jtrn6hc0P9y5HYBJ8smJboULyDMFyMNSByL9kpybpwGKbjIIzVBCKM6MCy CofOvX5Jio7MT0y48V7CXlPL/4ecqU9lVFsA5l+A/lifd4QnBHeRreWdwYStUfe8yCYYu0sQtUlk e34K6+x4X4OtuMpZuThuQIX7C21pPimH6ZH3Bfddr14fsCF4B0Q3p0BXdWD6bkC2e+1HrkFxaJY8 63UBp2qbDFHAe8WRW1zlADSp93HXYiHOMyM/YxXGBYf/JUy2USq1N8ft4w1ih9tGYwm3LAeyC85m 2c= X-UI-Out-Filterresults: notjunk:1;V03:K0:wgKNUZ7jhI4=:ECjgg3DWWVmb97Il5IFKZn /FV06pfE4aY4rLlk7R7fyfdsZHYHb1NU6RdmwKXvbJwPwmJItKXGxOhrkHqL3vWeJyph3MlhA /OwubvKjwtSDhiHTx/K0S8XU/JbSUvUdnwqUsWA8EPEa/A6sm0vpN6K2cBYtJOLcaGNlLvACf 9LM7c8Z2gPLKpjCTv4HSquqG4VCVOe9yNs2rxZGqTN2yFuECTH8ITQxWLMNUOFaJgktYuzQfr wCHAXqZ5qE88LP31ylfsywVNIyl8rrVWY/psh565Q+KMQHhJN+2Agd7W/wqcOCI2Pl1q8cMta NQcLkYmTsOKo1CaHpduigNqGLYGMzNseWvUw/EsSy+pN6TR+mU+T1WHHqH2HoRDBw1fGHdAaV InebKU3P9AiiNiZUQuNKHLXJ48eK+0RIvK233Dpm1Q7lC6pszjhIyxu67/CErip/jrJSUkS7Z yg0sz49/75r7jAEErytB4KScLJii1H9YUNxcupdC36ZEaSCgd2vxUpAQFQmWzGbAEgMRDm+44 ZbKmK2n2YcnSabxNYFhF3Qs2Y5U3iePeFxo/dBUniesdKdIiwM69eiWKBXvRvrihUd7f0vjYK pwQ5nx68Po2ZFrsdI4cEzFDzRDIkllkAxiuZrB5/03MHCXGvmXYlqgSUAS6mZgDUN0MTbt3e2 w+rpQSnC5Xz0VPpAD+jsvuiqDV24DbHytwIzVU7aB99bTrw1F5aJPjjpi1NqeH7XjYbReKwo4 BbeXEQODc53k0WXXLAct2OCb+b/wfR5jH6ENc5sCPnoLa4q9cxlPtyCvFMqSoB0HMtYpHNtQ1 iyo85Rd X-Spam-Status: No, score=-12.4 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, I intend to commit the attached, obvious patch for a NULL pointer dereference until tomorrow unless there are comments or objections. We better skip initialization for a symbol which is an associate name. Regtested on x86_64-pc-linux-gnu. Thanks, Harald From 0259762271b2eb430e058b0bff4d7b11513c48c4 Mon Sep 17 00:00:00 2001 From: Harald Anlauf Date: Wed, 21 Sep 2022 19:55:30 +0200 Subject: [PATCH] Fortran: fix ICE in generate_coarray_sym_init [PR82868] gcc/fortran/ChangeLog: PR fortran/82868 * trans-decl.cc (generate_coarray_sym_init): Skip symbol if attr.associate_var. gcc/testsuite/ChangeLog: PR fortran/82868 * gfortran.dg/associate_26a.f90: New test. --- gcc/fortran/trans-decl.cc | 1 + gcc/testsuite/gfortran.dg/associate_26a.f90 | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/associate_26a.f90 diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc index 908a4c6d42e..5d16d640322 100644 --- a/gcc/fortran/trans-decl.cc +++ b/gcc/fortran/trans-decl.cc @@ -5529,6 +5529,7 @@ generate_coarray_sym_init (gfc_symbol *sym) if (sym->attr.dummy || sym->attr.allocatable || !sym->attr.codimension || sym->attr.use_assoc || !sym->attr.referenced + || sym->attr.associate_var || sym->attr.select_type_temporary) return; diff --git a/gcc/testsuite/gfortran.dg/associate_26a.f90 b/gcc/testsuite/gfortran.dg/associate_26a.f90 new file mode 100644 index 00000000000..85aebebd4d8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/associate_26a.f90 @@ -0,0 +1,15 @@ +! { dg-do compile } +! { dg-options "-fcoarray=lib" } +! +! Test the fix for PR78152 and the followup in PR82868 +! +! Contributed by +! +program co_assoc + implicit none + integer, parameter :: p = 5 + real, allocatable :: a(:,:)[:,:] + allocate (a(p,p)[2,*]) + associate (i => a(1:p, 1:p)) + end associate +end program co_assoc -- 2.35.3