public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch, fortran, committed] Fix PR 85641
@ 2018-06-06 21:43 Thomas Koenig
  0 siblings, 0 replies; only message in thread
From: Thomas Koenig @ 2018-06-06 21:43 UTC (permalink / raw)
  To: fortran, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 509 bytes --]

Hello world,

I have just committed the attached patch as obvious after
regression-testing.

Since this fixes a regression, I will backport to gcc8 and gcc7 in
the next days.

Regards

	Thomas

2018-06-06  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/85641
	* frontend-passes.c (is_fe_temp): Add prototype.
	(realloc_string_callback): Early return for frontend-generated
	temporary.

2018-06-06  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/85641
	* gfortran.dg/realloc_on_assign_30.f90: New test.


[-- Attachment #2: p1.diff --]
[-- Type: text/x-patch, Size: 718 bytes --]

Index: frontend-passes.c
===================================================================
--- frontend-passes.c	(Revision 261245)
+++ frontend-passes.c	(Arbeitskopie)
@@ -57,6 +57,8 @@ static bool has_dimen_vector_ref (gfc_expr *);
 static int matmul_temp_args (gfc_code **, int *,void *data);
 static int index_interchange (gfc_code **, int*, void *);
 
+static bool is_fe_temp (gfc_expr *e);
+
 #ifdef CHECKING_P
 static void check_locus (gfc_namespace *);
 #endif
@@ -254,6 +256,9 @@ realloc_string_callback (gfc_code **c, int *walk_s
       || !expr1->ts.deferred)
     return 0;
 
+  if (is_fe_temp (expr1))
+    return 0;
+
   expr2 = gfc_discard_nops (co->expr2);
 
   if (expr2->expr_type == EXPR_VARIABLE)

[-- Attachment #3: realloc_on_assign_30.f90 --]
[-- Type: text/x-fortran, Size: 300 bytes --]

! { dg-do compile }
! PR 85641 - this used to ICE due do infinite recursion.
! Test case by Antony Lewis.
program tester
character(LEN=:), allocatable :: fields
integer j
character(LEN=4), parameter :: CMB_CL_Fields = 'TEBP'

fields = ''
j=1
fields = fields // CMB_CL_Fields(j:j)

end program tester

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-06-06 21:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-06 21:43 [patch, fortran, committed] Fix PR 85641 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).