-
Notifications
You must be signed in to change notification settings - Fork 380
Closed
Description
While building CL11 1.8.0 on an x86_64 machine with gcc 9.1.1 (Fedora Rawhide), this test in HelpersTest fails:
[----------] 4 tests from CheckedMultiply
[ RUN ] CheckedMultiply.Int
/builddir/build/BUILD/CLI11-1.8.0/tests/HelpersTest.cpp:398: Failure
Value of: CLI::detail::checked_multiply(a, b)
Actual: true
Expected: false
[ FAILED ] CheckedMultiply.Int (0 ms)
The issue is that checked_multiply relies on integer overflow wrapping around, but that is undefined behavior according to the standard. When compiling with gcc, -fwrapv must be passed to the compiler so that it doesn't optimize away such code. I have verified that the test passes after adding that option to the build flags.
Metadata
Metadata
Assignees
Labels
No labels