summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2022-07-24 14:38:34 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2022-07-25 09:44:00 -0700
commite5aac38c8094b320d67d352b2b99973622ac9751 (patch)
tree8eb6d9a093e0849708642cd820d751fe332d929f
parent5c4f8cadbd362497dc3c3136566589557ce00f1b (diff)
downloadtar-e5aac38c8094b320d67d352b2b99973622ac9751.tar.gz
Work around GCC bug 106427
* lib/wordsplit.c (coalesce_segment): Reword to avoid GCC bug 106427.
-rw-r--r--lib/wordsplit.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/wordsplit.c b/lib/wordsplit.c
index 97d89c9c..56837c32 100644
--- a/lib/wordsplit.c
+++ b/lib/wordsplit.c
@@ -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;