Skip to content

Commit

Permalink
2018-06-06 Thomas Koenig <tkoenig@gcc.gnu.org>
Browse files Browse the repository at this point in the history
	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.



git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@261248 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information
tkoenig committed Jun 6, 2018
1 parent a4db72c commit e035747
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
7 changes: 7 additions & 0 deletions gcc/fortran/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
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-05 Cesar Philippidis <cesar@codesourcery.com>

PR fortran/85701
Expand Down
5 changes: 5 additions & 0 deletions gcc/fortran/frontend-passes.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -254,6 +256,9 @@ realloc_string_callback (gfc_code **c, int *walk_subtrees ATTRIBUTE_UNUSED,
|| !expr1->ts.deferred)
return 0;

if (is_fe_temp (expr1))
return 0;

expr2 = gfc_discard_nops (co->expr2);

if (expr2->expr_type == EXPR_VARIABLE)
Expand Down
5 changes: 5 additions & 0 deletions gcc/testsuite/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2018-06-06 Thomas Koenig <tkoenig@gcc.gnu.org>

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

2018-06-06 Carl Love <cel@us.ibm.com>

* gcc.target/powerpc/builtins-3.c: Move tests requiring -mvsx
Expand Down
13 changes: 13 additions & 0 deletions gcc/testsuite/gfortran.dg/realloc_on_assign_30.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
! { 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

0 comments on commit e035747

Please sign in to comment.