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: 1346 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2302:b0:79:6ae5:3758 with SMTP id gv2csp3057784dyb; Wed, 21 Sep 2022 11:35:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7GATx5XTx/VTGSBfluk9uu6OcR2+5A0uNzArwCe0/tUpHjmqgZdafv0OKWOBQ6jNNx3v7g X-Received: by 2002:a17:907:d07:b0:72e:ec79:ad0f with SMTP id gn7-20020a1709070d0700b0072eec79ad0fmr22355730ejc.296.1663785323115; Wed, 21 Sep 2022 11:35:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663785323; cv=none; d=google.com; s=arc-20160816; b=aGVPNjlWoTb5Xo4OieBS0tDCitxLLh8eRXEAdZLvOtNM2yPHPvm4zqHlFZmlSdmEwE uKyqHNsKyeaheqZ/Jnb1BwFaVvKgZjnMZzrZtkKKgWPiN2OddITm9aNQcD2/YBnRMQA2 B38GVuRs7taSnUEOKhgk65SUi89en28Y3YyCaJsCQ7A6ghtq+ANcpFBuUT9nV3zMFSg2 y0wPCuUqF0th8bgYnvlDpR72JuSDZUSzZ+8lixstsgv9+aOVMSwp3dFuJfMb9K6twhot tpIf9aKtv4hLVTx52CyeRqpAp2gRQE2swDZj7s+cFyJQR8kOPpsMl4cE9GD1GyVRE67C stqQ== 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=2/uTswKX/B5Y+AVxXj8S84JgpZ0aSADf82bJyZtPtx8=; b=y/tpE9pXiPmn2CzNKIOrJjItGDBnCu55+hYuAOEqq1DfCljuxH1N6dlb6TOnxdDeDY 9wcZ6joquBKEQBB3kP6f4iFiv18zQ3kQ5Bj4CI3ZdDzUIVTfXpSHq9fQno1X136SDccy tubprym1GkxvO8ri36C5y4NdgGkeIwaRZxQgNb7fPgOS3Mpg4oiDG6hpSiGr+GQtGog6 xCV+apMZPzSbSV2EOIq7a/K0F0JsS1y+7sSvOZSVocA+5HfHMjFW5PE31QN4ujHtyZ3G 3k1buZwL/bGueBwLd6Jr2K5SdFhRK9id116GwJbBuQ8Of8JHNQ8pdWmHAR99MGng5YGl 8Y6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=PpNt3dDc; 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 nd16-20020a170907629000b0078200f94d06si4182398ejc.237.2022.09.21.11.35.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Sep 2022 11:35:23 -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=PpNt3dDc; 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 5B1013858284 for ; Wed, 21 Sep 2022 18:35:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5B1013858284 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663785321; 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=PpNt3dDcG2TEKPsKrlhBhaY4dO2emwLkWoIz6r9PhI6rPijnD+hncnpR+s7nUO1t8 E6iZ2s7ZyY7l9SMC6SJKlDPy+tnyPfWR7tyyQp5KQsv8jXjqAqCIo5QfbW3pmiMZgp qVPno6i4OU/SHC+UefXIiiBexyYAf8BMskaR6rg0= 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/lifd4QnBHeRreWdwYStUfe8yCYYu0sQ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ES_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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1744605358891615237?= X-GMAIL-MSGID: =?utf-8?q?1744605358891615237?= 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