Skip to content

Commit be32b0f

Browse files
[JSC] Work around GCC miscompilation in testmasm
https://bugs.webkit.org/show_bug.cgi?id=307056 Reviewed by Justin Michaud. It seems that GCC miscompiles the switch statement in testMoveConditionallyFloatingPointSameArg when -funswitch-loops is on (that's the case for -O3). The symptom is that we don't handle MacroAssembler::DoubleEqualAndOrdered (at least) and end up hitting the following RELEASE_ASSERT_NOT_REACHED();. Globally turn off this specific transformation when compiling with older versions of GCC, to avoid running into further hard-to-diagnose bugs. Canonical link: https://commits.webkit.org/307067@main
1 parent 346db6f commit be32b0f

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Source/cmake/WebKitCompilerFlags.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,16 @@ if (COMPILER_IS_GCC_OR_CLANG)
190190
WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS(-Wno-uninitialized)
191191
endif ()
192192

193+
# Older GCC versions sometimes miscompile switches with that flag on.
194+
# Observed in testMoveConditionallyFloatingPointSameArg (testmasm), turn it
195+
# off throughout to avoid hard-to-diagnose bugs.
196+
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
197+
# This and later versions don't seem to exhibit the issue.
198+
if (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS "14.0.1")
199+
WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS(-fno-unswitch-loops)
200+
endif ()
201+
endif ()
202+
193203
WEBKIT_PREPEND_GLOBAL_CXX_FLAGS(-Wno-noexcept-type)
194204

195205
# These GCC warnings produce too many false positives to be useful. We'll

0 commit comments

Comments
 (0)