chuck
chuck copied to clipboard
Segmentation fault: 11 in an Array Assign.
The following code causes a segmentation fault 11:
[ [1,2], [2,3], [3,5] ] @=> int Tab[3][2];
in the last versions of chuck on a Mac (OSX 10.9.5).
$ cat 3-prep-02a.ck
[ [1,2], [2,3], [3,5] ] @=> int Tab[3][2];
$ chuck 3-prep-02a.ck
Segmentation fault: 11
$ chuck --version
chuck version: 1.3.5.2 (chimera)
mac os x : intel : 64-bit
http://chuck.cs.princeton.edu/
http://chuck.stanford.edu/
$chuck32 3-prep-02a.ck
Segmentation fault: 11
$ chuck32 --version
chuck version: 1.3.5.3-rc1 (chimera)
mac os x : intel : 64-bit
http://chuck.cs.princeton.edu/
http://chuck.stanford.edu/
Hope this helps. Regards.
Jean-Jacques.
Hi Jean-Jacques,
Apologies for the incredibly unhelpful error, but I believe the correct syntax for assigning a new array literal is [ [1,2], [2,3], [3,5] ] @=> int Tab[][];
(that is, don't specify the size on the right-hand side).
We can look into fixing this segfault and giving a good error message for a future release. For now, editing your code should work fine.