gawk-diffs
[Top][All Lists]
Advanced

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

[SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4397-g4afcd655


From: Arnold Robbins
Subject: [SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4397-g4afcd655
Date: Thu, 28 Apr 2022 01:40:06 -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.1-stable has been updated
       via  4afcd655d827cc095e20abbf05b4aa5d41122600 (commit)
      from  0171cdeb5ce6f0d43bc41b0a69d706d367370bd0 (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=4afcd655d827cc095e20abbf05b4aa5d41122600

commit 4afcd655d827cc095e20abbf05b4aa5d41122600
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Thu Apr 28 08:39:20 2022 +0300

    Make SYMTAB["x"]["y"] a fatal error also.

diff --git a/ChangeLog b/ChangeLog
index 13f462a9..c8a45aff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-04-28         Arnold D. Robbins     <arnold@skeeve.com>
+
+       Disallow SYMTAB["x"]["y"]. Reported by Jason C. Kwan.
+
+       * interpret.h (r_interpret): Add checks at Op_sub_array case.
+
 2022-04-21         Arnold D. Robbins     <arnold@skeeve.com>
 
        Fix some profiling issues related to comments in switch / case
diff --git a/interpret.h b/interpret.h
index 03adcd79..bda9a01e 100644
--- a/interpret.h
+++ b/interpret.h
@@ -329,6 +329,24 @@ uninitialized_scalar:
                        t2 = mk_sub(pc->sub_count);
                        t1 = POP_ARRAY(false);
                        r = in_array(t1, t2);
+
+                       if (r == NULL) {
+                               t2 = force_string(t2);
+
+                               if (t1 == func_table) {
+                                       fatal(_("reference to uninitialized 
element `%s[\"%.*s\"] is not allowed'"),
+                                               "FUNCTAB", (int) t2->stlen, 
t2->stptr);
+                               } else if (t1 == symbol_table) {
+                                       fatal(_("reference to uninitialized 
element `%s[\"%.*s\"] is not allowed'"),
+                                               "SYMTAB", (int) t2->stlen, 
t2->stptr);
+                               } else if (do_lint) {
+                                       lintwarn(_("reference to uninitialized 
element `%s[\"%.*s\"]'"),
+                                               array_vname(t1), (int) 
t2->stlen, t2->stptr);
+                                       if (t2->stlen == 0)
+                                               lintwarn(_("subscript of array 
`%s' is null string"), array_vname(t1));
+                               }
+                       }
+
                        if (r == NULL) {
                                r = make_array();
                                r->parent_array = t1;
diff --git a/pc/ChangeLog b/pc/ChangeLog
index 814eee19..d2e6a846 100644
--- a/pc/ChangeLog
+++ b/pc/ChangeLog
@@ -1,3 +1,7 @@
+2022-04-28         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * Makefile.tst: Regenerated.
+
 2022-04-27         Arnold D. Robbins     <arnold@skeeve.com>
 
        * Makefile.tst: Regenerated.
diff --git a/pc/Makefile.tst b/pc/Makefile.tst
index 03081946..13971a0f 100644
--- a/pc/Makefile.tst
+++ b/pc/Makefile.tst
@@ -217,6 +217,7 @@ GAWK_EXT_TESTS = \
        strftime strtonum strtonum1 stupid1 stupid2 stupid3 stupid4 stupid5 \
        switch2 symtab1 symtab2 symtab3 symtab4 symtab5 symtab6 symtab7 \
        symtab8 symtab9 symtab10 symtab11 timeout typedregex1 typedregex2 \
+       symtab12 \
        typedregex3 typedregex4 typedregex5 typedregex6 typeof1 typeof2 \
        typeof3 typeof4 typeof5 typeof6 watchpoint1
 
@@ -3386,6 +3387,11 @@ typedregex2:
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+symtab12:
+       @echo $@
+       @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 typedregex3:
        @echo $@
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
diff --git a/test/ChangeLog b/test/ChangeLog
index 91ed0ece..142f8d2d 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2022-04-28         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * Makefile.am (EXTRA_DIST): symtab12, new test.
+       * symtab12.awk, symtab12.ok: New files.
+
 2022-04-27         Arnold D. Robbins     <arnold@skeeve.com>
 
        * Makefile.am (EXTRA_DIST): regex3minus, new test.
diff --git a/test/Makefile.am b/test/Makefile.am
index 3c949a49..33fd4317 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1300,6 +1300,8 @@ EXTRA_DIST = \
        symtab10.ok \
        symtab11.awk \
        symtab11.ok \
+       symtab12.awk \
+       symtab12.ok \
        synerr1.awk \
        synerr1.ok \
        synerr2.awk \
@@ -1480,6 +1482,7 @@ GAWK_EXT_TESTS = \
        strftime strtonum strtonum1 stupid1 stupid2 stupid3 stupid4 stupid5 \
        switch2 symtab1 symtab2 symtab3 symtab4 symtab5 symtab6 symtab7 \
        symtab8 symtab9 symtab10 symtab11 timeout typedregex1 typedregex2 \
+       symtab12 \
        typedregex3 typedregex4 typedregex5 typedregex6 typeof1 typeof2 \
        typeof3 typeof4 typeof5 typeof6 watchpoint1
 
diff --git a/test/Makefile.in b/test/Makefile.in
index ac649b34..5d6f9107 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1566,6 +1566,8 @@ EXTRA_DIST = \
        symtab10.ok \
        symtab11.awk \
        symtab11.ok \
+       symtab12.awk \
+       symtab12.ok \
        synerr1.awk \
        synerr1.ok \
        synerr2.awk \
@@ -1746,6 +1748,7 @@ GAWK_EXT_TESTS = \
        strftime strtonum strtonum1 stupid1 stupid2 stupid3 stupid4 stupid5 \
        switch2 symtab1 symtab2 symtab3 symtab4 symtab5 symtab6 symtab7 \
        symtab8 symtab9 symtab10 symtab11 timeout typedregex1 typedregex2 \
+       symtab12 \
        typedregex3 typedregex4 typedregex5 typedregex6 typeof1 typeof2 \
        typeof3 typeof4 typeof5 typeof6 watchpoint1
 
@@ -5072,6 +5075,11 @@ typedregex2:
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+symtab12:
+       @echo $@
+       @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 typedregex3:
        @echo $@
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 6af82092..9ab86f00 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -2112,6 +2112,11 @@ typedregex2:
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+symtab12:
+       @echo $@
+       @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 typedregex3:
        @echo $@
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
diff --git a/test/symtab12.awk b/test/symtab12.awk
new file mode 100644
index 00000000..cc3d19dd
--- /dev/null
+++ b/test/symtab12.awk
@@ -0,0 +1,7 @@
+BEGIN {
+       for (i in SYMTAB)
+               print i | "sort"
+       close("sort")
+       print "----"
+       SYMTAB["foofoo"]["q"] = "q"
+}
diff --git a/test/symtab12.ok b/test/symtab12.ok
new file mode 100644
index 00000000..b0b7b0ea
--- /dev/null
+++ b/test/symtab12.ok
@@ -0,0 +1,32 @@
+ARGC
+ARGIND
+ARGV
+BINMODE
+CONVFMT
+ENVIRON
+ERRNO
+FIELDWIDTHS
+FILENAME
+FNR
+FPAT
+FS
+IGNORECASE
+LINT
+NF
+NR
+OFMT
+OFS
+ORS
+PREC
+PROCINFO
+RLENGTH
+ROUNDMODE
+RS
+RSTART
+RT
+SUBSEP
+TEXTDOMAIN
+i
+----
+gawk: symtab12.awk:6: fatal: reference to uninitialized element 
`SYMTAB["foofoo"] is not allowed'
+EXIT CODE: 2

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

Summary of changes:
 ChangeLog         |  6 ++++++
 interpret.h       | 18 ++++++++++++++++++
 pc/ChangeLog      |  4 ++++
 pc/Makefile.tst   |  6 ++++++
 test/ChangeLog    |  5 +++++
 test/Makefile.am  |  3 +++
 test/Makefile.in  |  8 ++++++++
 test/Maketests    |  5 +++++
 test/symtab12.awk |  7 +++++++
 test/symtab12.ok  | 32 ++++++++++++++++++++++++++++++++
 10 files changed, 94 insertions(+)
 create mode 100644 test/symtab12.awk
 create mode 100644 test/symtab12.ok


hooks/post-receive
-- 
gawk



reply via email to

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