summaryrefslogtreecommitdiff
path: root/bugs-fixed/subsep-overflow.awk
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2019-06-02 04:23:56 +0000
committerWarner Losh <imp@FreeBSD.org>2019-06-02 04:23:56 +0000
commit03ee4d05f1d963d60451e04ce505e4da116300db (patch)
tree9dcabc6cffafcb6b8195148feb519d575b0bf6ac /bugs-fixed/subsep-overflow.awk
parent3a4488f93f2dc8fe9de757a418b74aa0aa4f9ed1 (diff)
Notes
Diffstat (limited to 'bugs-fixed/subsep-overflow.awk')
-rw-r--r--bugs-fixed/subsep-overflow.awk24
1 files changed, 24 insertions, 0 deletions
diff --git a/bugs-fixed/subsep-overflow.awk b/bugs-fixed/subsep-overflow.awk
new file mode 100644
index 000000000000..66c7c24db0e6
--- /dev/null
+++ b/bugs-fixed/subsep-overflow.awk
@@ -0,0 +1,24 @@
+function foo(c, n) {
+ s = "";
+ for (i = 0; i < n; i++) {
+ s = s c;
+ }
+ return s;
+}
+
+BEGIN {
+ str1 = foo("a", 4500);
+ str2 = foo("b", 9000);
+
+ a[(SUBSEP = str1), (SUBSEP = str2), "c"] = 1;
+
+ for (k in a) {
+ print length(k);
+ }
+
+ print (((SUBSEP = str1), (SUBSEP = str2), "c") in a);
+ print (((SUBSEP = str1) SUBSEP (SUBSEP = str2) SUBSEP "c") in a);
+ delete a[(SUBSEP = str1), (SUBSEP = str2), "c"];
+ print (((SUBSEP = str1), (SUBSEP = str2), "c") in a);
+ print (((SUBSEP = str1) SUBSEP (SUBSEP = str2) SUBSEP "c") in a);
+}