You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
... though this is probably a compiler bug that is exposed by TwoArrayRadixSort
use Sort;
record r {
var keyField:real;
var dummyField:[1..3]real;
}
record myComparator { }
proc myComparator.key(constref obj: r){
return obj.keyField;
}
configconst n =10;
var Arr:[1..n] r;
sort(Arr, comparator=new myComparator());
writeln(Arr[1]);
Here r is a record with a keyField and a dummyField that's not used. keyField is used while sorting the array Arr.
Any option avoiding the TwoArrayRadixSort path works. Namely, stable=true works, using 49999 element array works, 50000 doesn't as that's the TwoArrayRadixSort threshold.
I get
$CHPL_HOME/modules/internal/ChapelArray.chpl:1531: error: attempt to dereference nil
This is array deallocation code.
In the real case, I get similar errors, but the issue is harder to debug as it generates a core dump. My theory is that this is about deinitializing dummyField for the second array we use or some temporary. But I haven't looked any deeper into the sort code to understand.
The potential workaround is to use a tuple instead of an array for dummyField, assuming that it is relatively small.
The text was updated successfully, but these errors were encountered:
Tagging @mppf because of his Sort expertise. The issue is most likely a compiler issue, but understanding the algorithm would be helpful in understanding the bug.
e-kayrakli
changed the title
The TwoArrayRadixSort path causes memory corruption (?) when it is used with records that has array fields
The TwoArrayRadixSort path causes memory corruption (?) when it is used with records that have array fields
Feb 19, 2025
... though this is probably a compiler bug that is exposed by TwoArrayRadixSort
Here
r
is a record with akeyField
and adummyField
that's not used.keyField
is used while sorting the arrayArr
.Any option avoiding the
TwoArrayRadixSort
path works. Namely,stable=true
works, using49999
element array works,50000
doesn't as that's theTwoArrayRadixSort
threshold.I get
This is array deallocation code.
In the real case, I get similar errors, but the issue is harder to debug as it generates a core dump. My theory is that this is about deinitializing
dummyField
for the second array we use or some temporary. But I haven't looked any deeper into the sort code to understand.The potential workaround is to use a tuple instead of an array for
dummyField
, assuming that it is relatively small.The text was updated successfully, but these errors were encountered: