From: Paul Thomas Date: Fri, 13 Sep 2019 05:41:01 +0000 (+0000) Subject: re PR fortran/91717 (ICE on concatenating deferred-length character and character... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e4dc7c6572d50dd9de2331521b8e8ac39d905527;p=gcc.git re PR fortran/91717 (ICE on concatenating deferred-length character and character literal) 2019-09-13 Paul Thomas 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 PR fortran/91717 * gfortran.dg/dependency_55.f90 : New test. From-SVN: r275696 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 17021990936..bf721c7d43e 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2019-09-13 Paul Thomas + + 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 PR fortran/91553 diff --git a/gcc/fortran/dependency.c b/gcc/fortran/dependency.c index da4a37c9e95..51148709766 100644 --- a/gcc/fortran/dependency.c +++ b/gcc/fortran/dependency.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cd805625ee6..ab1d7bc9312 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-09-13 Paul Thomas + + PR fortran/91717 + * gfortran.dg/dependency_55.f90 : New test. + 2019-09-12 Uroš Bizjak PR tree-optimization/89386 diff --git a/gcc/testsuite/gfortran.dg/dependency_55.f90 b/gcc/testsuite/gfortran.dg/dependency_55.f90 new file mode 100644 index 00000000000..53898b3a34d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/dependency_55.f90 @@ -0,0 +1,18 @@ +! { dg-do run } +! +! Test the fix for PR91717 in which the concatenation operation ICEd. +! +! Contributed by Damian Rouson +! + 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