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] Fix PR fortran/68147, temporaries for allocatable strings


Hello world,

in the fix for PR 47674, there was a piece of unnecessary
code which meant that allocatable string assignments did
not get their temporary within IF statements (and others).

This patch is really simple and obvious.  If we weren't in
tstage 4, I would simply commit it.

Because allocatable strings are a major convenience for
users, I would still like to commit this to trunk and
to the affected branches.

So, OK for these branches?

Regards

	Thomas

2016-02-18  Thomas Koenig  <tkoenig@gcc.gnu.org>

        PR fortran/68147
        PR fortran/47674
        * frontend-passes.c (realloc_string_callbac): Don't set
        walk_subtrees.

2016-02-18  Thomas Koenig  <tkoenig@gcc.gnu.org>

        PR fortran/68147
        PR fortran/47674
        * gfortran.dg/realloc_on_assign_26.f90:  New test case.
Index: frontend-passes.c
===================================================================
--- frontend-passes.c	(Revision 233474)
+++ frontend-passes.c	(Arbeitskopie)
@@ -153,7 +153,7 @@ gfc_run_passes (gfc_namespace *ns)
  */
 
 static int
-realloc_string_callback (gfc_code **c, int *walk_subtrees,
+realloc_string_callback (gfc_code **c, int *walk_subtrees ATTRIBUTE_UNUSED,
 			 void *data ATTRIBUTE_UNUSED)
 {
   gfc_expr *expr1, *expr2;
@@ -160,7 +160,6 @@ static int
   gfc_code *co = *c;
   gfc_expr *n;
 
-  *walk_subtrees = 0;
   if (co->op != EXEC_ASSIGN)
     return 0;
 
! { dg-do run }
! PR 68147 - no temprorary within the IF statement.
! Original test case by Martin Reinecke.
program test
  implicit none
  character(len=:),allocatable ::name
  name="./a.out"
  if (index(name,"/")  /=  0) THEN
    name=name(3:)
    if (name .ne. "a.out") call abort
  endif
end program

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