]> git.ipfire.org Git - thirdparty/tar.git/commitdiff
Work around GCC bug 106427
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 24 Jul 2022 21:38:34 +0000 (14:38 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 25 Jul 2022 16:44:00 +0000 (09:44 -0700)
* lib/wordsplit.c (coalesce_segment): Reword to avoid
GCC bug 106427.

lib/wordsplit.c

index 97d89c9c490fb4e6c63b781b3af7d46720fbe632..56837c329a1a89a174ec47502d87864e8a55ac5c 100644 (file)
@@ -571,7 +571,6 @@ coalesce_segment (struct wordsplit *wsp, struct wordsplit_node *node)
   struct wordsplit_node *p, *end;
   size_t len = 0;
   char *buf, *cur;
-  int stop;
 
   for (p = node; p->flags & _WSNF_JOIN; )
     {
@@ -590,7 +589,7 @@ coalesce_segment (struct wordsplit *wsp, struct wordsplit_node *node)
   cur = buf;
 
   p = node;
-  for (stop = 0; !stop;)
+  for (;;)
     {
       struct wordsplit_node *next = p->next;
       const char *str = wsnode_ptr (wsp, p);
@@ -602,7 +601,12 @@ coalesce_segment (struct wordsplit *wsp, struct wordsplit_node *node)
        {
          node->flags |= p->flags & _WSNF_QUOTE;
          wsnode_remove (wsp, p);
-         stop = p == end;
+         if (p == end)
+           {
+             /* Call wsnode_free separately to work around GCC bug 106427.  */
+             wsnode_free (p);
+             break;
+           }
          wsnode_free (p);
        }
       p = next;