[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gawk-diffs] [SCM] gawk branch, gawk-4.2-stable, updated. gawk-4.1.0-295
From: |
Arnold Robbins |
Subject: |
[gawk-diffs] [SCM] gawk branch, gawk-4.2-stable, updated. gawk-4.1.0-2952-g0742fa4 |
Date: |
Mon, 2 Apr 2018 09:37:44 -0400 (EDT) |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".
The branch, gawk-4.2-stable has been updated
via 0742fa4072e894ba08babcc5c699bc0f48841ed3 (commit)
from f933fc9f8a05cf51fe94fc1ed24dc2a1586af42c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=0742fa4072e894ba08babcc5c699bc0f48841ed3
commit 0742fa4072e894ba08babcc5c699bc0f48841ed3
Author: Arnold D. Robbins <address@hidden>
Date: Mon Apr 2 16:37:17 2018 +0300
Copy MPZ/MPFR bits also, in r_dupnode.
diff --git a/ChangeLog b/ChangeLog
index ff451ac..c0012ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2018-04-01 Arnold D. Robbins <address@hidden>
+
+ Fix a nasty MPFR bug in r_dupnode. If the value being copied
+ is MPFN / MPFR, copy those bits over too. Thanks to
+ Noah Dean <address@hidden> for the report.
+
+ * node.c (r_dupnode): Check for MPFN / MPFR and copy the bits
+ over as needed.
+
+ Unrelated:
+
+ * interpret.h (UNFIELD): Turn into an inline function and
+ let UNFIELD macro call it, allows stepping in with a debugger.
+ (unfield): Function holding former body of UNFIELD macro.
+
2018-03-26 Arnold D. Robbins <address@hidden>
Remove the tail recursion optimization. It's fundamentally
diff --git a/interpret.h b/interpret.h
index 96e2c89..20fcb7a 100644
--- a/interpret.h
+++ b/interpret.h
@@ -32,16 +32,25 @@
* valref 1, that effectively means that this is an assignment like "$n = $n",
* so a no-op, other than triggering $0 reconstitution.
*/
-#define UNFIELD(l, r) \
-{ \
- /* if was a field, turn it into a var */ \
- if ((r->flags & MALLOC) != 0 || r->valref == 1) { \
- l = r; \
- } else { \
- l = dupnode(r); \
- DEREF(r); \
- } \
+
+// not a macro so we can step into it with a debugger
+#ifndef UNFIELD_DEFINED
+#define UNFIELD_DEFINED 1
+static inline void
+unfield(NODE **l, NODE **r)
+{
+ /* if was a field, turn it into a var */
+ if (((*r)->flags & MALLOC) != 0 || (*r)->valref == 1) {
+ (*l) = (*r);
+ } else {
+ (*l) = dupnode(*r);
+ DEREF(*r);
+ }
}
+
+#define UNFIELD(l, r) unfield(& (l), & (r))
+#endif
+
int
r_interpret(INSTRUCTION *code)
{
diff --git a/node.c b/node.c
index add959f..fcd2bf3 100644
--- a/node.c
+++ b/node.c
@@ -306,8 +306,24 @@ r_dupnode(NODE *n)
}
#endif
- getnode(r);
- *r = *n;
+#ifdef HAVE_MPFR
+ if ((n->flags & MPZN) != 0) {
+ r = mpg_integer();
+ mpz_set(r->mpg_i, n->mpg_i);
+ r->flags = n->flags;
+ } else if ((n->flags & MPFN) != 0) {
+ r = mpg_float();
+ int tval = mpfr_set(r->mpg_numbr, n->mpg_numbr, ROUND_MODE);
+ IEEE_FMT(r->mpg_numbr, tval);
+ r->flags = n->flags;
+ } else {
+#endif
+ getnode(r);
+ *r = *n;
+#ifdef HAVE_MPFR
+ }
+#endif
+
r->flags |= MALLOC;
r->valref = 1;
/*
diff --git a/test/ChangeLog b/test/ChangeLog
index e075e3a..5f806e1 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,9 @@
+2018-04-01 Arnold D. Robbins <address@hidden>
+
+ * Makefile.am (EXTRA_DIST): Add files for mpfrfield.
+ (MPFR_TESTS): Add mpfrfield.
+ * mpfrfield.awk, mpfrfield.awk, mpfrfield.ok: New files.
+
2018-03-26 Arnold D. Robbins <address@hidden>
* fwtest3.in, mmap8k.awk, mmap8k.ok, rsstart2.in: New files.
diff --git a/test/Makefile.am b/test/Makefile.am
index bfb0c4b..fe4fd81 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -658,6 +658,9 @@ EXTRA_DIST = \
mpfrbigint.ok \
mpfrexprange.awk \
mpfrexprange.ok \
+ mpfrfield.awk \
+ mpfrfield.in \
+ mpfrfield.ok \
mpfrieee.awk \
mpfrieee.ok \
mpfrmemok1.awk \
@@ -1307,8 +1310,8 @@ INET_TESTS = inetdayu inetdayt inetechu inetecht
MACHINE_TESTS = double1 double2 fmtspcl intformat
-MPFR_TESTS = mpfrbigint mpfrexprange mpfrieee mpfrmemok1 mpfrnegzero \
- mpfrnr mpfrrem mpfrrnd mpfrrndeval mpfrsort mpfrsqrt \
+MPFR_TESTS = mpfrbigint mpfrexprange mpfrfield mpfrieee mpfrmemok1 \
+ mpfrnegzero mpfrnr mpfrrem mpfrrnd mpfrrndeval mpfrsort mpfrsqrt \
mpfrstrtonum mpgforcenum mpfruplus
LOCALE_CHARSET_TESTS = \
@@ -2140,6 +2143,11 @@ mpfrmemok1:
@$(AWK) -p- -M -f "$(srcdir)"/address@hidden 2>&1 | sed 1d > _$@
@-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+mpfrfield:
+ @echo $@
+ @$(AWK) -M -f "$(srcdir)"/address@hidden "$(srcdir)"/address@hidden >
_$@ 2>&1
+ @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
jarebug::
@echo $@
@"$(srcdir)"/address@hidden "$(AWKPROG)" "$(srcdir)"/address@hidden
"$(srcdir)"/address@hidden "_$@"
diff --git a/test/Makefile.in b/test/Makefile.in
index 1f2ff76..33e2b0b 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -916,6 +916,9 @@ EXTRA_DIST = \
mpfrbigint.ok \
mpfrexprange.awk \
mpfrexprange.ok \
+ mpfrfield.awk \
+ mpfrfield.in \
+ mpfrfield.ok \
mpfrieee.awk \
mpfrieee.ok \
mpfrmemok1.awk \
@@ -1560,8 +1563,8 @@ ARRAYDEBUG_TESTS = arrdbg
EXTRA_TESTS = inftest regtest ignrcas3
INET_TESTS = inetdayu inetdayt inetechu inetecht
MACHINE_TESTS = double1 double2 fmtspcl intformat
-MPFR_TESTS = mpfrbigint mpfrexprange mpfrieee mpfrmemok1 mpfrnegzero \
- mpfrnr mpfrrem mpfrrnd mpfrrndeval mpfrsort mpfrsqrt \
+MPFR_TESTS = mpfrbigint mpfrexprange mpfrfield mpfrieee mpfrmemok1 \
+ mpfrnegzero mpfrnr mpfrrem mpfrrnd mpfrrndeval mpfrsort mpfrsqrt \
mpfrstrtonum mpgforcenum mpfruplus
LOCALE_CHARSET_TESTS = \
@@ -2580,6 +2583,11 @@ mpfrmemok1:
@$(AWK) -p- -M -f "$(srcdir)"/address@hidden 2>&1 | sed 1d > _$@
@-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+mpfrfield:
+ @echo $@
+ @$(AWK) -M -f "$(srcdir)"/address@hidden "$(srcdir)"/address@hidden >
_$@ 2>&1
+ @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
jarebug::
@echo $@
@"$(srcdir)"/address@hidden "$(AWKPROG)" "$(srcdir)"/address@hidden
"$(srcdir)"/address@hidden "_$@"
diff --git a/test/mpfrfield.awk b/test/mpfrfield.awk
new file mode 100644
index 0000000..35a97b7
--- /dev/null
+++ b/test/mpfrfield.awk
@@ -0,0 +1,14 @@
+#! /bin/gawk -Mf
+
+NR == 1 {
+ min = $1
+}
+
+{
+ if ($1 < min)
+ min = $1
+}
+
+END {
+ print "min", min
+}
diff --git a/test/mpfrfield.in b/test/mpfrfield.in
new file mode 100644
index 0000000..05d3344
--- /dev/null
+++ b/test/mpfrfield.in
@@ -0,0 +1,10 @@
+7
+9
+1
+3
+9
+1
+9
+5
+0
+8
diff --git a/test/mpfrfield.ok b/test/mpfrfield.ok
new file mode 100644
index 0000000..3736de4
--- /dev/null
+++ b/test/mpfrfield.ok
@@ -0,0 +1 @@
+min 0
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 15 +++++++++++++++
interpret.h | 27 ++++++++++++++++++---------
node.c | 20 ++++++++++++++++++--
test/ChangeLog | 6 ++++++
test/Makefile.am | 12 ++++++++++--
test/Makefile.in | 12 ++++++++++--
test/mpfrfield.awk | 14 ++++++++++++++
test/{ofmtfidl.in => mpfrfield.in} | 12 ++++++------
test/mpfrfield.ok | 1 +
9 files changed, 98 insertions(+), 21 deletions(-)
create mode 100644 test/mpfrfield.awk
copy test/{ofmtfidl.in => mpfrfield.in} (57%)
create mode 100644 test/mpfrfield.ok
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gawk-diffs] [SCM] gawk branch, gawk-4.2-stable, updated. gawk-4.1.0-2952-g0742fa4,
Arnold Robbins <=