[PATCH] D59500: [ConstantFolding] Fix GetConstantFoldFPValue to avoid cast overflow.

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 19 13:51:35 PDT 2019


lebedev.ri added a comment.

In D59500#1435443 <https://reviews.llvm.org/D59500#1435443>, @bixia wrote:

> The problem is only reported by ubsan (undefined behavior sanitizer). My test case produces a value of 1.27e+80, which is a value between max(float) and max(double). Without ubsan, llvm opt (compiled with clang for x86) produces the correct result silently. However, since (float)the-double-value has undefined behavior by c++ language, there is no guarantee that the llvm opt produced by any compiler for any platform produces the same result. Do you have suggestion on what is a better test case?


That test doesn't test any of what you have just said.
It only tests that there is no `call` in the output.
At the very least you probably want to actually test the output, not lack of unwanted output.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59500/new/

https://reviews.llvm.org/D59500





More information about the llvm-commits mailing list