aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew J. Schorr <aschorr@telemetry-investments.com>2017-01-15 12:06:17 -0500
committerAndrew J. Schorr <aschorr@telemetry-investments.com>2017-01-15 12:06:17 -0500
commit0c3c1a2aa8318e0035f90fc3a5d30de470d949b3 (patch)
tree6b29a78cb905577c06d164274275b10ab2f0717e
parentaa4a2c09d9b438e628254238e184ebff2c6b7acc (diff)
parent2fd82e70b4a9b85427a126f103841ebcb8e8bb16 (diff)
downloadegawk-0c3c1a2aa8318e0035f90fc3a5d30de470d949b3.tar.gz
egawk-0c3c1a2aa8318e0035f90fc3a5d30de470d949b3.tar.bz2
egawk-0c3c1a2aa8318e0035f90fc3a5d30de470d949b3.zip
Merge branch 'gawk-4.1-stable'
-rw-r--r--ChangeLog7
-rw-r--r--interpret.h6
-rw-r--r--test/ChangeLog6
-rw-r--r--test/Makefile.am4
-rw-r--r--test/Makefile.in9
-rw-r--r--test/Maketests5
-rw-r--r--test/concat5.awk7
-rw-r--r--test/concat5.ok1
8 files changed, 41 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index d362fa66..ea490add 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2017-01-15 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * interpret.h (r_interpret): Fix bug in Op_assign_concat reported
+ on Cygwin mailing list. The string concatenation optimization was
+ not updating the node correctly by setting STRING and STRCUR flags
+ and setting stfmt.
+
2017-01-04 Arnold Robbins <arnold@skeeve.com>
* config.guess, config.sub, compile, depcomp: Sync from latest
diff --git a/interpret.h b/interpret.h
index 1399e720..3526325e 100644
--- a/interpret.h
+++ b/interpret.h
@@ -718,14 +718,16 @@ mod:
*lhs = dupnode(t1);
}
- if (t1 != t2 && t1->valref == 1 && (t1->flags & MPFN) == 0) {
+ if (t1 != t2 && t1->valref == 1 && (t1->flags & (MPFN|MPZN)) == 0) {
size_t nlen = t1->stlen + t2->stlen;
erealloc(t1->stptr, char *, nlen + 1, "r_interpret");
memcpy(t1->stptr + t1->stlen, t2->stptr, t2->stlen);
t1->stlen = nlen;
t1->stptr[nlen] = '\0';
- t1->flags &= ~(NUMCUR|NUMBER|NUMINT);
+ t1->flags &= ~(NUMCUR|NUMBER|USER_INPUT|NUMINT|INTIND);
+ t1->flags |= (STRING|STRCUR);
+ t1->stfmt = -1;
if ((t1->flags & WSTRCUR) != 0 && (t2->flags & WSTRCUR) != 0) {
size_t wlen = t1->wstlen + t2->wstlen;
diff --git a/test/ChangeLog b/test/ChangeLog
index d2b0cf79..5122534c 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,9 @@
+2017-01-15 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * Makefile.am (concat5): New test.
+ * concat5.awk, concat5.ok: New files.
+ Check for bug forwarded by Corinna Vinschen from Cygwin mailing list.
+
2016-12-05 Andrew J. Schorr <aschorr@telemetry-investments.com>
* rwarray.awk: Check that strnum is recreated correctly.
diff --git a/test/Makefile.am b/test/Makefile.am
index 035e96ec..cc9f6d12 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -195,6 +195,8 @@ EXTRA_DIST = \
concat4.awk \
concat4.in \
concat4.ok \
+ concat5.awk \
+ concat5.ok \
convfmt.awk \
convfmt.ok \
crlf.awk \
@@ -1165,7 +1167,7 @@ BASIC_TESTS = \
aryprm8 aryprm9 arysubnm asgext awkpath \
back89 backgsub badassign1 badbuild \
callparam childin clobber closebad clsflnam compare compare2 concat1 concat2 \
- concat3 concat4 convfmt \
+ concat3 concat4 concat5 convfmt \
datanonl defref delargv delarpm2 delarprm delfunc dfamb1 dfastress dynlj \
eofsplit exit2 exitval1 exitval2 exitval3 \
fcall_exit fcall_exit2 fldchg fldchgnf fldterm fnamedat fnarray fnarray2 \
diff --git a/test/Makefile.in b/test/Makefile.in
index ac0bdc1a..a45e26ef 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -453,6 +453,8 @@ EXTRA_DIST = \
concat4.awk \
concat4.in \
concat4.ok \
+ concat5.awk \
+ concat5.ok \
convfmt.awk \
convfmt.ok \
crlf.awk \
@@ -1422,7 +1424,7 @@ BASIC_TESTS = \
aryprm8 aryprm9 arysubnm asgext awkpath \
back89 backgsub badassign1 badbuild \
callparam childin clobber closebad clsflnam compare compare2 concat1 concat2 \
- concat3 concat4 convfmt \
+ concat3 concat4 concat5 convfmt \
datanonl defref delargv delarpm2 delarprm delfunc dfamb1 dfastress dynlj \
eofsplit exit2 exitval1 exitval2 exitval3 \
fcall_exit fcall_exit2 fldchg fldchgnf fldterm fnamedat fnarray fnarray2 \
@@ -2994,6 +2996,11 @@ concat3:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+concat5:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
convfmt:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 7a5acf50..5b91af61 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -195,6 +195,11 @@ concat3:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+concat5:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
convfmt:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/concat5.awk b/test/concat5.awk
new file mode 100644
index 00000000..6bfbb856
--- /dev/null
+++ b/test/concat5.awk
@@ -0,0 +1,7 @@
+BEGIN {
+ OFMT = "%.8g"
+ x = 1
+ x += .1
+ x = (x "a")
+ print x
+}
diff --git a/test/concat5.ok b/test/concat5.ok
new file mode 100644
index 00000000..eea55936
--- /dev/null
+++ b/test/concat5.ok
@@ -0,0 +1 @@
+1.1a