This is the mail archive of the gcc-bugs@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]

[Bug fortran/68147] Potential incorrect code generation for string self-assignment


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68147

--- Comment #6 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Here's a patch:

Index: frontend-passes.c
===================================================================
--- frontend-passes.c   (Revision 233410)
+++ 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;

@@ -177,7 +176,7 @@ static int
     return 0;

   current_code = c;
-  n = create_var (expr2, "trim");
+  n = create_var (expr2, "realloc");
   co->expr2 = n;
   return 0;
 }

(The last part is to make the variable name more useful, that's all.)

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