[PATCH] D44429: [BinaryFormat] MessagePack reader/writer

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 22 17:49:30 PDT 2018


vitalybuka added inline comments.


================
Comment at: llvm/trunk/lib/BinaryFormat/MsgPackWriter.cpp:91
+  // If no loss of precision, encode as a Float32.
+  float f = static_cast<float>(d);
+  if (static_cast<double>(f) == d) {
----------------
This upsets ubsan 

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/22688/steps/check-llvm%20ubsan/logs/stdio

```
- Testing: 27458 tests, 64 threads --
Testing: 0 
FAIL: LLVM-Unit :: BinaryFormat/./BinaryFormatTests/MsgPackWriter.TestWriteFloat64 (1375 of 27458)
******************** TEST 'LLVM-Unit :: BinaryFormat/./BinaryFormatTests/MsgPackWriter.TestWriteFloat64' FAILED ********************
Note: Google Test filter = MsgPackWriter.TestWriteFloat64
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from MsgPackWriter
[ RUN      ] MsgPackWriter.TestWriteFloat64
/b/sanitizer-x86_64-linux-fast/build/llvm/lib/BinaryFormat/MsgPackWriter.cpp:91:32: runtime error: -2.28999e+226 is outside the range of representable values of type 'float'
    #0 0x46e045 in llvm::msgpack::Writer::write(double) /b/sanitizer-x86_64-linux-fast/build/llvm/lib/BinaryFormat/MsgPackWriter.cpp:91:32
    #1 0x455ace in MsgPackWriter_TestWriteFloat64_Test::TestBody() /b/sanitizer-x86_64-linux-fast/build/llvm/unittests/BinaryFormat/MsgPackWriterTest.cpp:218:12
    #2 0x4a726f in testing::Test::Run() /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc:2474:5
    #3 0x4a80d5 in testing::TestInfo::Run() /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc:2656:11
    #4 0x4a8bd2 in testing::TestCase::Run() /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc:2774:28
    #5 0x4b0503 in testing::internal::UnitTestImpl::RunAllTests() /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc:4649:43
    #6 0x4afeb6 in testing::UnitTest::Run() /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc:4257:10
    #7 0x49f524 in RUN_ALL_TESTS /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/include/gtest/gtest.h:2233:46
    #8 0x49f524 in main /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/UnitTestMain/TestMain.cpp:51
    #9 0x7fe190b362e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
    #10 0x411ae9 in _start (/b/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/unittests/BinaryFormat/BinaryFormatTests+0x411ae9)
```


Repository:
  rL LLVM

https://reviews.llvm.org/D44429





More information about the llvm-commits mailing list