gawk/gawk-4.2.0-000-do-not-fold-...

27 lines
840 B
Diff

From 08897b5c5facfd35aa971321a248e6fcd6abf5d8 Mon Sep 17 00:00:00 2001
From: "Arnold D. Robbins" <arnold@skeeve.com>
Date: Sat, 21 Oct 2017 20:59:19 +0300
Subject: [PATCH] Don't fold constant strings if either is translatable.
---
awkgram.y | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/awkgram.y b/awkgram.y
index 1a75e64..9f35143 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -1589,7 +1589,8 @@ common_exp
// 1.5 "" # can't fold this if program mucks with CONVFMT.
// See test #12 in test/posix.awk.
- if ((n1->flags & (NUMBER|NUMINT)) != 0 || (n2->flags & (NUMBER|NUMINT)) != 0)
+ // Also can't fold if one or the other is translatable.
+ if ((n1->flags & (NUMBER|NUMINT|INTLSTR)) != 0 || (n2->flags & (NUMBER|NUMINT|INTLSTR)) != 0)
goto plain_concat;
n1 = force_string(n1);
--
2.9.5