I have debugged this a little further.
I bet an assert(i < opt.jobs <http://opt.jobs>); at
multi.c:148 would fail.
I'm not sure how this code is supposed to work, but work from
there.
Even, I'm not very aware of the code, but it does seem like the
problem lies there. All the traces point to it.
assert (i < opt.jobs <http://opt.jobs>) would be wrong, since this
region of the code is simply calculating the range values based on the
chunk_size. A new thread for each range is not being spawned.
The issue was that struct range is defined with int variables, and for
file sizes > 4GB, there was an integer overflow. Replacing int with
wgint fixes the segfault.
However, valgrind continues to throw all those invalid write errors,
which leads me to believe that the issue is much deeper than this, but
I have no idea on where to start debugging this.