gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] gawk branch, gawk-5.3-stable, updated. gawk-4.1.0-5462-g5378c928


From: Arnold Robbins
Subject: [SCM] gawk branch, gawk-5.3-stable, updated. gawk-4.1.0-5462-g5378c928
Date: Sat, 20 Apr 2024 14:10:29 -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.3-stable has been updated
       via  5378c928f92875e7436e1f722a2c864d65d398f9 (commit)
      from  c01c1d0ba90038a47a96c34df10a01959d7e6841 (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=5378c928f92875e7436e1f722a2c864d65d398f9

commit 5378c928f92875e7436e1f722a2c864d65d398f9
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Sat Apr 20 21:09:57 2024 +0300

    Bug fix for string subscripts.

diff --git a/ChangeLog b/ChangeLog
index 893f832e..0af43c92 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-04-20         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * eval.c (cmp_scalars): Call fixtype() on the values before
+       trying to compare them. Thanks to Ed Morton for the bug
+       report. See test/strsubscript.awk for the test case.
+
 2024-02-29         Arnold D. Robbins     <arnold@skeeve.com>
 
        * re.c (do_sub): Fix arguments in call to SUBPATSTART().
diff --git a/eval.c b/eval.c
index 0fd6859f..b931bbfa 100644
--- a/eval.c
+++ b/eval.c
@@ -1553,6 +1553,9 @@ cmp_scalars(scalar_cmp_t comparison_type)
        t1 = elem_new_to_scalar(t1);
        t2 = elem_new_to_scalar(t2);
 
+       t1 = fixtype(t1);
+       t2 = fixtype(t2);
+
        if (t1->type == Node_var_array) {
                DEREF(t2);
                fatal(_("attempt to use array `%s' in a scalar context"), 
array_vname(t1));
@@ -1583,9 +1586,6 @@ cmp_scalars(scalar_cmp_t comparison_type)
                        break;
                }
        } else {
-               fixtype(t1);
-               fixtype(t2);
-
 #ifdef HAVE_MPFR
                if (do_mpfr)
                        ret = mpg_cmp_as_numbers(t1, t2, comparison_type);
diff --git a/pc/ChangeLog b/pc/ChangeLog
index ff377f21..7f52ad33 100644
--- a/pc/ChangeLog
+++ b/pc/ChangeLog
@@ -1,3 +1,7 @@
+2024-04-20         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * Makefile.tst: Regenerated.
+
 2024-02-29         Arnold D. Robbins     <arnold@skeeve.com>
 
        * Makefile.tst: Regenerated.
diff --git a/pc/Makefile.tst b/pc/Makefile.tst
index 171b7204..5db2d453 100644
--- a/pc/Makefile.tst
+++ b/pc/Makefile.tst
@@ -180,7 +180,7 @@ BASIC_TESTS = \
        substr swaplns synerr1 synerr2 synerr3 tailrecurse tradanch \
        trailbs tweakfld uninit2 uninit3 uninit4 uninit5 uninitialized \
        unterm uparrfs uplus wideidx wideidx2 widesub widesub2 widesub3 \
-       match4 \
+       match4 strsubscript \
        widesub4 wjposer1 zero2 zeroe0 zeroflag
 
 UNIX_TESTS = \
@@ -2608,6 +2608,11 @@ match4:
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+strsubscript:
+       @echo $@
+       @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 widesub4:
        @echo $@ $(ZOS_FAIL)
        @-[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=ENU_USA.1252; export GAWKLOCALE; \
diff --git a/test/ChangeLog b/test/ChangeLog
index a6ac5097..3dd63939 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2024-04-20         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * Makefile.am (EXTRA_DIST): New tests: strsubscript.
+       * strsubscript.awk, strsubscript.ok: New files.
+
 2024-02-29         Arnold D. Robbins     <arnold@skeeve.com>
 
        * Gentests: Add GAWK_TEST_ARGS to .sh tests.
@@ -5,7 +10,7 @@
 2024-01-28         Arnold D. Robbins     <arnold@skeeve.com>
 
        * Makefile.am (EXTRA_DIST): New tests: match4.
-       * match4.awk, match4.ok,
+       * match4.awk, match4.ok: New files.
 
 2023-12-24         Arnold D. Robbins     <arnold@skeeve.com>
 
diff --git a/test/Makefile.am b/test/Makefile.am
index e1e1f3fe..6af8e87e 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1334,6 +1334,8 @@ EXTRA_DIST = \
        strnum1.ok \
        strnum2.awk \
        strnum2.ok \
+       strsubscript.awk \
+       strsubscript.ok \
        strtod.awk \
        strtod.in \
        strtod.ok \
@@ -1546,7 +1548,7 @@ BASIC_TESTS = \
        substr swaplns synerr1 synerr2 synerr3 tailrecurse tradanch \
        trailbs tweakfld uninit2 uninit3 uninit4 uninit5 uninitialized \
        unterm uparrfs uplus wideidx wideidx2 widesub widesub2 widesub3 \
-       match4 \
+       match4 strsubscript \
        widesub4 wjposer1 zero2 zeroe0 zeroflag
 
 UNIX_TESTS = \
diff --git a/test/Makefile.in b/test/Makefile.in
index 8ef6de8a..6f4ce20c 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1598,6 +1598,8 @@ EXTRA_DIST = \
        strnum1.ok \
        strnum2.awk \
        strnum2.ok \
+       strsubscript.awk \
+       strsubscript.ok \
        strtod.awk \
        strtod.in \
        strtod.ok \
@@ -1810,7 +1812,7 @@ BASIC_TESTS = \
        substr swaplns synerr1 synerr2 synerr3 tailrecurse tradanch \
        trailbs tweakfld uninit2 uninit3 uninit4 uninit5 uninitialized \
        unterm uparrfs uplus wideidx wideidx2 widesub widesub2 widesub3 \
-       match4 \
+       match4 strsubscript \
        widesub4 wjposer1 zero2 zeroe0 zeroflag
 
 UNIX_TESTS = \
@@ -4422,6 +4424,11 @@ match4:
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+strsubscript:
+       @echo $@
+       @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 widesub4:
        @echo $@ $(ZOS_FAIL)
        @-[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; export GAWKLOCALE; \
diff --git a/test/Maketests b/test/Maketests
index cb9bdb73..2689b3b2 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1293,6 +1293,11 @@ match4:
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+strsubscript:
+       @echo $@
+       @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 widesub4:
        @echo $@ $(ZOS_FAIL)
        @-[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; export GAWKLOCALE; \
diff --git a/test/strsubscript.awk b/test/strsubscript.awk
new file mode 100644
index 00000000..04444c9b
--- /dev/null
+++ b/test/strsubscript.awk
@@ -0,0 +1 @@
+BEGIN{ a["10"]; for (i in a) { if(i < 2) print i } }
diff --git a/test/strsubscript.ok b/test/strsubscript.ok
new file mode 100644
index 00000000..f599e28b
--- /dev/null
+++ b/test/strsubscript.ok
@@ -0,0 +1 @@
+10

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog             | 6 ++++++
 eval.c                | 6 +++---
 pc/ChangeLog          | 4 ++++
 pc/Makefile.tst       | 7 ++++++-
 test/ChangeLog        | 7 ++++++-
 test/Makefile.am      | 4 +++-
 test/Makefile.in      | 9 ++++++++-
 test/Maketests        | 5 +++++
 test/strsubscript.awk | 1 +
 test/strsubscript.ok  | 1 +
 10 files changed, 43 insertions(+), 7 deletions(-)
 create mode 100644 test/strsubscript.awk
 create mode 100644 test/strsubscript.ok


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]