Skip to content

Commit

Permalink
Merge pull request #8989 from bradcray/bug-assoc-of-remote-strings
Browse files Browse the repository at this point in the history
File a bug against accessing associative domains with remote strings

[trivial, not reviewed]
  • Loading branch information
bradcray authored Mar 28, 2018
2 parents 82fed0a + 71659e3 commit 193371b
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 0 deletions.
44 changes: 44 additions & 0 deletions test/multilocale/strings/assocOfString.chpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// This program sometimes fails on two or more locales, either getting
// an out-of-bounds error or a segfault. For a single locale, there
// is no error. If the strings are changed to integers, it doesn't
// seem to get an error either, suggesting that something about using
// strings across multiple locales may be the issue. Running with a
// smaller number of entries doesn't seem to solve the problem either
// (I wondered for awhile whether the array resizing was causing
// problems, but see failures with 3 entries where no resizing should
// be done).
//

config const ENTRIES = 15,
debug = false;

var keys: [0..#ENTRIES] string;
for i in 0..#ENTRIES {
keys[i] = "%04i".format(i);
writeln(keys);
}

on Locales [numLocales-1] {
var D: domain(string);
var array: [D] uint(64);

if debug then
writeln("D is ", D.locale, ", array is ", array.locale);

for i in 0..#ENTRIES {
writeln("assign array [\"%s\"] = 12345".format(keys[i]));

array[keys[i]] = 12345;
}

if debug {
writeln(D);
for a in array do
writeln(a);
writeln(array);
}

for i in 0..#ENTRIES {
writeln("get array[\"%s\"]: %i".format(keys[i], array[keys[i]]));
}
}
11 changes: 11 additions & 0 deletions test/multilocale/strings/assocOfString.future
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
associative-of-strings fails on non-zero locales

This test gets either an OOB error or a segfault when running on 2+
locales. I believe that the issue relates to using string keys that
are allocated on locale 0 and then used w.r.t. an associative array on
locale 1. Specifically, changing from string keys/values to integers
makes the error go away, as does storing the `keys` array on the same
locale as the associtaive domain, as does changing the intents on the
default associative's dsiAccess() routines to 'const in'. That said,
I'm still not quite sure where the blame lies here.

45 changes: 45 additions & 0 deletions test/multilocale/strings/assocOfString.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
0000
0000 0001
0000 0001 0002
0000 0001 0002 0003
0000 0001 0002 0003 0004
0000 0001 0002 0003 0004 0005
0000 0001 0002 0003 0004 0005 0006
0000 0001 0002 0003 0004 0005 0006 0007
0000 0001 0002 0003 0004 0005 0006 0007 0008
0000 0001 0002 0003 0004 0005 0006 0007 0008 0009
0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 0010
0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 0010 0011
0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 0010 0011 0012
0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 0010 0011 0012 0013
0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 0010 0011 0012 0013 0014
assign array ["0000"] = 12345
assign array ["0001"] = 12345
assign array ["0002"] = 12345
assign array ["0003"] = 12345
assign array ["0004"] = 12345
assign array ["0005"] = 12345
assign array ["0006"] = 12345
assign array ["0007"] = 12345
assign array ["0008"] = 12345
assign array ["0009"] = 12345
assign array ["0010"] = 12345
assign array ["0011"] = 12345
assign array ["0012"] = 12345
assign array ["0013"] = 12345
assign array ["0014"] = 12345
get array["0000"]: 12345
get array["0001"]: 12345
get array["0002"]: 12345
get array["0003"]: 12345
get array["0004"]: 12345
get array["0005"]: 12345
get array["0006"]: 12345
get array["0007"]: 12345
get array["0008"]: 12345
get array["0009"]: 12345
get array["0010"]: 12345
get array["0011"]: 12345
get array["0012"]: 12345
get array["0013"]: 12345
get array["0014"]: 12345
1 change: 1 addition & 0 deletions test/multilocale/strings/assocOfString.numlocales
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2
1 change: 1 addition & 0 deletions test/multilocale/strings/assocOfString.skipif
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CHPL_COMM==none

0 comments on commit 193371b

Please sign in to comment.