HomePhabricator

[lldb] Scalar re-fix UB in float->int conversions

Authored by labath on Jul 1 2020, 1:18 AM.

Description

[lldb] Scalar re-fix UB in float->int conversions

The refactor in 48ca15592f1 reintroduced UB when converting out-of-bounds
floating point numbers to integers -- the behavior for ULongLong() was
originally fixed in r341685, but did not survive my refactor because I
based my template code on one of the methods which did not have this
fix.

This time, I apply the fix to all float->int conversions, instead of
just the "double->unsigned long long" case. I also use a slightly
simpler version of the code, with fewer round-trips
(APFloat->APSInt->native_int vs
APFloat->native_float->APInt->native_int).

I also add some unit tests for the conversions.

Details

Committed
labathJul 1 2020, 1:29 AM
Parents
rGf0ecfb789bb2: [NFC][ARM] Add test.
Branches
Unknown
Tags
Unknown