Large negative pressures

Linus Torvalds torvalds at linux-foundation.org
Wed Aug 7 10:08:27 PDT 2019


On Wed, Aug 7, 2019 at 10:00 AM Linus Torvalds
<torvalds at linux-foundation.org> wrote:
>
> So using -ftrapv actually works, but may not be practical. But for
> debugging this particular issue, I'll just start with an empty dive
> log and try your planner thing.

Hmm. I can do that, but then I don't see any issue.

And in fact, when I try to do your crazy plan, it doesn't really hang
for me when I do "save". It just takes about a minute or two to
generate the end result. I suspect it hangs for you because you have a
slower machine than I do, so it might take a lot longer than a couple
of minutes. Mine is pretty beefy.

Sadly, that might mean that the overflow happens in an unsigned
integer. As mentioned, unsigned integers in C don't ever really
"overflow". They are _defined_ to work as modulo-2**N math, and
-ftrapv won't cause any error for those.

It might be worth trying a few other gcc options. Things like
"-fsanitize=undefined" to find general undefined behavior (which
includes integer overflow, but also other things - but again does
*not* include the well-defined unsigned overflows).

                 Linus


More information about the subsurface mailing list