[Lldb-commits] [PATCH] D42338: Fix unrepresentable float value in ScalarTest

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sat Jan 20 13:42:09 PST 2018


teemperor created this revision.
teemperor added a reviewer: uweigand.

float can't represent the given value in the literal, so we get this UB error: `runtime error: 1.23457e+48 is outside the range of representable values of type 'float'`. The test seems to not rely on this specific value, so let's just choose a smaller one that can be represented.


https://reviews.llvm.org/D42338

Files:
  unittests/Core/ScalarTest.cpp


Index: unittests/Core/ScalarTest.cpp
===================================================================
--- unittests/Core/ScalarTest.cpp
+++ unittests/Core/ScalarTest.cpp
@@ -31,7 +31,7 @@
 TEST(ScalarTest, GetBytes) {
   int a = 0x01020304;
   long long b = 0x0102030405060708LL;
-  float c = 1234567.89e42;
+  float c = 1234567.89e32;
   double d = 1234567.89e42;
   char e[16] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
   char f[32] = {1,  2,  3,  4,  5,  6,  7,  8,  9,  10, 11, 12, 13, 14, 15, 16,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42338.130778.patch
Type: text/x-patch
Size: 522 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180120/b89031cf/attachment.bin>


More information about the lldb-commits mailing list