gawk-diffs
[Top][All Lists]
Advanced

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

[gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-895


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-895-g14d958c
Date: Thu, 26 May 2016 20:23:21 +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, gawk-4.1-stable has been updated
       via  14d958c82b939d26ad37ab0c0debfedf780404d0 (commit)
       via  2af19378be4e7eeec7754053070cf4bad035d7b1 (commit)
      from  41412a86f2ca0baf908fe0b2e4bcc396f66989ae (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=14d958c82b939d26ad37ab0c0debfedf780404d0

commit 14d958c82b939d26ad37ab0c0debfedf780404d0
Author: Arnold D. Robbins <address@hidden>
Date:   Thu May 26 16:22:59 2016 -0400

    Further fix for MAYBE_NUM values used as array subscripts.

diff --git a/ChangeLog b/ChangeLog
index ee6ff43..4b6e88d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,10 @@
        * awk.h [fatal]: Make parentheses and use of indirection
        consistent with warning and lintwarn. Thanks to Andrew Schorr
        for pointing this out.
+       * str_array.c (str_lookup): Move test for MAYBE_NUM to where
+       we duplicate the subscript. Removing it across the board is
+       wrong if there are multiple references to the value. Thanks
+       to Andrew Schorr for discussion and test case.
 
 2016-05-26         Andrew J. Schorr     <address@hidden>
 
diff --git a/str_array.c b/str_array.c
index 9514d51..1de432c 100644
--- a/str_array.c
+++ b/str_array.c
@@ -137,7 +137,18 @@ str_lookup(NODE *symbol, NODE *subs)
                hash1 = code1 % (unsigned long) symbol->array_size;
        }
 
-       if (subs->stfmt != -1) {
+
+       /*
+        * Repeat after me: "Array indices are always strings."
+        * "Array indices are always strings."
+        * "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 != -1 || (subs->flags & MAYBE_NUM) != 0) {
                NODE *tmp;
 
                /*
@@ -168,14 +179,7 @@ str_lookup(NODE *symbol, NODE *subs)
                subs = dupnode(subs);
        }
 
-       /*
-        * Repeat after me: "Array indices are always strings."
-        * "Array indices are always strings."
-        * "Array indices are always strings."
-        * "Array indices are always strings."
-        * ....
-        */
-       subs->flags &= ~MAYBE_NUM;
+       assert((subs->flags & MAYBE_NUM) == 0);
 
        getbucket(b);
        b->ahnext = symbol->buckets[hash1];

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=2af19378be4e7eeec7754053070cf4bad035d7b1

commit 2af19378be4e7eeec7754053070cf4bad035d7b1
Author: Arnold D. Robbins <address@hidden>
Date:   Thu May 26 16:17:12 2016 -0400

    Improve definition of fatal macro.

diff --git a/ChangeLog b/ChangeLog
index 8d408e1..ee6ff43 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,13 @@
+2016-05-26         Arnold D. Robbins     <address@hidden>
+
+       * awk.h [fatal]: Make parentheses and use of indirection
+       consistent with warning and lintwarn. Thanks to Andrew Schorr
+       for pointing this out.
+
 2016-05-26         Andrew J. Schorr     <address@hidden>
 
-       * awk.h (get_actual_argument): Add an initial argument containing the
-       (NODE *) previously returned by get_argument. This allows us to
+       * awk.h (get_actual_argument): Add an initial argument containing 
+       the (NODE *) previously returned by get_argument. This allows us to
        eliminate a call to get_argument from inside get_actual_argument.
        (get_scalar_argument, get_array_argument): Change macro definition to
        add an initial node argument to pass through to get_actual_argument.
diff --git a/awk.h b/awk.h
index ecc87f1..8f3b1d4 100644
--- a/awk.h
+++ b/awk.h
@@ -1271,7 +1271,7 @@ DEREF(NODE *r)
 
 #define efree(p)       free(p)
 
-#define fatal          set_loc(__FILE__, __LINE__), r_fatal
+#define fatal          (*(set_loc(__FILE__, __LINE__), r_fatal))
 
 extern jmp_buf fatal_tag;
 extern bool fatal_tag_valid;

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

Summary of changes:
 ChangeLog   |   14 ++++++++++++--
 awk.h       |    2 +-
 str_array.c |   22 +++++++++++++---------
 3 files changed, 26 insertions(+), 12 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

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