From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmx.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1663785270; bh=2j8/t7w6+0ZNlnRs3c7u3yVG9h4/qRHc3iK5LzeuYLo=; h=X-UI-Sender-Class:From:To:Subject:Date; b=hjAwwMOqxL2wuwf+6Jw5QL3f9bQ299/W3fsPsT04aftWlCqUisWDalbFBlCmxh55w tkNVBuX6i0ccQELjZLPgbtp39hkm8Xu19Pc73MjkAJVWJqggqbDM1iRVbb0np8czai 0dj12Vqyr1B2TrXpwv0Ai7Vkz7SN1pO5OKLtD4xc= 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: From: Harald Anlauf To: fortran , gcc-patches Subject: [PATCH] Fortran: fix ICE in generate_coarray_sym_init [PR82868] Content-Type: multipart/mixed; boundary=rekceb-4adef17a-0ff3-4ce9-bebe-84a1ea413a3d 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+x4X4OtuMpZu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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 List-Id: --rekceb-4adef17a-0ff3-4ce9-bebe-84a1ea413a3d Content-Type: text/plain; charset=UTF-8 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 --rekceb-4adef17a-0ff3-4ce9-bebe-84a1ea413a3d Content-Type: text/x-patch Content-Disposition: attachment; filename=pr82868.diff Content-Transfer-Encoding: quoted-printable =46rom 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. =2D-- 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 =2D-- 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/g= fortran.dg/associate_26a.f90 new file mode 100644 index 00000000000..85aebebd4d8 =2D-- /dev/null +++ b/gcc/testsuite/gfortran.dg/associate_26a.f90 @@ -0,0 +1,15 @@ +! { dg-do compile } +! { dg-options "-fcoarray=3Dlib" } +! +! Test the fix for PR78152 and the followup in PR82868 +! +! Contributed by +! +program co_assoc + implicit none + integer, parameter :: p =3D 5 + real, allocatable :: a(:,:)[:,:] + allocate (a(p,p)[2,*]) + associate (i =3D> a(1:p, 1:p)) + end associate +end program co_assoc =2D- 2.35.3 --rekceb-4adef17a-0ff3-4ce9-bebe-84a1ea413a3d--