gawk-diffs
[Top][All Lists]
Advanced

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

[gawk-diffs] [SCM] gawk branch, feature/fixtype, updated. gawk-4.1.0-188


From: Andrew J. Schorr
Subject: [gawk-diffs] [SCM] gawk branch, feature/fixtype, updated. gawk-4.1.0-1888-gb3fa425
Date: Mon, 4 Jul 2016 14:34:33 +0000 (UTC)

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, feature/fixtype has been updated
       via  b3fa425feb23dd36e82d4dd71f0bc1e03495a46b (commit)
      from  ff4e0706c5ee5dffd69168ebd0ff5f53e474d048 (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=b3fa425feb23dd36e82d4dd71f0bc1e03495a46b

commit b3fa425feb23dd36e82d4dd71f0bc1e03495a46b
Author: Andrew J. Schorr <address@hidden>
Date:   Mon Jul 4 10:34:00 2016 -0400

    It is OK to use a strnum as a string array subscript, since we now respect 
the string value.

diff --git a/ChangeLog b/ChangeLog
index ecd9305..feb84d1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2016-07-04         Andrew J. Schorr     <address@hidden>
+
+       * str_array.c (str_lookup): There is no need to worry about the
+       MAYBE_NUM flag, since the code has been patched to make sure to
+       preserve the string value of strnum values, and the integer array
+       code should no longer mistakenly claim a strnum integer with a
+       nonstandard string representation.
+
 2016-07-03         Andrew J. Schorr     <address@hidden>
 
        * field.c (rebuild_record): Revert warning message regarding flags,
diff --git a/str_array.c b/str_array.c
index f66b22c..e8ce973 100644
--- a/str_array.c
+++ b/str_array.c
@@ -164,11 +164,9 @@ str_lookup(NODE *symbol, NODE *subs)
         * "Array indices are always strings."
         * "Array indices are always strings."
         * ....
-        * If subs is a STRNUM, copy it; don't clear the MAYBE_NUM
-        * flag on it since other variables could be using the same
-        * reference-counted value.
         */
-       if (subs->stfmt != STFMT_UNUSED || (subs->flags & MAYBE_NUM) != 0) {
+       if (subs->stfmt != STFMT_UNUSED) {
+               /* The string was generated using CONVFMT. */
                NODE *tmp;
 
                /*
@@ -199,8 +197,6 @@ str_lookup(NODE *symbol, NODE *subs)
                subs = dupnode(subs);
        }
 
-       assert((subs->flags & MAYBE_NUM) == 0);
-
        getbucket(b);
        b->ahnext = symbol->buckets[hash1];
        symbol->buckets[hash1] = b;
diff --git a/test/ChangeLog b/test/ChangeLog
index 8b4d70e..5897906 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2016-07-04         Andrew J. Schorr     <address@hidden>
+
+       * Makefile.am (arrayind3): New test.
+       * arrayind3.awk, arrayind3.ok: New files.
+
 2016-07-03         Andrew J. Schorr     <address@hidden>
 
        * Makefile.am (rebuild): New test.
diff --git a/test/Makefile.am b/test/Makefile.am
index 3a51b3f..a13a01c 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -57,6 +57,8 @@ EXTRA_DIST = \
        arrayind1.ok \
        arrayind2.awk \
        arrayind2.ok \
+       arrayind3.awk \
+       arrayind3.ok \
        arrayparm.awk \
        arrayparm.ok \
        arrayprm2.awk \
@@ -1137,7 +1139,7 @@ CLEANFILES = core core.* fmtspcl.ok
 
 # try to keep these sorted. each letter starts a new line
 BASIC_TESTS = \
-       addcomma anchgsub argarray arrayind1 arrayind2 arrayparm arrayprm2 
arrayprm3 \
+       addcomma anchgsub argarray arrayind1 arrayind2 arrayind3 arrayparm 
arrayprm2 arrayprm3 \
        arrayref arrymem1 arryref2 arryref3 arryref4 arryref5 arynasty \
        arynocls aryprm1 aryprm2 aryprm3 aryprm4 aryprm5 aryprm6 aryprm7 \
        aryprm8 aryprm9 arysubnm asgext awkpath \
diff --git a/test/Makefile.in b/test/Makefile.in
index 2906432..6db4c34 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -314,6 +314,8 @@ EXTRA_DIST = \
        arrayind1.ok \
        arrayind2.awk \
        arrayind2.ok \
+       arrayind3.awk \
+       arrayind3.ok \
        arrayparm.awk \
        arrayparm.ok \
        arrayprm2.awk \
@@ -1393,7 +1395,7 @@ CLEANFILES = core core.* fmtspcl.ok
 
 # try to keep these sorted. each letter starts a new line
 BASIC_TESTS = \
-       addcomma anchgsub argarray arrayind1 arrayind2 arrayparm arrayprm2 
arrayprm3 \
+       addcomma anchgsub argarray arrayind1 arrayind2 arrayind3 arrayparm 
arrayprm2 arrayprm3 \
        arrayref arrymem1 arryref2 arryref3 arryref4 arryref5 arynasty \
        arynocls aryprm1 aryprm2 aryprm3 aryprm4 aryprm5 aryprm6 aryprm7 \
        aryprm8 aryprm9 arysubnm asgext awkpath \
@@ -2775,6 +2777,11 @@ arrayind2:
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
 
+arrayind3:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
 arrayparm:
        @echo $@
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 525a44d..2aafd2b 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -20,6 +20,11 @@ arrayind2:
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
 
+arrayind3:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
 arrayparm:
        @echo $@
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
diff --git a/test/arrayind3.awk b/test/arrayind3.awk
new file mode 100644
index 0000000..ca4c58b
--- /dev/null
+++ b/test/arrayind3.awk
@@ -0,0 +1,19 @@
+BEGIN {
+       # initialize cint arrays
+        pos[0] = 0
+        posout[0] = 0
+        split("00000779770060", f)      # f[1] is a strnum
+        pos[f[1]] = 1                   # subscripts must be strings!
+        for (x in pos) {
+                # if x is a strnum, then the
+                # x != 0 test may convert it to an integral NUMBER,
+               # and we might lose the unusual string representation
+               # if the cint code is not careful to recognize that this is
+               # actually a string
+                if (x != 0)
+                        posout[x] = pos[x]
+        }
+        # which array element is populated?
+        print posout[779770060]
+        print posout["00000779770060"]
+}
diff --git a/test/arrayind3.ok b/test/arrayind3.ok
new file mode 100644
index 0000000..a464d9d
--- /dev/null
+++ b/test/arrayind3.ok
@@ -0,0 +1,2 @@
+
+1

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

Summary of changes:
 ChangeLog                           |    8 ++++++++
 str_array.c                         |    8 ++------
 test/ChangeLog                      |    5 +++++
 test/Makefile.am                    |    4 +++-
 test/Makefile.in                    |    9 ++++++++-
 test/Maketests                      |    5 +++++
 test/arrayind3.awk                  |   19 +++++++++++++++++++
 test/{arrayprm3.ok => arrayind3.ok} |    1 +
 8 files changed, 51 insertions(+), 8 deletions(-)
 create mode 100644 test/arrayind3.awk
 copy test/{arrayprm3.ok => arrayind3.ok} (66%)


hooks/post-receive
-- 
gawk



reply via email to

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