This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, fortran] PR91717 - ICE on concatenating deferred-length character and character literal


Hi All,

I nearly committed this patch as 'obvious' but noticed a fair number
of changes in 10-branch in dependency analysis. This is in fact a
10-regression. I'll wait for an OK.

Bootstrapped and regtested on FC30/x86_64 - OK to commit?

Paul

2019-09-11  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  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/91717
    * gfortran.dg/dependency_55.f90 : New test.
Index: gcc/fortran/dependency.c
===================================================================
*** gcc/fortran/dependency.c	(revision 275323)
--- gcc/fortran/dependency.c	(working copy)
*************** gfc_dep_resolver (gfc_ref *lref, gfc_ref
*** 2096,2101 ****
--- 2096,2102 ----
    int m;
    gfc_dependency fin_dep;
    gfc_dependency this_dep;
+   bool same_component = false;
  
    this_dep = GFC_DEP_ERROR;
    fin_dep = GFC_DEP_ERROR;
*************** gfc_dep_resolver (gfc_ref *lref, gfc_ref
*** 2115,2120 ****
--- 2116,2123 ----
  	     components.  */
  	  if (lref->u.c.component != rref->u.c.component)
  	    return 0;
+ 
+ 	  same_component = true;
  	  break;
  
  	case REF_SUBSTRING:
*************** gfc_dep_resolver (gfc_ref *lref, gfc_ref
*** 2280,2285 ****
--- 2283,2292 ----
    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);
  
Index: gcc/testsuite/gfortran.dg/dependency_55.f90
===================================================================
*** gcc/testsuite/gfortran.dg/dependency_55.f90	(nonexistent)
--- gcc/testsuite/gfortran.dg/dependency_55.f90	(working copy)
***************
*** 0 ****
--- 1,17 ----
+ ! { 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 message is: "
+   my_core%msg = my_core%msg//"Hello!"
+ 
+   if (my_core%msg .ne. "my message is: Hello!") stop 1
+ end

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]