Closed Bug 1514794 Opened 8 months ago Closed 6 months ago

Compiling with -fwrapv and --enable-tests breaks in TestWrappingOperations.cpp

Categories

(Core :: JavaScript Engine, defect)

60 Branch
defect
Not set

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: gk, Unassigned)

References

Details

Compiling the ESR60 source with `--enable-tests` and specifying -fwrapv results in broken compilation of TestWrappingOperations.cpp:

61:57.58 /var/tmp/build/firefox-2bb5c165697d/mfbt/tests/TestWrappingOperations.cpp:27:1: error: non-constant condition for static assertion
61:57.58  static_assert(WrapToSigned(uint8_t(128)) == -128,
61:57.58  ^~~~~~~~~~~~~
61:57.58 /var/tmp/build/firefox-2bb5c165697d/mfbt/tests/TestWrappingOperations.cpp:27:27:   in constexpr expansion of 'mozilla::WrapToSigned<unsigned char>(128)'
61:57.58 /var/tmp/build/firefox-2bb5c165697d/obj-x86_64-pc-linux-gnu/dist/include/mozilla/WrappingOperations.h:89:59:   in constexpr expansion of 'mozilla::detail::WrapToSignedHelper<UnsignedType>::compute<unsigned char>(((int)aValue))'
61:57.58 /var/tmp/build/firefox-2bb5c165697d/mfbt/tests/TestWrappingOperations.cpp:27:1: error: overflow in constant expression [-fpermissive]
61:57.58 /var/tmp/build/firefox-2bb5c165697d/mfbt/tests/TestWrappingOperations.cpp:27:1: error: overflow in constant expression [-fpermissive]

etc.

This happens with GCC 6.4.0.

Test case: https://godbolt.org/z/TWWf5M

Bumping to MFBT, but it's unlikely anyone will spend time on this. We don't build with -fwrapv; and it's really a compiler bug. GCC 8.1 fixes it.

Summary: Compiling with --enable-tests breaks in TestWrappingOperations.cpp with -fwrapv → Compiling with -fwrapv and --enable-tests breaks in TestWrappingOperations.cpp

(In reply to Jason Orendorff [:jorendorff] from comment #1)

Test case: https://godbolt.org/z/TWWf5M

Bumping to MFBT, but it's unlikely anyone will spend time on this. We don't
build with -fwrapv; and it's really a compiler bug. GCC 8.1 fixes it.

Fair enough. It's fine closing this as WORKSFORME given that bumping GCC fixes this.

Status: NEW → RESOLVED
Closed: 6 months ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.