Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessing to a nested array causes segmentation fault #14

Open
uenoB opened this issue Sep 5, 2019 · 1 comment
Open

Accessing to a nested array causes segmentation fault #14

uenoB opened this issue Sep 5, 2019 · 1 comment

Comments

@uenoB
Copy link

uenoB commented Sep 5, 2019

When I write a parallel sorting program, I found that the following code causes segmentation fault both on my mac and linux.

fun copy a b e d j =
    if e < b then ()
    else let val v = Array.sub (Array.sub (a, 0), b)
         in Array.update (Array.sub (d, 0), j, v);
            copy a (b+1) e d (j+1)
         end

fun sort a b e =
    if e <= b then () else
    let val q = Int.quot (b + e, 2)
    in sort a b q;
       sort a (q+1) e;
       copy a b e a b
    end

val a = Array.array (1, Array.array (1024, 0))
val _ = sort a 0 1023

I checked out the repository and compiled the compiler as follows:

git clone https://github.com/ManticoreProject/manticore.git
git checkout 757fbcc4d   # to make clear which revision I used
autoconf -Iconfig
autoheader -Iconfig
./configure --prefix=$PWD/dest
mkdir -p dest/bin dest/lib
make install

I saved the above code in bug.pml and executed it as follows:

$ dest/bin/pmlc -o bug bug.pml
$ ./bug
Segmentation fault
@JohnReppy
Copy link
Contributor

This code is not a parallel program in Manticore. The Array structure is just provided for sequential testing/benchmarking purposes (strictly speaking, it shouldn't even exist, since Manticore does not expose imperative features to the user).

We will take a look into what causes the crash when we get a chance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants