https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123637

--- Comment #3 from Linus Torvalds <[email protected]> ---
(In reply to Sam James from comment #1)
> $ export
> UBSAN_OPTIONS="halt_on_error=1:abort_on_error=1:print_summary=1:
> print_stacktrace=1" # nicer errors
> 
> $ gcc l.c -o l -fsanitize=undefined
> $ ./l
> a = 0.998000
> l.c:22:7: runtime error: signed integer overflow: 4286377361 * 4286377361
> cannot be represented in type 'long long int'

Ahh. I'm too damn used to the kernel, where we do -fno-strict-overflow in order
to not accept these integer overflow optimizations.

And yes, -fno-strict-overflow fixes it.

I wanted that multiplication to be done conceptually as a full signed 64-bit
multiply followed by a truncation, because that gets the *other* fractional
types I did right.

My bad. I will close this as "incompetent user"

Reply via email to