`zeroes(1,1,0) & zeroes(1,1,0)` segfaults
falsifian opened this issue · 1 comments
falsifian commented
pdl> zeroes(1,1,0) & zeroes(1,1,0)
Segmentation fault (core dumped)
This is PDL 2.081 on OpenBSD current on amd64.
mohawk2 commented
For the sake of posterity: looping in PDL operates at 3 levels:
- there are each operation's "inherent" dimensions (which might be none, for a dimensionless/scalar operation like addition), over which any broadcasting happens; any loops happen within each operation's code
- there are two further dimension that happen in the "inner loop" generated for each
readdata
/writebackdata
- anything above that gets managed by
startbroadcastloop
which sets up data structures, anditerbroadcastloop
which moves along higher dimensions until done
The two inner loops already knew about dealing with empties, because they are implemented with two for
loops, which are a while
loop with extra stuff, but that didn't help here because the and2
operation is dimensionless, and the two inner-loop dims had 1 each. The iterbroadcastloop
knew how to stop correctly.
However, the startbroadcastloop
did not check for empty and do nothing; the commit above changes that, and now all works correctly.