From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2071) id 22D343854164; Thu, 29 Sep 2022 18:39:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 22D343854164 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664476781; bh=IAI40ms8R041MkopyZwiSWM8XY8auftniHJSvFDIZpg=; h=From:To:Subject:Date:From; b=eX8lmCZAwAFNmKlvPoPSeek/ZUDl3Kwo1dHik+YRvFsy3MqAJ1SDO9km+PsUmnaTC ABYBRzLXhUUWQfmnlSeCQsYHue+g/zj4fYFWMz8omJeITBV/NGPcc/BgKueRisrshj CbOu9e2y0eQiU/2R+uPX6EUiFuqYSTqzj9M6g+rw= 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 r12-8797] 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-12 X-Git-Oldrev: 2e81790f45c9b7ced4d8c70c3122404854aa5be5 X-Git-Newrev: 22c2658a8b6ae9ece8b33bc483c04a767168b5f4 Message-Id: <20220929183941.22D343854164@sourceware.org> Date: Thu, 29 Sep 2022 18:39:41 +0000 (GMT) List-Id: https://gcc.gnu.org/g:22c2658a8b6ae9ece8b33bc483c04a767168b5f4 commit r12-8797-g22c2658a8b6ae9ece8b33bc483c04a767168b5f4 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.cc (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.cc | 1 + gcc/testsuite/gfortran.dg/associate_26a.f90 | 15 +++++++++++++++ 2 files changed, 16 insertions(+) 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