re PR fortran/91717 (ICE on concatenating deferred-length character and character literal)

2019-09-13  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/91717
	* dependency.c (gfc_dep_resolver): Flag identical components
	and exit with return value 1 if set and no array refs.

2019-09-13  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/91717
	* gfortran.dg/dependency_55.f90 : New test.

From-SVN: r275696
This commit is contained in:
Paul Thomas 2019-09-13 05:41:01 +00:00
parent e5b3c74bf0
commit e4dc7c6572
4 changed files with 36 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2019-09-13 Paul Thomas <pault@gcc.gnu.org>
PR fortran/91717
* dependency.c (gfc_dep_resolver): Flag identical components
and exit with return value 1 if set and no array refs.
2019-09-11 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/91553

View File

@ -2096,6 +2096,7 @@ gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gfc_reverse *reverse,
int m;
gfc_dependency fin_dep;
gfc_dependency this_dep;
bool same_component = false;
this_dep = GFC_DEP_ERROR;
fin_dep = GFC_DEP_ERROR;
@ -2115,6 +2116,8 @@ gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gfc_reverse *reverse,
components. */
if (lref->u.c.component != rref->u.c.component)
return 0;
same_component = true;
break;
case REF_SUBSTRING:
@ -2280,6 +2283,10 @@ gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gfc_reverse *reverse,
if (lref || rref)
return 1;
/* This can result from concatenation of assumed length string components. */
if (same_component && fin_dep == GFC_DEP_ERROR)
return 1;
/* If we haven't seen any array refs then something went wrong. */
gcc_assert (fin_dep != GFC_DEP_ERROR);

View File

@ -1,3 +1,8 @@
2019-09-13 Paul Thomas <pault@gcc.gnu.org>
PR fortran/91717
* gfortran.dg/dependency_55.f90 : New test.
2019-09-12 Uroš Bizjak <ubizjak@gmail.com>
PR tree-optimization/89386

View File

@ -0,0 +1,18 @@
! { dg-do run }
!
! Test the fix for PR91717 in which the concatenation operation ICEd.
!
! Contributed by Damian Rouson <damian@sourceryinstitute.org>
!
type core
character (len=:), allocatable :: msg
end type
type(core) :: my_core
my_core%msg = ""
my_core%msg = my_core%msg//"my message is: "
my_core%msg = my_core%msg//"Hello!"
if (my_core%msg .ne. "my message is: Hello!") stop 1
end