[all-commits] [llvm/llvm-project] 8270a9: [lldb] Scalar re-fix UB in float->int conversions
Pavel Labath via All-commits
all-commits at lists.llvm.org
Wed Jul 1 01:30:02 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 8270a903baf55122289499ba00a979e9c04dcd44
https://github.com/llvm/llvm-project/commit/8270a903baf55122289499ba00a979e9c04dcd44
Author: Pavel Labath <pavel at labath.sk>
Date: 2020-07-01 (Wed, 01 Jul 2020)
Changed paths:
M lldb/source/Utility/Scalar.cpp
M lldb/unittests/Utility/ScalarTest.cpp
Log Message:
-----------
[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.
More information about the All-commits
mailing list