[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] gawk branch, master, updated. gawk-4.1.0-4750-g6bbdfdc2
From: |
Arnold Robbins |
Subject: |
[SCM] gawk branch, master, updated. gawk-4.1.0-4750-g6bbdfdc2 |
Date: |
Tue, 28 Jun 2022 12:41:51 -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, master has been updated
via 6bbdfdc24df4a4ff46dee47aeb27bd9fd22acd14 (commit)
from 488500a492d98184cd07f96219184d7445d06be5 (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=6bbdfdc24df4a4ff46dee47aeb27bd9fd22acd14
commit 6bbdfdc24df4a4ff46dee47aeb27bd9fd22acd14
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Tue Jun 28 19:41:35 2022 +0300
Squashed commit of the following:
commit 4ddea41a560d667de9112d86ecf9ceb9b147977c
Merge: 1819da3a 488500a4
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Mon Jun 27 10:23:41 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit 1819da3a18ee15808c69c5bb5fc8071a3fc9a0e5
Merge: a98ff0cb 2ae439f3
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Fri Jun 24 14:17:16 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit a98ff0cb4e62673c2014b8cc5ec6282b0e93d0a6
Merge: e0227307 d43b469f
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Wed Jun 22 10:19:43 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit e022730782a5943307c2dce308c7d982d0284759
Merge: a05476e0 03f79dcb
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Mon Jun 20 08:40:14 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit a05476e0c2460bab15059d70365c172cb6af8b27
Merge: 548904f8 f2e71851
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Fri Jun 17 14:37:07 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit 548904f85e19fd4466644ce7c537d82558ea3588
Merge: bca382b2 ae879ed7
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Fri Jun 17 14:15:58 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit bca382b2a6e70f3e8aebd7c113e9af8f868ea0e4
Merge: ddc1358d 6b97a4f7
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Wed Jun 15 18:09:38 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit ddc1358d52f5465c02806b676cdabbb1fa046d38
Merge: a5d1b520 174bc50a
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Wed Jun 8 22:39:42 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit a5d1b520410051e912c88fda25e75532e43d9ae4
Merge: ed132168 07d04b91
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Tue Jun 7 22:42:13 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit ed13216805ba590fec6a7aa0ae774f3cb149461a
Merge: 2627f6bc 03148f2c
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Fri Jun 3 12:19:58 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit 2627f6bc294a64e0486f6e7a62c4980786e65756
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Fri Jun 3 11:30:31 2022 +0300
Some more small fixes.
commit a7211881a2bf1600e6ffb990e77d95e94e64b088
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Fri Jun 3 11:16:36 2022 +0300
Additional fixes for reference count > 1.
commit c8da61eb496e9f814ba03681993455ec1d7a0e16
Merge: ec7a63b0 45a9aeb1
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Thu Jun 2 22:07:59 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit ec7a63b098ada34b48bf15895c1ba85eae1ece23
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Thu Jun 2 21:42:55 2022 +0300
And, once again, add the new test files.
commit f162319580b6a32dfdc6d40880bf329f281f02c5
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Thu Jun 2 19:52:31 2022 +0300
Add a new test.
commit 086487f537084f793b9ed698467ed5ced2bac0c9
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Thu Jun 2 19:48:12 2022 +0300
Fix memory corruption problem.
commit 9e3bdae69574f3339dc327ba735a6e7209e67bc3
Merge: fea48661 0f12de29
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Wed Jun 1 18:30:10 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit fea486613e037bce9c0d881a82d335a2797d7863
Merge: 5338ae04 826e12f5
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Tue May 24 17:02:52 2022 -0400
Merge branch 'master' into feature/mdim-restart
commit 5338ae04accb66fa213efc827adaeb9bff73d136
Merge: 4ac52d68 93d37eb5
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Mon May 23 16:40:52 2022 -0400
Merge branch 'master' into feature/mdim-restart
commit 4ac52d685c3b6917c088b390b632195fcf68219c
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Sun May 22 11:13:14 2022 -0400
Fix memory leak converting Node_elem_new to array.
commit 3c95d116d1adf70e8656d4fdfcecb47ed2a2aca8
Merge: 371554a7 4ecda23c
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Sun May 22 10:27:24 2022 -0400
Merge branch 'master' into feature/mdim-restart
commit 371554a7c41ef7ebfe53d851515ed4465ed00c58
Merge: 5e76c449 86291c81
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Thu May 19 12:52:43 2022 -0400
Merge branch 'master' into feature/mdim-restart
commit 5e76c449eb80a6b58984e877d95296856c945fa5
Merge: 8a9e6074 bb5192be
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Tue May 17 17:47:17 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit 8a9e6074ed86cd699d4b7c70fde85954374bbb1f
Merge: 58b844d9 fee5df67
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Wed May 11 23:20:03 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit 58b844d9d888d06be5929d9bb2b4e72500e5187a
Merge: 224cfcbb c4e2e18f
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Wed May 11 23:17:53 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit 224cfcbb33688065ef8037a0aabd64b28953f846
Merge: b671cb7f d5742964
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Tue May 10 21:34:17 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit b671cb7fa5708a6c023261f2161addbd8be9ca2f
Merge: 5fbcb09c 455c99c0
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Thu May 5 16:15:15 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit 5fbcb09c975355efd20b5f7ffd352071c99d7bc6
Merge: 0fa7a8eb 57745697
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Tue May 3 22:57:39 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit 0fa7a8eb003a9899f15124444a23878b25ee2c5d
Merge: 0ead15b9 d2b7dbb1
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Tue May 3 22:55:49 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit 0ead15b9d6170db2dd9b9e003ce231cf138c60ce
Merge: 2c14c31f 0b77c57f
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Fri Apr 29 11:41:56 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit 2c14c31fc8b7ad36fdfe8d5387e24e664c7e6d39
Merge: 161546b4 d2e790ba
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Fri Apr 29 11:03:55 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit 161546b45836571ec07746b052a89f394cbb64ec
Merge: 459cf2a5 20c0d1e7
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Thu Apr 28 23:28:03 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit 459cf2a53e1945b53b3f0be1ab80a2e4d67cea88
Merge: 300cf5f5 27f1be8a
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Thu Apr 21 17:36:18 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit 300cf5f522c928476cfbd13cbb670222a8d97a70
Merge: e319f5fe 618431c8
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Thu Apr 21 12:15:38 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit e319f5feba1df6c0f018344efc6757d086cee710
Merge: 6a92817e c9e804f4
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Wed Apr 20 17:22:28 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit 6a92817ef034fd0915fdd88879bed1c470457111
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Wed Apr 20 16:39:51 2022 +0300
Small whitespace cleanups.
commit 6abf94e452643df122935f585e209f52f6814782
Merge: 9c9b241a b55d466c
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Mon Apr 18 16:24:24 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit 9c9b241a2cf538c05ce162f73fb45e06f73e509f
Merge: 5ec85050 b6fd48c9
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Fri Apr 8 13:16:43 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit 5ec85050cac30dfb239ba6350b32ff447fe67f11
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Wed Apr 6 20:22:36 2022 +0300
More cleanups.
commit ff3f9433a6ab9d0f4e5ca21e3cf8b7dc69741d39
Merge: 0e6a31ca 62ec80d7
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Wed Apr 6 20:09:30 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit 0e6a31caf3c0ee5d9a329a1cd8ae4ae17c950990
Merge: 4fc1469f 4bbfe95a
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Wed Apr 6 08:15:45 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit 4fc1469f68f15b2f56c31340cbd852dda2c43cf6
Merge: 3ef91f55 32b09ecf
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Fri Apr 1 16:08:22 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit 3ef91f5586feb1fa9e20cb3c2f1359a465ec8db9
Merge: 56242fa8 8b41863c
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Fri Apr 1 14:20:09 2022 +0300
Merge branch 'feature/mdim-restart' of
ssh://git.sv.gnu.org/srv/git/gawk into feature/mdim-restart
commit 56242fa8c66f43ae23b9f47b1e225a6692515f1b
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Fri Apr 1 14:18:53 2022 +0300
Additional cleanups.
commit 8b41863cd58085a86acf31e131e60233e9b3a4f2
Merge: 89a85232 dd566361
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Wed Mar 30 10:22:55 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit 89a85232c6d8203f33052cf305e79cb5b2ab952a
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Mon Mar 28 19:37:29 2022 +0300
Final fixes and update ChangeLog.
commit 278b252a84ff2af01cb9d572c4b9c1e5b01c2b59
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Sun Mar 27 08:21:53 2022 +0300
And the rest of the mdim test files.
commit 349910e7752b6c10ed6f475b83f49bf3577c96d3
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Sun Mar 27 08:19:54 2022 +0300
Fix mdim1.ok.
commit f464540b8d76f9829acd88fb46d1efa587d69b83
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Sun Mar 27 08:18:24 2022 +0300
Add mdim1, mdim2 tests.
commit 6eff0cb4ab369aa32d919f281cdbfced06a05fcf
Merge: b79756a0 c2f6af30
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Sun Mar 27 08:11:03 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit b79756a0f070815264378f5614ef83d5c807f918
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Sat Mar 26 22:17:36 2022 +0300
Remove wrong comment.
commit 32cf648f9ee4f30e95e3a4503ed56f9b2ca9c8ab
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Sat Mar 26 22:13:19 2022 +0300
Continue fixing.
commit 0368d0007ddeba8c0f6b32bef47c0b7d3b49784b
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Sat Mar 26 21:55:07 2022 +0300
Next fix.
commit b67edcd6079e5c600f9b36c00994555ed54edc00
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Sat Mar 26 21:19:06 2022 +0300
Continue making progress.
commit 0a5688347945717c3bce4993ac507f692a85ebe2
Merge: 1f4dbe80 0cdb4a0e
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Fri Mar 25 14:03:26 2022 +0300
Merge branch 'master' into feature/mdim-restart
commit 1f4dbe804b2d5936d10567f44bc6b1bca448e6e1
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Wed Mar 23 21:27:31 2022 +0200
Continuing progress.
commit 8e4e61cf09db4c3e93cc9fd92b5f4a0429240d36
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Wed Mar 23 20:59:02 2022 +0200
Small code cleanup.
commit 2b918ad7a76155acbfd19ccf695fe50cd6a1baa7
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Wed Mar 23 20:57:05 2022 +0200
Stage 2 working.
commit 7d30f731653bd0358af43a65384491d526006a8b
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Wed Mar 23 20:50:27 2022 +0200
First stage working.
diff --git a/ChangeLog b/ChangeLog
index 31d95383..28bb59ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -64,17 +64,46 @@
an array.
(api_impl): Add hook for api_destroy_array.
+2022-06-03 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.h (elem_new_to_scalar): Add declaration.
+ * eval.c (elem_new_to_scalar): No longer static. Make it handle
+ things when valref is > 1. Returns a NODE * instead of being void.
+ (cmp_scalars): Change usage of elem_new_to_scalar().
+ * interpret.h (r_interpret): Op_push*: Make Node_elem_new into
+ a separate case, using elem_new_to_scalar().
+ * array.c (force_array): For Node_elem_new, clear symbol->stptr.
+ * eval.r (r_get_lhs): Use efree() intstead of free() in Node_elem_new
+ case.
+
2022-06-02 Arnold D. Robbins <arnold@skeeve.com>
* builtin.c (do_sub): Fix memory corruption when substituting
into a value that is a typed regex. Thanks to valgrind.
+2022-06-02 Arnold D. Robbins <arnold@skeeve.com>
+
+ Fix a nasty memory corruption problem. Thanks to
+ Andrew Schorr for the report.
+
+ * eval.c (r_get_lhs): Handle Node_elem_new separately
+ to free the string value. This was not the problem.
+ * interpret.h (r_interpret): For Op_assign, when turning
+ Node_elem_new into the null string, DEREF the old value
+ and dupnode the new one. THIS was the problem.
+
2022-05-24 Adam Van Scyoc <avanscy@g.clemson.edu>
* awkgram.y (make_assignable): Handle Op_field_assign.
Avoids a core dump upon a certain kind of syntax error;
see test/getlnfa.awk.
+2022-05-22 Arnold D. Robbins <arnold@skeeve.com>
+
+ * array.c (force_array): When converting Node_elem_new to an array,
+ release the string storage. Thanks to valgrind, by way of Andrew
+ Schorr, for the report.
+
2022-05-11 Arnold D. Robbins <arnold@skeeve.com>
* profile.c (pp_list): Typo fix in a comment.
@@ -111,16 +140,86 @@
merged.
* profile.c (pprint): Improve code for Op_K_switch, Op_K_case.
+2022-04-20 Arnold D. Robbins <arnold@skeeve.com>
+
+ * mpfr.c (mpg_force_number): Small whitespace fix.
+ * node.c (r_force_number): Ditto.
+
2022-04-18 Arnold D. Robbins <arnold@skeeve.com>
* gawkbug.in: Small changes.
+2022-04-06 Arnold D. Robbins <arnold@skeeve.com>
+
+ Further cleanups.
+
+ * array.c (new_array_element): Set s->stfmt to STFMT_UNUSED.
+ * awk.h (force_string_fmt): No need to set s->stfmt anymore.
+ * builtin.c (do_typeof): Collapse Node_var_new and Node_elem_new
+ cases.
+ * symbol.c (print_vars): Node_elem_new can't be in a top level
+ variable. Remove check and add a call to cant_happen if some
+ other node type is received.
+ * NEWS: Updated.
+
2022-04-01 Arnold D. Robbins <arnold@skeeve.com>
Small fix from the persistent-gawk guys.
* profile.c (pprint): Use estrdup instead of strdup.
+2022-03-31 Arnold D. Robbins <arnold@skeeve.com>
+
+ * array.c (new_array_element): Make a full null string instead of
+ an empty node; it can be more easily converted to scalar that way.
+ * awk.h (force_string_fmt): Change the node type, remove NUMBER flag,
+ set STFMT_UNUSED.
+ * cint_array.c (lear_clear): Remove check for not equal Node_elem_new.
+ * int_array.c (int_clear): Ditto.
+ * str_array.c (str_clear): Ditto.
+ * eval.c (elem_new_to_scalar): Now only needs to change the node type.
+ * interpret.h (r_interpret): Treat Node_elem_new like Node_val, and
+ UPREF it when pushed. Remove test before DEREFing when popping.
+ * mpfr.c (mpg_force_number): Simplify converting Node_elem_new to
+ Node_val. Fix the string value.
+ * node.c (r_force_number): Ditto.
+
+2022-03-28 Arnold D. Robbins <arnold@skeeve.com>
+
+ Allow unreferenced array elements to turn into subarrays.
+
+ * awk.h (Node_elem_new): New node type.
+ (new_array_element): Add declaration.
+ (POP_ARRAY): Handle Node_elem_new.
+ (force_string_fmt): Ditto. Make sure valref has the right value.
+ * array.c (force_array): Handle Node_elem_new.
+ (do_sort_up_value_type): Ditto.
+ (new_array_element): New function, creates Node_elem_new node.
+ * builtin.c (do_length): Handle Node_elem_new.
+ (do_typeof): Ditto.
+ * cint_array.c (leaf_lookup): Use new_array_element() when creating
+ a new element.
+ (left_clear): Don't unref Node_elem_new.
+ * debug.c (print_symbol, do_set_var,watchpont_triggered,
+ initialize_watch_item, print_memory, do_print_f): Handle Node_elem_new.
+ * eval.c (nodetypes): Add Node_elem_new.
+ (r_get_lhs, setup_frame): Handle Node_elem_new.
+ (elem_new_to_scalar): New function.
+ (cmp_scalars): Use elem_new_to_scalar.
+ * ext.c (get_actual_argument): Handle Node_elem_new.
+ * gawkapi.c (api_get_argument, api_set_argument, node_to_awk_value,
+ api_sym_update): Handle Node_elem_new.
+ * int_array.c (int_clear): Don't unref Node_elem_new.
+ (int_insert): Use new_array_element() when creating a new element.
+ * interpret.h (r_interpret): Handle Node_elem_new as appropriate.
+ * mpfr.c (mpg_force_number): Handle Node_elem_new.Make sure valref has
+ the right value.
+ * node.c (r_force_number): Ditto.
+ * str_array.c (str_lookup): Use new_array_element() when creating a
+ new element.
+ (str_clear): Don't unref Node_elem_new.
+ * symbol.c (print_vars): Handle Node_elem_new.
+
2022-03-27 Arnold D. Robbins <arnold@skeeve.com>
Allow nested indirect function calls. Thanks to
diff --git a/NEWS b/NEWS
index 1f7f66e6..3e8f5673 100644
--- a/NEWS
+++ b/NEWS
@@ -49,6 +49,9 @@ allowing gawk to preserve the contents of its variables and
arrays
between runs. THIS IS AN EXPERIMENTAL FEATURE! For more information,
see the manual.
+10. Some subtle issues with untyped array elements being passed to
+functions have been fixed.
+
Changes from 5.1.1 to 5.1.2
---------------------------
diff --git a/array.c b/array.c
index cbed1254..4361b51c 100644
--- a/array.c
+++ b/array.c
@@ -315,7 +315,7 @@ array_vname(const NODE *symbol)
/*
* force_array --- proceed to the actual Node_var_array,
- * change Node_var_new to an array.
+ * change Node_var_new or Node_elem_new to an array.
* If canfatal and type isn't good, die fatally,
* otherwise return the final actual value.
*/
@@ -334,6 +334,11 @@ force_array(NODE *symbol, bool canfatal)
}
switch (symbol->type) {
+ case Node_elem_new:
+ efree(symbol->stptr);
+ symbol->stptr = NULL;
+ symbol->stlen = 0;
+ /* fall through */
case Node_var_new:
symbol->xarray = NULL; /* make sure union is as it should be */
null_array(symbol);
@@ -1166,6 +1171,7 @@ do_sort_up_value_type(const void *p1, const void *p2)
Node_func,
Node_ext_func,
Node_var_new,
+ Node_elem_new,
Node_var,
Node_var_array,
Node_val,
@@ -1429,3 +1435,26 @@ assoc_list(NODE *symbol, const char *sort_str,
sort_context_t sort_ctxt)
return list;
}
+
+/* new_array_element --- return a new empty element node */
+
+NODE *
+new_array_element(void)
+{
+ NODE *n = make_number(0.0);
+ char *sp;
+
+ emalloc(sp, char *, 2, "new_array_element");
+ sp[0] = sp[1] = '\0';
+
+ n->stptr = sp;
+ n->stlen = 0;
+ n->stfmt = STFMT_UNUSED;
+
+ n->flags |= (MALLOC|STRING|STRCUR);
+
+ n->type = Node_elem_new;
+ n->valref = 1;
+
+ return n;
+}
diff --git a/awk.h b/awk.h
index f89b0866..6ff88677 100644
--- a/awk.h
+++ b/awk.h
@@ -258,6 +258,7 @@ typedef enum nodevals {
Node_var, /* scalar variable, lnode is value */
Node_var_array, /* array is ptr to elements, table_size num of
eles */
Node_var_new, /* newly created variable, may become an array
*/
+ Node_elem_new, /* newly created array element, may become a
subarray */
Node_param_list, /* lnode is a variable, rnode is more list */
Node_func, /* lnode is param. list, rnode is body */
Node_ext_func, /* extension function, code_ptr is builtin code
*/
@@ -1445,6 +1446,7 @@ extern NODE *do_asorti(int nargs);
extern unsigned long (*hash)(const char *s, size_t len, unsigned long hsize,
size_t *code);
extern void init_env_array(NODE *env_node);
extern void init_argv_array(NODE *argv_node, NODE *shadow_node);
+extern NODE *new_array_element(void);
/* awkgram.c */
extern NODE *variable(int location, char *name, NODETYPE type);
extern int parse_program(INSTRUCTION **pcode, bool from_eval);
@@ -1559,6 +1561,7 @@ extern STACK_ITEM *grow_stack(void);
extern void dump_fcall_stack(FILE *fp);
extern int register_exec_hook(Func_pre_exec preh, Func_post_exec posth);
extern NODE **r_get_field(NODE *n, Func_ptr *assign, bool reference);
+extern NODE *elem_new_to_scalar(NODE *n);
/* ext.c */
extern NODE *do_ext(int nargs);
void load_ext(const char *lib_name); /* temporary */
@@ -1849,7 +1852,8 @@ POP_ARRAY(bool check_for_untyped)
NODE *t = POP();
static bool warned = false;
- if (do_lint && ! warned && check_for_untyped && t->type ==
Node_var_new) {
+ if (do_lint && ! warned && check_for_untyped
+ && (t->type == Node_var_new || t->type == Node_elem_new)) {
warned = true;
lintwarn(_("behavior of `for' loop on untyped variable is not
defined by POSIX"));
}
@@ -1942,6 +1946,13 @@ dupnode(NODE *n)
static inline NODE *
force_string_fmt(NODE *s, const char *fmtstr, int fmtidx)
{
+ if (s->type == Node_elem_new) {
+ s->type = Node_val;
+ s->flags &= ~NUMBER;
+
+ return s;
+ }
+
if ((s->flags & STRCUR) != 0
&& (s->stfmt == STFMT_UNUSED || (s->stfmt == fmtidx
#ifdef HAVE_MPFR
diff --git a/builtin.c b/builtin.c
index 3a38a478..75825742 100644
--- a/builtin.c
+++ b/builtin.c
@@ -591,7 +591,7 @@ do_length(int nargs)
size = assoc_length(tmp);
return make_number(size);
- } else if (tmp->type == Node_var_new) {
+ } else if (tmp->type == Node_var_new || tmp->type == Node_elem_new) {
// this can happen from an indirect call
DEREF(tmp);
tmp = dupnode(Nnull_string);
@@ -4342,6 +4342,7 @@ do_typeof(int nargs)
}
break;
case Node_var_new:
+ case Node_elem_new:
res = "untyped";
deref = false;
break;
diff --git a/cint_array.c b/cint_array.c
index 91947766..3e0393c9 100644
--- a/cint_array.c
+++ b/cint_array.c
@@ -1068,7 +1068,7 @@ leaf_lookup(NODE *symbol, NODE *array, long k, long size,
long base)
lhs = array->nodes + (k - base); /* leaf element */
if (*lhs == NULL) {
array->table_size++; /* one more element in leaf array */
- *lhs = dupnode(Nnull_string);
+ *lhs = new_array_element();
}
return lhs;
}
diff --git a/debug.c b/debug.c
index 2849a4c1..f602a199 100644
--- a/debug.c
+++ b/debug.c
@@ -967,6 +967,9 @@ print_symbol(NODE *r, bool isparam)
case Node_var_new:
fprintf(out_fp, "untyped variable\n");
break;
+ case Node_elem_new:
+ fprintf(out_fp, "untyped element\n");
+ break;
case Node_var:
if (! isparam && r->var_update)
r->var_update();
@@ -1241,6 +1244,7 @@ do_set_var(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
switch (r->type) {
case Node_var_new:
+ case Node_elem_new:
r->type = Node_var;
r->var_value = dupnode(Nnull_string);
/* fall through */
@@ -1730,6 +1734,7 @@ watchpoint_triggered(struct list_item *w)
t2 = symbol;
break;
case Node_var_new:
+ case Node_elem_new:
break;
default:
cant_happen("unexpected symbol type %s",
nodetype2str(symbol->type));
@@ -1806,7 +1811,7 @@ initialize_watch_item(struct list_item *w)
r = *get_field(field_num, NULL);
w->cur_value = dupnode(r);
} else {
- if (symbol->type == Node_var_new)
+ if (symbol->type == Node_var_new || symbol->type ==
Node_elem_new)
w->cur_value = (NODE *) 0;
else if (symbol->type == Node_var) {
r = symbol->var_value;
@@ -3753,6 +3758,10 @@ print_memory(NODE *m, NODE *func, Func_print print_func,
FILE *fp)
print_func(fp, "%s", m->vname);
break;
+ case Node_elem_new:
+ print_func(fp, "element - %p", m);
+ break;
+
default:
print_func(fp, "?"); /* can't happen */
}
@@ -5109,7 +5118,7 @@ do_print_f(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
r = find_symbol(name, NULL);
if (r == NULL)
goto done;
- if (r->type == Node_var_new)
+ if (r->type == Node_var_new || r->type == Node_elem_new)
tmp[i] = Nnull_string;
else if (r->type != Node_var) {
d_error(_("`%s' is not a scalar variable"),
name);
diff --git a/eval.c b/eval.c
index c6f8bcb9..e292cab6 100644
--- a/eval.c
+++ b/eval.c
@@ -238,6 +238,7 @@ static const char *const nodetypes[] = {
"Node_var",
"Node_var_array",
"Node_var_new",
+ "Node_elem_new",
"Node_param_list",
"Node_func",
"Node_ext_func",
@@ -1167,6 +1168,14 @@ r_get_lhs(NODE *n, bool reference)
n->var_value = dupnode(Nnull_string);
break;
+ case Node_elem_new:
+ efree(n->stptr);
+ n->stptr = NULL;
+ n->stlen = 0;
+ n->type = Node_var;
+ n->var_value = dupnode(Nnull_string);
+ break;
+
case Node_var:
break;
@@ -1313,6 +1322,7 @@ setup_frame(INSTRUCTION *pc)
switch (m->type) {
case Node_var_new:
case Node_var_array:
+ case Node_elem_new:
r->type = Node_array_ref;
r->orig_array = r->prev_array = m;
break;
@@ -1534,6 +1544,10 @@ cmp_scalars(scalar_cmp_t comparison_type)
t2 = POP_SCALAR();
t1 = TOP();
+
+ t1 = elem_new_to_scalar(t1);
+ t2 = elem_new_to_scalar(t2);
+
if (t1->type == Node_var_array) {
DEREF(t2);
fatal(_("attempt to use array `%s' in a scalar context"),
array_vname(t1));
@@ -1872,3 +1886,20 @@ init_interpret()
interpret = r_interpret;
}
+/* elem_new_to_scalar --- convert Node_elem_new to untyped scalar */
+
+NODE *
+elem_new_to_scalar(NODE *n)
+{
+ if (n->type != Node_elem_new)
+ return n;
+
+ if (n->valref > 1) {
+ unref(n);
+ return dupnode(Nnull_string);
+ }
+
+ n->type = Node_val;
+
+ return n;
+}
diff --git a/ext.c b/ext.c
index 30e52aae..3d643c01 100644
--- a/ext.c
+++ b/ext.c
@@ -200,7 +200,7 @@ get_actual_argument(NODE *t, int i, bool want_array)
pc = TOP()->code_ptr; /* Op_ext_builtin instruction */
fname = (pc + 1)->func_name;
- if (t->type == Node_var_new) {
+ if (t->type == Node_var_new || t->type == Node_elem_new) {
if (want_array)
return force_array(t, false);
else {
diff --git a/gawkapi.c b/gawkapi.c
index 01157d52..93cd9b15 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -69,7 +69,7 @@ api_get_argument(awk_ext_id_t id, size_t count,
return awk_false;
/* if type is undefined */
- if (arg->type == Node_var_new) {
+ if (arg->type == Node_var_new || arg->type == Node_elem_new) {
if (wanted == AWK_UNDEFINED)
return awk_true;
else if (wanted == AWK_ARRAY) {
@@ -124,7 +124,7 @@ api_set_argument(awk_ext_id_t id,
return awk_false;
if ( (arg = get_argument(count)) == NULL
- || arg->type != Node_var_new)
+ || (arg->type != Node_var_new && arg->type != Node_elem_new))
return awk_false;
arg = get_array_argument(arg, count);
@@ -564,6 +564,7 @@ node_to_awk_value(NODE *node, awk_value_t *val,
awk_valtype_t wanted)
switch (node->type) {
case Node_var_new: /* undefined variable */
+ case Node_elem_new: /* undefined element */
val->val_type = AWK_UNDEFINED;
if (wanted == AWK_UNDEFINED) {
ret = awk_true;
@@ -896,10 +897,13 @@ api_sym_update(awk_ext_id_t id,
efree((void *) full_name);
- if ((node->type == Node_var && value->val_type != AWK_ARRAY) ||
node->type == Node_var_new) {
+ if ((node->type == Node_var && value->val_type != AWK_ARRAY)
+ || node->type == Node_var_new
+ || node->type == Node_elem_new) {
unref(node->var_value);
node->var_value = awk_value_to_node(value);
- if (node->type == Node_var_new && value->val_type !=
AWK_UNDEFINED)
+ if ((node->type == Node_var_new || node->type == Node_elem_new)
+ && value->val_type != AWK_UNDEFINED)
node->type = Node_var;
return awk_true;
diff --git a/int_array.c b/int_array.c
index 382aa799..8752413e 100644
--- a/int_array.c
+++ b/int_array.c
@@ -792,7 +792,7 @@ int_insert(NODE *symbol, long k, uint32_t hash1)
}
b->ainum[i] = k;
- b->aivalue[i] = dupnode(Nnull_string);
+ b->aivalue[i] = new_array_element();
b->aicount++;
return & b->aivalue[i];
}
diff --git a/interpret.h b/interpret.h
index bed2dfe8..29fc7fce 100644
--- a/interpret.h
+++ b/interpret.h
@@ -224,6 +224,20 @@ uninitialized_scalar:
save_symbol->vname);
if (op != Op_push_arg_untyped)
m = dupnode(Nnull_string);
+ UPREF(m);
+ PUSH(m);
+ break;
+
+ case Node_elem_new:
+ if (op != Op_push_arg_untyped) {
+ /* convert untyped to scalar */
+ m = elem_new_to_scalar(m);
+ }
+ if (do_lint)
+ lintwarn(isparam ?
+ _("reference to uninitialized
argument `%s'") :
+ _("reference to uninitialized
variable `%s'"),
+
save_symbol->vname);
PUSH(m);
break;
@@ -320,7 +334,7 @@ uninitialized_scalar:
}
}
- if (r->type == Node_val)
+ if (r->type == Node_val || r->type == Node_elem_new)
UPREF(r);
PUSH(r);
break;
@@ -353,6 +367,11 @@ uninitialized_scalar:
t2 = force_string(t2);
r->vname = estrdup(t2->stptr, t2->stlen);
/* the subscript in parent array */
assoc_set(t1, t2, r);
+ } else if (r->type == Node_elem_new) {
+ r = force_array(r, false);
+ r->parent_array = t1;
+ t2 = force_string(t2);
+ r->vname = estrdup(t2->stptr, t2->stlen);
/* the subscript in parent array */
} else if (r->type != Node_var_array) {
t2 = force_string(t2);
fatal(_("attempt to use scalar `%s[\"%.*s\"]'
as an array"),
@@ -389,7 +408,7 @@ uninitialized_scalar:
* be stored in SYMTAB:
* 1. Variables that don"t yet have a value
(Node_var_new)
* 2. Variables that have a value (Node_var)
- * 3. Values that awk code stuck into SYMTAB not
related to variables (Node_value)
+ * 3. Values that awk code stuck into SYMTAB not
related to variables (Node_val)
* For 1, since we are giving it a value, we have to
change the type to Node_var.
* For 1 and 2, we have to step through the Node_var to
get to the value.
* For 3, we fatal out. This avoids confusion on things
like
@@ -713,7 +732,7 @@ mod:
* SYMTAB is a little more messy. Three possibilities
for SYMTAB:
* 1. Variables that don"t yet have a value
(Node_var_new)
* 2. Variables that have a value (Node_var)
- * 3. Values that awk code stuck into SYMTAB not
related to variables (Node_value)
+ * 3. Values that awk code stuck into SYMTAB not
related to variables (Node_val)
* For 1, since we are giving it a value, we have to
change the type to Node_var.
* For 1 and 2, we have to step through the Node_var to
get to the value.
* For 3, we fatal out. This avoids confusion on things
like
@@ -844,6 +863,10 @@ mod:
lhs = POP_ADDRESS();
r = TOP_SCALAR();
unref(*lhs);
+ if (r->type == Node_elem_new) {
+ DEREF(r);
+ r = dupnode(Nnull_string);
+ }
UPREF(r);
UNFIELD(*lhs, r);
REPLACE(r);
@@ -1074,7 +1097,7 @@ arrayfor:
(void) POP_CODE();
while (arg_count-- > 0) {
t1 = POP();
- if (t1->type == Node_val)
+ if (t1->type == Node_val || t1->type ==
Node_elem_new)
DEREF(t1);
}
free_api_string_copies();
diff --git a/mpfr.c b/mpfr.c
index 7f61b692..a8834c39 100644
--- a/mpfr.c
+++ b/mpfr.c
@@ -349,6 +349,15 @@ mpg_force_number(NODE *n)
{
char *cp, *cpend;
+ if (n->type == Node_elem_new) {
+ n->type = Node_val;
+ n->flags &= ~STRING;
+ n->stptr[0] = '0'; // STRCUR is still set
+ n->stlen = 1;
+
+ return n;
+ }
+
if ((n->flags & NUMCUR) != 0)
return n;
n->flags |= NUMCUR;
diff --git a/node.c b/node.c
index cbf5c56e..904e3d08 100644
--- a/node.c
+++ b/node.c
@@ -61,6 +61,15 @@ r_force_number(NODE *n)
char save;
char *ptr;
+ if (n->type == Node_elem_new) {
+ n->type = Node_val;
+ n->flags &= ~STRING;
+ n->stptr[0] = '0'; // STRCUR is still set
+ n->stlen = 1;
+
+ return n;
+ }
+
if ((n->flags & NUMCUR) != 0)
return n;
diff --git a/pc/ChangeLog b/pc/ChangeLog
index e012e4b3..15287b22 100644
--- a/pc/ChangeLog
+++ b/pc/ChangeLog
@@ -1,3 +1,7 @@
+2022-06-02 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.tst: Regenerated.
+
2022-05-24 Adam Van Scyoc <avanscy@g.clemson.edu>
* Makefile.tst: Regenerated.
@@ -18,6 +22,10 @@
* Makefile.tst: Regenerated.
+2022-03-28 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.tst: Regenerated.
+
2022-03-27 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.tst: Regenerated.
diff --git a/pc/Makefile.tst b/pc/Makefile.tst
index e07a22ed..54d86dca 100644
--- a/pc/Makefile.tst
+++ b/pc/Makefile.tst
@@ -202,6 +202,7 @@ GAWK_EXT_TESTS = \
indirectcall3 indirectbuiltin2 \
inf-nan-torture intarray iolint isarrayunset lint lintexp \
lintindex lintint lintlength lintold lintplus lintset lintwarn \
+ mdim1 mdim2 mdim3 \
manyfiles match1 match2 match3 mbstr1 mbstr2 mixed1 mktime \
modifiers muldimposix nastyparm negtime next nondec nondec2 \
nonfatal1 nonfatal2 nonfatal3 nsawk1a nsawk1b nsawk1c nsawk2a \
@@ -3007,6 +3008,21 @@ lintwarn:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT
CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+mdim1:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+mdim2:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+mdim3:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
match1:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
diff --git a/str_array.c b/str_array.c
index 08704312..101ad0b9 100644
--- a/str_array.c
+++ b/str_array.c
@@ -217,7 +217,7 @@ str_lookup(NODE *symbol, NODE *subs)
b->ahname = subs;
b->ahname_str = subs->stptr;
b->ahname_len = subs->stlen;
- b->ahvalue = dupnode(Nnull_string);
+ b->ahvalue = new_array_element();
b->ahcode = code1;
return & (b->ahvalue);
}
diff --git a/symbol.c b/symbol.c
index 5ac5656d..d8a8b49f 100644
--- a/symbol.c
+++ b/symbol.c
@@ -497,6 +497,8 @@ print_vars(NODE **table, int (*print_func)(FILE *, const
char *, ...), FILE *fp)
print_func(fp, "untyped variable\n");
else if (r->type == Node_var)
valinfo(r->var_value, print_func, fp);
+ else
+ cant_happen("unexpected node type: %s",
nodetype2str(r->type));
}
}
diff --git a/test/ChangeLog b/test/ChangeLog
index 3f263224..7bd6b3c8 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2022-06-02 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (EXTRA_DIST): mdim3: new test.
+ * mdim3.awk, mdim3.ok: New files.
+
2022-05-24 Adam Van Scyoc <avanscy@g.clemson.edu>
* Makefile.am (EXTRA_DIST): getlnfa, new test.
@@ -28,10 +33,19 @@
* profile5.ok, profile10.ok, profile11.ok: Updated after code changes.
* profile17.awk, profile17.ok: New files.
+2022-03-31 Arnold D. Robbins <arnold@skeeve.com>
+
+ * aadelete1.awk, aadelete1.ok: Changed to sync with code changes.
+
2022-03-30 Arnold D. Robbins <arnold@skeeve.com>
* delarprm2.awk, delarprm2.ok: Changes to make test more helpful.
+2022-03-27 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (EXTRA_DIST): mdim1, mdim2: new tests.
+ * mdim1.awk, mdim1.ok, mdim2.awk, mdim2.ok: New files.
+
2022-03-27 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.am (EXTRA_DIST): indirectcall3, new test.
diff --git a/test/Makefile.am b/test/Makefile.am
index fd73e646..fe4872f9 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -678,6 +678,12 @@ EXTRA_DIST = \
manglprm.ok \
manyfiles.awk \
manyfiles.ok \
+ mdim1.awk \
+ mdim1.ok \
+ mdim2.awk \
+ mdim2.ok \
+ mdim3.awk \
+ mdim3.ok \
modifiers.sh \
modifiers.ok \
muldimposix.awk \
@@ -1476,6 +1482,7 @@ GAWK_EXT_TESTS = \
indirectcall3 indirectbuiltin2 \
inf-nan-torture intarray iolint isarrayunset lint lintexp \
lintindex lintint lintlength lintold lintplus lintset lintwarn \
+ mdim1 mdim2 mdim3 \
manyfiles match1 match2 match3 mbstr1 mbstr2 mixed1 mktime \
modifiers muldimposix nastyparm negtime next nondec nondec2 \
nonfatal1 nonfatal2 nonfatal3 nsawk1a nsawk1b nsawk1c nsawk2a \
diff --git a/test/Makefile.in b/test/Makefile.in
index 2673a17b..f838d388 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -945,6 +945,12 @@ EXTRA_DIST = \
manglprm.ok \
manyfiles.awk \
manyfiles.ok \
+ mdim1.awk \
+ mdim1.ok \
+ mdim2.awk \
+ mdim2.ok \
+ mdim3.awk \
+ mdim3.ok \
modifiers.sh \
modifiers.ok \
muldimposix.awk \
@@ -1743,6 +1749,7 @@ GAWK_EXT_TESTS = \
indirectcall3 indirectbuiltin2 \
inf-nan-torture intarray iolint isarrayunset lint lintexp \
lintindex lintint lintlength lintold lintplus lintset lintwarn \
+ mdim1 mdim2 mdim3 \
manyfiles match1 match2 match3 mbstr1 mbstr2 mixed1 mktime \
modifiers muldimposix nastyparm negtime next nondec nondec2 \
nonfatal1 nonfatal2 nonfatal3 nsawk1a nsawk1b nsawk1c nsawk2a \
@@ -4711,6 +4718,21 @@ lintwarn:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT
CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+mdim1:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+mdim2:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+mdim3:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
match1:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 899b4ec7..3015eb34 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1728,6 +1728,21 @@ lintwarn:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT
CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+mdim1:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+mdim2:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+mdim3:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
match1:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
diff --git a/test/aadelete1.awk b/test/aadelete1.awk
index 2484a057..158d2aa3 100644
--- a/test/aadelete1.awk
+++ b/test/aadelete1.awk
@@ -8,7 +8,7 @@ BEGIN {
print length(a), length(a[1])
delete a
print length(a), length(a[1]), length(a)
- a[1][1] = 11
+ a[1][1] = 11 # this used to fatal, now it no longer does.
}
function f(c, b) {
diff --git a/test/aadelete1.ok b/test/aadelete1.ok
index d4b678b5..c3e29d26 100644
--- a/test/aadelete1.ok
+++ b/test/aadelete1.ok
@@ -2,5 +2,3 @@
1
1 1
0 0 1
-gawk: aadelete1.awk:11: fatal: attempt to use scalar `a["1"]' as an array
-EXIT CODE: 2
diff --git a/test/mdim1.awk b/test/mdim1.awk
new file mode 100644
index 00000000..c1f398d6
--- /dev/null
+++ b/test/mdim1.awk
@@ -0,0 +1,15 @@
+BEGIN {
+ print "typeof(x[0]) is", typeof(x[0])
+ x[1] = x[0]
+ print "typeof(x[1]) is", typeof(x[1])
+ x[0][1] = "xx"
+ print "typeof(x[0]) is", typeof(x[0])
+ print "typeof(x[0][1]) is", typeof(x[0][1])
+ print "typeof(y) is", typeof(y)
+ z = y
+ print "typeof(y) is", typeof(y)
+ print "typeof(z) is", typeof(z)
+
+ x[1][0] = "xx" # this will fatal
+ print x[1][0]
+}
diff --git a/test/mdim1.ok b/test/mdim1.ok
new file mode 100644
index 00000000..1247fab1
--- /dev/null
+++ b/test/mdim1.ok
@@ -0,0 +1,9 @@
+typeof(x[0]) is untyped
+typeof(x[1]) is unassigned
+typeof(x[0]) is array
+typeof(x[0][1]) is string
+typeof(y) is untyped
+typeof(y) is unassigned
+typeof(z) is unassigned
+gawk: mdim1.awk:13: fatal: attempt to use scalar `x["1"]' as an array
+EXIT CODE: 2
diff --git a/test/mdim2.awk b/test/mdim2.awk
new file mode 100644
index 00000000..7bc0c127
--- /dev/null
+++ b/test/mdim2.awk
@@ -0,0 +1,9 @@
+BEGIN {
+ p(a[0])
+ print a[0][0]
+}
+
+function p(f)
+{
+ f[0] = 1
+}
diff --git a/test/mdim2.ok b/test/mdim2.ok
new file mode 100644
index 00000000..d00491fd
--- /dev/null
+++ b/test/mdim2.ok
@@ -0,0 +1 @@
+1
diff --git a/test/mdim3.awk b/test/mdim3.awk
new file mode 100644
index 00000000..3cd56b61
--- /dev/null
+++ b/test/mdim3.awk
@@ -0,0 +1,29 @@
+BEGIN {
+ inp[0] = "blah"
+ inp[1] = "blah"
+ inp[2] = ""
+ inp[3] = "Summary Statistics"
+ inp[4] = "temperature,0"
+ inp[5] = "rain,1"
+
+ for (i = 1; i <= 40; i++) {
+ print "i =", i
+ mode = 0
+ nr = 0
+ delete val
+ for (j = 0; j < 6; j++) {
+ x = inp[j]
+ print "\tj =", j
+# if (i == 27 && j == 3)
+# stopme()
+ nf = split(x,f,",")
+ print "\tnf =", nf
+ if (++nr > 1) {
+ if (!nf)
+ mode = 1
+ else if (mode == 1)
+ val[f[1]] = f[2]
+ }
+ }
+ }
+}
diff --git a/test/mdim3.ok b/test/mdim3.ok
new file mode 100644
index 00000000..a8f05990
--- /dev/null
+++ b/test/mdim3.ok
@@ -0,0 +1,520 @@
+i = 1
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 2
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 3
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 4
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 5
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 6
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 7
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 8
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 9
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 10
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 11
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 12
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 13
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 14
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 15
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 16
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 17
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 18
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 19
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 20
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 21
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 22
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 23
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 24
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 25
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 26
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 27
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 28
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 29
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 30
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 31
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 32
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 33
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 34
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 35
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 36
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 37
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 38
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 39
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
+i = 40
+ j = 0
+ nf = 1
+ j = 1
+ nf = 1
+ j = 2
+ nf = 0
+ j = 3
+ nf = 1
+ j = 4
+ nf = 2
+ j = 5
+ nf = 2
diff --git a/test/typeof3.awk b/test/typeof3.awk
index d148f373..2f864f45 100644
--- a/test/typeof3.awk
+++ b/test/typeof3.awk
@@ -15,5 +15,5 @@ BEGIN {
BEGIN {
print typeof(x)
print typeof(a[1])
- a[1][2] # fatals on this
+ a[1][2] # this used to fatal, it no longer does
}
diff --git a/test/typeof3.ok b/test/typeof3.ok
index a6cd6c4a..f9026b08 100644
--- a/test/typeof3.ok
+++ b/test/typeof3.ok
@@ -4,6 +4,4 @@ regexp
number
4
number
-unassigned
-gawk: typeof3.awk:18: fatal: attempt to use scalar `a["1"]' as an array
-EXIT CODE: 2
+untyped
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 99 ++++++++
NEWS | 3 +
array.c | 31 ++-
awk.h | 13 +-
builtin.c | 3 +-
cint_array.c | 2 +-
debug.c | 13 +-
eval.c | 31 +++
ext.c | 2 +-
gawkapi.c | 12 +-
int_array.c | 2 +-
interpret.h | 31 ++-
mpfr.c | 9 +
node.c | 9 +
pc/ChangeLog | 8 +
pc/Makefile.tst | 16 ++
str_array.c | 2 +-
symbol.c | 2 +
test/ChangeLog | 14 ++
test/Makefile.am | 7 +
test/Makefile.in | 22 ++
test/Maketests | 15 ++
test/aadelete1.awk | 2 +-
test/aadelete1.ok | 2 -
test/mdim1.awk | 15 ++
test/mdim1.ok | 9 +
test/mdim2.awk | 9 +
test/{arrayprm3.ok => mdim2.ok} | 0
test/mdim3.awk | 29 +++
test/mdim3.ok | 520 ++++++++++++++++++++++++++++++++++++++++
test/typeof3.awk | 2 +-
test/typeof3.ok | 4 +-
32 files changed, 914 insertions(+), 24 deletions(-)
create mode 100644 test/mdim1.awk
create mode 100644 test/mdim1.ok
create mode 100644 test/mdim2.awk
copy test/{arrayprm3.ok => mdim2.ok} (100%)
create mode 100644 test/mdim3.awk
create mode 100644 test/mdim3.ok
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] gawk branch, master, updated. gawk-4.1.0-4750-g6bbdfdc2,
Arnold Robbins <=