https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114997
Bug ID: 114997 Summary: ICE with -std=c++20: unexpected expression ‘static_cast<UnsignedType>('\"')’ of kind static_cast_expr Product: gcc Version: 12.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: clopez at igalia dot com Target Milestone: --- Created attachment 58137 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58137&action=edit preprocessed file from JSONObject.cpp to reproduce the problem On the WebKit project recently this commit landed: https://github.com/WebKit/WebKit/commit/4855c7a1dc4214523c0b3d0c430215456ed7a0a9 It caused GCC-12 to fail with an ICE. ./Source/JavaScriptCore/runtime/JSONObject.cpp: In lambda function: ./Source/JavaScriptCore/runtime/JSONObject.cpp:1124:89: internal compiler error: unexpected expression ‘static_cast<UnsignedType>('\"')’ of kind static_cast_expr 1124 | constexpr auto quoteMask = WTF::splatBulk(static_cast<UnsignedType>('"')); | ^ 0x7ffb005ff1c9 __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 0x7ffb005ff284 __libc_start_main_impl ../csu/libc-start.c:360 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. I checked that it fails with the last released version of GCC 12 (12.3.0) both from Yocto when cross-building for ARM64 as well as the GCC 12.3.0 shipped in Debian/testing. On Debian I tested with gcc-13 and with it builds fine. I'm attaching the .ii file to reproduce the problem (compressed with xz as it is quite big) To reproduce it, download the .ii file and simple execute this command: g++-12 -O3 --std=c++20 -c JSONObject.ii Not sure if useful information, but the original compiler command had the following switches enabled g++-12 -DBUILDING_JavaScriptCore -DBUILDING_WEBKIT=1 -DBUILDING_WITH_CMAKE=1 -DBUILDING_WPE__=1 -DBWRAP_EXECUTABLE=\"/usr/bin/bwrap\" -DDBUS_PROXY_EXECUTABLE=\"/usr/bin/xdg-dbus-proxy\" -DGETTEXT_PACKAGE=\"WPE\" -DHAVE_CONFIG_H=1 -DJSC_GLIB_API_ENABLED -DPAS_BMALLOC=1 -DPKGLIBDIR=\"/usr/local/lib/wpe-webkit-2.0\" -DSTATICALLY_LINKED_WITH_WTF -DSTATICALLY_LINKED_WITH_bmalloc [...-I/long/list/of/includes/excluded/for/clarity...] -fdiagnostics-color=always -Wextra -Wall -fmax-errors=20 -Wno-odr -Wno-stringop-overread -Wno-stringop-overflow -Wno-nonnull -Wno-array-bounds -Wno-expansion-to-defined -Wno-noexcept-type -Wno-psabi -Wno-misleading-indentation -Wno-maybe-uninitialized -Wundef -Wpointer-arith -Wmissing-format-attribute -Wformat-security -Wcast-align -Wno-tautological-compare -fno-strict-aliasing -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -O3 -DNDEBUG -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -ffp-contract=off -std=c++20 -c Source/JavaScriptCore/runtime/JSONObject.cpp