On Wed, Aug 7, 2019 at 10:08 AM Linus Torvalds
<[email protected]> wrote:
>
> 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).
No luck there either. It does report
core/divelist.c:784:1: runtime error: null pointer passed as
argument 1, which is declared to never be null
core/trip.c:50:1: runtime error: null pointer passed as argument 1,
which is declared to never be null
so we're doing something wrong in our MAKE_SORT() cases, but nothing
for the planner overflows.
So I suspect we have unsigned math. Quite possibly because we have
"feet_to_mm()" that returns "unsigned long", and then C type
conversions will convert everything else to unsigned long too..
But we also have psi_to_mbar() return a "long", so on a 64-bit machine
like mine, it actually does 64-bit mbar. Maybe that is then used in
an expression, and the whole expression is done in long (and no
overflow happens), but then we end up truncating to "int" when
assigning the end result.
Again, truncation of long to int isn't undefined behavior or overflow.
It's just a value truncation.
I'll play around with narrowing our types (and making them signed) and
seeing if something pops up.
Linus
_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface