* [PATCH] PR fortran/95587 - ICE in gfc_target_encode_expr, at fortran/target-memory.c:362
@ 2020-06-18 21:27 Harald Anlauf
2020-06-20 9:08 ` Thomas Koenig
0 siblings, 1 reply; 2+ messages in thread
From: Harald Anlauf @ 2020-06-18 21:27 UTC (permalink / raw)
To: fortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 611 bytes --]
For EQUIVALENCE objects, constraints were only checked for ordinary variables,
but not for CLASS variables. Extend the checks to CLASS variable attributes.
Regtested on x86_64-pc-linux-gnu.
OK for master?
Thanks,
Harald
PR fortran/95587 - ICE in gfc_target_encode_expr, at fortran/target-memory.c:362
EQUIVALENCE objects are subject to constraints listed in the Fortran 2018
standard, section 8.10.1.1. These constraints are to be checked
also for CLASS variables.
gcc/fortran/
PR fortran/95587
* match.c (gfc_match_equivalence): Check constraints on
EQUIVALENCE objects also for CLASS variables.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: pr95587.patch --]
[-- Type: text/x-patch, Size: 1180 bytes --]
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index 82d2b5087e5..8063fcad295 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -5700,6 +5700,11 @@ gfc_match_equivalence (void)
if (!gfc_add_in_equivalence (&sym->attr, sym->name, NULL))
goto cleanup;
+ if (sym->ts.type == BT_CLASS
+ && CLASS_DATA (sym)
+ && !gfc_add_in_equivalence (&CLASS_DATA (sym)->attr,
+ sym->name, NULL))
+ goto cleanup;
if (sym->attr.in_common)
{
diff --git a/gcc/testsuite/gfortran.dg/pr95587.f90 b/gcc/testsuite/gfortran.dg/pr95587.f90
new file mode 100644
index 00000000000..a543fb92a18
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr95587.f90
@@ -0,0 +1,13 @@
+! { dg-do compile }
+! PR fortran/95587 - ICE in gfc_target_encode_expr, at fortran/target-memory.c:362
+
+program p
+ type t
+ end type t
+ class(*), allocatable :: x, y
+ class(t), allocatable :: u, v
+ class(t), pointer :: c, d
+ equivalence (x, y) ! { dg-error "conflicts with ALLOCATABLE" }
+ equivalence (u, v) ! { dg-error "conflicts with ALLOCATABLE" }
+ equivalence (c, d) ! { dg-error "conflicts with POINTER" }
+end
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-20 9:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-18 21:27 [PATCH] PR fortran/95587 - ICE in gfc_target_encode_expr, at fortran/target-memory.c:362 Harald Anlauf
2020-06-20 9:08 ` Thomas Koenig
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).