aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--awkgram.c13
-rw-r--r--awkgram.y13
-rw-r--r--dfa.c8
-rw-r--r--pc/ChangeLog6
-rw-r--r--pc/Makefile.tst8
-rw-r--r--test/ChangeLog5
-rw-r--r--test/strftime.awk6
8 files changed, 51 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index 484af75e..32e543df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2014-01-28 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awkgram.y (negate_num): If just a double, return. Fixes a bug
+ that showed up on 32-bit systems with MPFR. Thanks to Eli Zaretskii
+ and Corinna Vinschen for the report. Also, free the MPZ integer.
+ Thanks to valgrind for the report.
+
+ Unrelated:
+
+ * dfa.c: Sync with GNU grep - removed some special cased code
+ for grep.
+
2014-01-24 Arnold D. Robbins <arnold@skeeve.com>
* configure.ac, field.c: Update copyright year.
diff --git a/awkgram.c b/awkgram.c
index 657a1627..58ac3480 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -4514,10 +4514,13 @@ negate_num(NODE *n)
{
int tval = 0;
- if (! is_mpg_number(n))
+ if (! is_mpg_number(n)) {
n->numbr = -n->numbr;
+ return;
+ }
+
#ifdef HAVE_MPFR
- else if (is_mpg_integer(n)) {
+ if (is_mpg_integer(n)) {
if (! iszero(n)) {
mpz_neg(n->mpg_i, n->mpg_i);
return;
@@ -4526,9 +4529,11 @@ negate_num(NODE *n)
/*
* 0 --> -0 conversion. Requires turning the MPG integer
* into an MPFR float.
- *
- * So, convert and fall through.
*/
+
+ mpz_clear(n->mpg_i); /* release the integer storage */
+
+ /* Convert and fall through. */
tval = mpfr_set_d(n->mpg_numbr, 0.0, ROUND_MODE);
IEEE_FMT(n->mpg_numbr, tval);
n->flags &= ~MPZN;
diff --git a/awkgram.y b/awkgram.y
index fd83d6db..6bbc150a 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -1966,10 +1966,13 @@ negate_num(NODE *n)
{
int tval = 0;
- if (! is_mpg_number(n))
+ if (! is_mpg_number(n)) {
n->numbr = -n->numbr;
+ return;
+ }
+
#ifdef HAVE_MPFR
- else if (is_mpg_integer(n)) {
+ if (is_mpg_integer(n)) {
if (! iszero(n)) {
mpz_neg(n->mpg_i, n->mpg_i);
return;
@@ -1978,9 +1981,11 @@ negate_num(NODE *n)
/*
* 0 --> -0 conversion. Requires turning the MPG integer
* into an MPFR float.
- *
- * So, convert and fall through.
*/
+
+ mpz_clear(n->mpg_i); /* release the integer storage */
+
+ /* Convert and fall through. */
tval = mpfr_set_d(n->mpg_numbr, 0.0, ROUND_MODE);
IEEE_FMT(n->mpg_numbr, tval);
n->flags &= ~MPZN;
diff --git a/dfa.c b/dfa.c
index ac1cf9a0..ef456e11 100644
--- a/dfa.c
+++ b/dfa.c
@@ -1136,7 +1136,6 @@ parse_bracket_exp (void)
work_mbc->range_ends[work_mbc->nranges++] =
case_fold ? towlower (wc2) : (wchar_t) wc2;
-#ifndef GREP
if (case_fold && (iswalpha (wc) || iswalpha (wc2)))
{
REALLOC_IF_NECESSARY (work_mbc->range_sts,
@@ -1146,7 +1145,6 @@ parse_bracket_exp (void)
range_ends_al, work_mbc->nranges + 1);
work_mbc->range_ends[work_mbc->nranges++] = towupper (wc2);
}
-#endif
}
else
{
@@ -1182,11 +1180,7 @@ parse_bracket_exp (void)
work_mbc->nchars + 1);
work_mbc->chars[work_mbc->nchars++] = wc;
}
-#ifdef GREP
- continue;
-#else
wc = towupper (wc);
-#endif
}
if (!setbit_wc (wc, ccl))
{
@@ -1780,13 +1774,11 @@ atom (void)
else if (MBS_SUPPORT && tok == WCHAR)
{
addtok_wc (case_fold ? towlower (wctok) : wctok);
-#ifndef GREP
if (case_fold && iswalpha (wctok))
{
addtok_wc (towupper (wctok));
addtok (OR);
}
-#endif
tok = lex ();
}
diff --git a/pc/ChangeLog b/pc/ChangeLog
index c18e087e..5f75283f 100644
--- a/pc/ChangeLog
+++ b/pc/ChangeLog
@@ -1,3 +1,9 @@
+2014-01-28 Eli Zaretskii <eliz@gnu.org>
+
+ * Makefile.tst (strftime): Pass the value of 'date' command
+ through the DATECMD variable.
+ (readdir): Adapt to changes in test/readdir0.awk.
+
2014-01-20 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.tst (mbprintf4, backbigs1, backsmalls1): Add warning
diff --git a/pc/Makefile.tst b/pc/Makefile.tst
index c0ec07a1..e843eaa7 100644
--- a/pc/Makefile.tst
+++ b/pc/Makefile.tst
@@ -439,7 +439,7 @@ strftime::
# (LC_ALL=C date) | $(AWK) -v OUTPUT=_$@ -f "$(srcdir)"/strftime.awk
@GAWKLOCALE=C; export GAWKLOCALE; \
TZ=GMT0; export TZ; \
- (LC_ALL=C $(DATE)) | $(AWK) -v OUTPUT=_$@ -f "$(srcdir)"/strftime.awk
+ $(AWK) -v OUTPUT=_$@ -v DATECMD="$(DATE)" -f "$(srcdir)"/strftime.awk
@-$(CMP) strftime.ok _$@ && rm -f _$@ strftime.ok || exit 0
litoct::
@@ -1039,8 +1039,10 @@ readdir:
@echo $@
@echo This test may fail on MinGW if $(LS) does not report full Windows file index as the inode
@$(AWK) -f "$(srcdir)"/readdir.awk $(top_srcdir) > _$@
-# @ls -afli $(top_srcdir) | sed 1d | $(AWK) -f "$(srcdir)"/readdir0.awk -v extout=_$@ $(top_srcdir) > $@.ok
- @$(LS) -afli $(top_srcdir) | sed 1d | $(AWK) -f "$(srcdir)"/readdir0.awk -v extout=_$@ $(top_srcdir) > $@.ok
+ @$(LS) -afi "$(top_srcdir)" > _dirlist
+ @$(LS) -lna "$(top_srcdir)" | sed 1d > _longlist
+ @$(AWK) -f "$(srcdir)"/readdir0.awk -v extout=_$@ \
+ -v dirlist=_dirlist -v longlist=_longlist > $@.ok
@-$(CMP) $@.ok _$@ && rm -f $@.ok _$@
fts:
diff --git a/test/ChangeLog b/test/ChangeLog
index 58749a43..b655322a 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2014-01-28 Eli Zaretskii <eliz@gnu.org>
+
+ * strftime.awk: If DATECMD variable is non-empty, use it instead
+ of the literal "date" as the 'date'-like command.
+
2014-01-19 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.am (mpfrnegzero): New test.
diff --git a/test/strftime.awk b/test/strftime.awk
index a52957f0..73cdc698 100644
--- a/test/strftime.awk
+++ b/test/strftime.awk
@@ -8,7 +8,11 @@
BEGIN {
maxtries = 10
- datecmd = "date"
+ # On DOS/Windows, DATECMD is set by the Makefile to point to
+ # Unix-like 'date' command.
+ datecmd = DATECMD
+ if (datecmd == "")
+ datecmd = "date"
fmt = "%a %b %d %H:%M:%S %Z %Y"
# loop until before equals after, thereby protecting