[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] gawk branch, gawk-5.2-stable, updated. gawk-4.1.0-4932-ge5eb1da0
From: |
Arnold Robbins |
Subject: |
[SCM] gawk branch, gawk-5.2-stable, updated. gawk-4.1.0-4932-ge5eb1da0 |
Date: |
Sun, 23 Oct 2022 07:19:03 -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-5.2-stable has been updated
via e5eb1da0433a827dbca1e0e35ab1629234ea97aa (commit)
via ea6d296a752f447655e954ae51027072cb4e075e (commit)
via 642351414f874a9632d985ef1bd0dde9df9eac9b (commit)
from 8f04cdf533547184cf1cb42f1a27659ef0cfd2d0 (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=e5eb1da0433a827dbca1e0e35ab1629234ea97aa
commit e5eb1da0433a827dbca1e0e35ab1629234ea97aa
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Sun Oct 23 14:18:37 2022 +0300
Fix parse-time division by zero check.
diff --git a/ChangeLog b/ChangeLog
index e325d147..bbc4f053 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-10-23 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awkgram.y (mk_binary): Check that divisor is a number before
+ checking it's zero. Thanks to Ben Hoyt <benhoyt@gmail.com> for
+ the report.
+
2022-10-20 Paul Eggert <eggert@cs.ucla.edu>
Port to current Gnulib
diff --git a/awkgram.c b/awkgram.c
index f4a41011..1830b597 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -7985,7 +7985,7 @@ mk_binary(INSTRUCTION *s1, INSTRUCTION *s2, INSTRUCTION
*op)
res *= n2->numbr;
break;
case Op_quotient:
- if (n2->numbr == 0.0) {
+ if ((n2->flags & NUMBER) != 0 && n2->numbr ==
0.0) {
/* don't fatalize, allow parsing rest
of the input */
error_ln(op->source_line, _("division
by zero attempted"));
goto regular;
@@ -7994,7 +7994,7 @@ mk_binary(INSTRUCTION *s1, INSTRUCTION *s2, INSTRUCTION
*op)
res /= n2->numbr;
break;
case Op_mod:
- if (n2->numbr == 0.0) {
+ if ((n2->flags & NUMBER) != 0 && n2->numbr ==
0.0) {
/* don't fatalize, allow parsing rest
of the input */
error_ln(op->source_line, _("division
by zero attempted in `%%'"));
goto regular;
@@ -8038,7 +8038,7 @@ mk_binary(INSTRUCTION *s1, INSTRUCTION *s2, INSTRUCTION
*op)
op->opcode = Op_times_i;
break;
case Op_quotient:
- if (ip2->memory->numbr == 0.0) {
+ if ((ip2->memory->flags & NUMBER) != 0 &&
ip2->memory->numbr == 0.0) {
/* don't fatalize, allow parsing rest
of the input */
error_ln(op->source_line, _("division
by zero attempted"));
goto regular;
@@ -8047,7 +8047,7 @@ mk_binary(INSTRUCTION *s1, INSTRUCTION *s2, INSTRUCTION
*op)
op->opcode = Op_quotient_i;
break;
case Op_mod:
- if (ip2->memory->numbr == 0.0) {
+ if ((ip2->memory->flags & NUMBER) != 0 &&
ip2->memory->numbr == 0.0) {
/* don't fatalize, allow parsing rest
of the input */
error_ln(op->source_line, _("division
by zero attempted in `%%'"));
goto regular;
diff --git a/awkgram.y b/awkgram.y
index 8633d55d..7bd19e86 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -5483,7 +5483,7 @@ mk_binary(INSTRUCTION *s1, INSTRUCTION *s2, INSTRUCTION
*op)
res *= n2->numbr;
break;
case Op_quotient:
- if (n2->numbr == 0.0) {
+ if ((n2->flags & NUMBER) != 0 && n2->numbr ==
0.0) {
/* don't fatalize, allow parsing rest
of the input */
error_ln(op->source_line, _("division
by zero attempted"));
goto regular;
@@ -5492,7 +5492,7 @@ mk_binary(INSTRUCTION *s1, INSTRUCTION *s2, INSTRUCTION
*op)
res /= n2->numbr;
break;
case Op_mod:
- if (n2->numbr == 0.0) {
+ if ((n2->flags & NUMBER) != 0 && n2->numbr ==
0.0) {
/* don't fatalize, allow parsing rest
of the input */
error_ln(op->source_line, _("division
by zero attempted in `%%'"));
goto regular;
@@ -5536,7 +5536,7 @@ mk_binary(INSTRUCTION *s1, INSTRUCTION *s2, INSTRUCTION
*op)
op->opcode = Op_times_i;
break;
case Op_quotient:
- if (ip2->memory->numbr == 0.0) {
+ if ((ip2->memory->flags & NUMBER) != 0 &&
ip2->memory->numbr == 0.0) {
/* don't fatalize, allow parsing rest
of the input */
error_ln(op->source_line, _("division
by zero attempted"));
goto regular;
@@ -5545,7 +5545,7 @@ mk_binary(INSTRUCTION *s1, INSTRUCTION *s2, INSTRUCTION
*op)
op->opcode = Op_quotient_i;
break;
case Op_mod:
- if (ip2->memory->numbr == 0.0) {
+ if ((ip2->memory->flags & NUMBER) != 0 &&
ip2->memory->numbr == 0.0) {
/* don't fatalize, allow parsing rest
of the input */
error_ln(op->source_line, _("division
by zero attempted in `%%'"));
goto regular;
diff --git a/pc/ChangeLog b/pc/ChangeLog
index 3828cf9d..80c12b42 100644
--- a/pc/ChangeLog
+++ b/pc/ChangeLog
@@ -1,3 +1,7 @@
+2022-10-23 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.tst: Regenerated.
+
2022-10-21 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.tst: Regenerated.
diff --git a/pc/Makefile.tst b/pc/Makefile.tst
index c25dc18e..3e896b19 100644
--- a/pc/Makefile.tst
+++ b/pc/Makefile.tst
@@ -150,7 +150,8 @@ BASIC_TESTS = \
back89 backgsub badassign1 badbuild callparam childin clobber \
closebad close_status clsflnam compare compare2 concat1 concat2 \
concat3 concat4 concat5 convfmt datanonl defref delargv delarpm2 \
- delarprm delfunc dfacheck2 dfamb1 dfastress divzero dynlj eofsplit \
+ delarprm delfunc dfacheck2 dfamb1 dfastress divzero divzero2 \
+ dynlj eofsplit \
eofsrc1 escapebrace exit2 exitval1 exitval2 exitval3 fcall_exit \
fcall_exit2 fldchg fldchgnf fldterm fnamedat fnarray fnarray2 \
fnaryscl fnasgnm fnmisc fordel forref forsimp fsbs fscaret fsnul1 \
@@ -1581,6 +1582,11 @@ divzero:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+divzero2:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
dynlj:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
diff --git a/test/ChangeLog b/test/ChangeLog
index b5aceb02..6db53972 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2022-10-23 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (EXTRA_DIST): New test: divzero2.
+ * divzero2.awk, divzero2.ok: New files.
+
2022-10-14 Andrew J. Schorr <aschorr@telemetry-investments.com>
* Makefile.am (readall): Capture stderr from the programs also.
diff --git a/test/Makefile.am b/test/Makefile.am
index 5ee35ad9..3d6d0072 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -276,6 +276,8 @@ EXTRA_DIST = \
dfastress.ok \
divzero.awk \
divzero.ok \
+ divzero2.awk \
+ divzero2.ok \
double1.awk \
double1.ok \
double2.awk \
@@ -1452,7 +1454,8 @@ BASIC_TESTS = \
back89 backgsub badassign1 badbuild callparam childin clobber \
closebad close_status clsflnam compare compare2 concat1 concat2 \
concat3 concat4 concat5 convfmt datanonl defref delargv delarpm2 \
- delarprm delfunc dfacheck2 dfamb1 dfastress divzero dynlj eofsplit \
+ delarprm delfunc dfacheck2 dfamb1 dfastress divzero divzero2 \
+ dynlj eofsplit \
eofsrc1 escapebrace exit2 exitval1 exitval2 exitval3 fcall_exit \
fcall_exit2 fldchg fldchgnf fldterm fnamedat fnarray fnarray2 \
fnaryscl fnasgnm fnmisc fordel forref forsimp fsbs fscaret fsnul1 \
diff --git a/test/Makefile.in b/test/Makefile.in
index cdf26e65..f8391864 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -544,6 +544,8 @@ EXTRA_DIST = \
dfastress.ok \
divzero.awk \
divzero.ok \
+ divzero2.awk \
+ divzero2.ok \
double1.awk \
double1.ok \
double2.awk \
@@ -1720,7 +1722,8 @@ BASIC_TESTS = \
back89 backgsub badassign1 badbuild callparam childin clobber \
closebad close_status clsflnam compare compare2 concat1 concat2 \
concat3 concat4 concat5 convfmt datanonl defref delargv delarpm2 \
- delarprm delfunc dfacheck2 dfamb1 dfastress divzero dynlj eofsplit \
+ delarprm delfunc dfacheck2 dfamb1 dfastress divzero divzero2 \
+ dynlj eofsplit \
eofsrc1 escapebrace exit2 exitval1 exitval2 exitval3 fcall_exit \
fcall_exit2 fldchg fldchgnf fldterm fnamedat fnarray fnarray2 \
fnaryscl fnasgnm fnmisc fordel forref forsimp fsbs fscaret fsnul1 \
@@ -3340,6 +3343,11 @@ divzero:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+divzero2:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
dynlj:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 43672fa7..f708f055 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -282,6 +282,11 @@ divzero:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+divzero2:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
dynlj:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
diff --git a/test/divzero2.awk b/test/divzero2.awk
new file mode 100644
index 00000000..ffe449d5
--- /dev/null
+++ b/test/divzero2.awk
@@ -0,0 +1,2 @@
+# This program should NOT print error division by zero.
+BEGIN { print "2" / "3" }
diff --git a/test/divzero2.ok b/test/divzero2.ok
new file mode 100644
index 00000000..6d0430ff
--- /dev/null
+++ b/test/divzero2.ok
@@ -0,0 +1 @@
+0.666667
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 20 ++
Makefile.in | 20 +-
NEWS | 18 +-
aclocal.m4 | 1 +
awk.h | 1 -
awkgram.c | 8 +-
awkgram.y | 8 +-
awklib/Makefile.in | 20 +-
configh.in | 25 ++-
configure | 142 ++-----------
configure.ac | 2 +-
doc/Makefile.in | 20 +-
extras/Makefile.in | 20 +-
m4/c-bool.m4 | 51 +++++
missing_d/ChangeLog | 9 +
missing_d/mktime.c | 494 ++++++++++++++++++----------------------------
pc/ChangeLog | 8 +
pc/Makefile.tst | 12 +-
support/ChangeLog | 10 +
support/Makefile.in | 20 +-
support/dfa.h | 1 -
support/localeinfo.h | 1 -
support/malloc/dynarray.h | 1 -
support/regex_internal.h | 1 -
test/ChangeLog | 5 +
test/Makefile.am | 5 +-
test/Makefile.in | 34 ++--
test/Maketests | 5 +
test/divzero2.awk | 2 +
test/divzero2.ok | 1 +
30 files changed, 448 insertions(+), 517 deletions(-)
create mode 100644 m4/c-bool.m4
create mode 100644 test/divzero2.awk
create mode 100644 test/divzero2.ok
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] gawk branch, gawk-5.2-stable, updated. gawk-4.1.0-4932-ge5eb1da0,
Arnold Robbins <=