From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2071) id 5A215385483E; Fri, 30 Sep 2022 20:33:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5A215385483E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664570007; bh=77HU8lDqYPbG3EzYBeeWsv/hXo9YdDvPXOpAhIVjjXE=; h=From:To:Subject:Date:From; b=PR0FtOsao6NzKUN0uQGOz8Agz/dUDkS34yZz8hq1Z1BuIKsFIzIrvrM38SfldZCov g5CN+7Yj9uSsAWbxggxMKxo94I/bzwMz/AyzwiGmG0aphNPEMgWKVeRtmWdoDkUBkF QHVA0iGsDG5e8XobKPgnDYtFKnzkHOnRTaZwDhQs= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Harald Anlauf To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-10283] Fortran: fix ICE in generate_coarray_sym_init [PR82868] X-Act-Checkin: gcc X-Git-Author: Harald Anlauf X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: 0a4fff071ff48d699b1af94b88f8878da006c770 X-Git-Newrev: 8a24700c64cabd99802a77ab13080d6f66ee0be7 Message-Id: <20220930203327.5A215385483E@sourceware.org> Date: Fri, 30 Sep 2022 20:33:27 +0000 (GMT) List-Id: https://gcc.gnu.org/g:8a24700c64cabd99802a77ab13080d6f66ee0be7 commit r11-10283-g8a24700c64cabd99802a77ab13080d6f66ee0be7 Author: Harald Anlauf Date: Wed Sep 21 19:55:30 2022 +0200 Fortran: fix ICE in generate_coarray_sym_init [PR82868] gcc/fortran/ChangeLog: PR fortran/82868 * trans-decl.c (generate_coarray_sym_init): Skip symbol if attr.associate_var. gcc/testsuite/ChangeLog: PR fortran/82868 * gfortran.dg/associate_26a.f90: New test. (cherry picked from commit bc71318a91286b5f00e88f07aab818ac82510692) Diff: --- gcc/fortran/trans-decl.c | 1 + gcc/testsuite/gfortran.dg/associate_26a.f90 | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 38b09fed2cb..68fb19e6f2b 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -5624,6 +5624,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