public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-2690] Fortran: error recovery for bad deferred character length assignment [PR104314]
@ 2022-09-15 20:15 Harald Anlauf
0 siblings, 0 replies; only message in thread
From: Harald Anlauf @ 2022-09-15 20:15 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:7bd4deb2a7c1394550610ab27507d1ed2af817c2
commit r13-2690-g7bd4deb2a7c1394550610ab27507d1ed2af817c2
Author: Harald Anlauf <anlauf@gmx.de>
Date: Thu Sep 15 22:06:53 2022 +0200
Fortran: error recovery for bad deferred character length assignment [PR104314]
gcc/fortran/ChangeLog:
PR fortran/104314
* resolve.cc (deferred_op_assign): Do not try to generate temporary
for deferred character length assignment if types do not agree.
gcc/testsuite/ChangeLog:
PR fortran/104314
* gfortran.dg/pr104314.f90: New test.
Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org>
Diff:
---
gcc/fortran/resolve.cc | 1 +
gcc/testsuite/gfortran.dg/pr104314.f90 | 9 +++++++++
2 files changed, 10 insertions(+)
diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index ca114750f65..ae7ebb624e4 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -11803,6 +11803,7 @@ deferred_op_assign (gfc_code **code, gfc_namespace *ns)
if (!((*code)->expr1->ts.type == BT_CHARACTER
&& (*code)->expr1->ts.deferred && (*code)->expr1->rank
+ && (*code)->expr2->ts.type == BT_CHARACTER
&& (*code)->expr2->expr_type == EXPR_OP))
return false;
diff --git a/gcc/testsuite/gfortran.dg/pr104314.f90 b/gcc/testsuite/gfortran.dg/pr104314.f90
new file mode 100644
index 00000000000..510ded0b164
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr104314.f90
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! PR fortran/104314 - ICE in deferred_op_assign
+! Contributed by G.Steinmetz
+
+program p
+ character(:), allocatable :: c(:)
+ c = ['123']
+ c = c == c ! { dg-error "Cannot convert" }
+end
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-09-15 20:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-15 20:15 [gcc r13-2690] Fortran: error recovery for bad deferred character length assignment [PR104314] Harald Anlauf
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).