public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Harald Anlauf <anlauf@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r11-10283] Fortran: fix ICE in generate_coarray_sym_init [PR82868]
Date: Fri, 30 Sep 2022 20:33:27 +0000 (GMT) [thread overview]
Message-ID: <20220930203327.5A215385483E@sourceware.org> (raw)
https://gcc.gnu.org/g:8a24700c64cabd99802a77ab13080d6f66ee0be7
commit r11-10283-g8a24700c64cabd99802a77ab13080d6f66ee0be7
Author: Harald Anlauf <anlauf@gmx.de>
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 <physiker@toast2.net>
+!
+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
reply other threads:[~2022-09-30 20:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220930203327.5A215385483E@sourceware.org \
--to=anlauf@gcc.gnu.org \
--cc=gcc-cvs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).