public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/114997] New: ICE with -std=c++20: unexpected expression ‘static_cast<UnsignedType>('\"')’ of kind static_cast_expr @ 2024-05-08 21:20 clopez at igalia dot com 2024-05-08 21:30 ` [Bug c++/114997] " clopez at igalia dot com ` (4 more replies) 0 siblings, 5 replies; 6+ messages in thread From: clopez at igalia dot com @ 2024-05-08 21:20 UTC (permalink / raw) To: gcc-bugs 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/114997] ICE with -std=c++20: unexpected expression ‘static_cast<UnsignedType>('\"')’ of kind static_cast_expr 2024-05-08 21:20 [Bug c++/114997] New: ICE with -std=c++20: unexpected expression ‘static_cast<UnsignedType>('\"')’ of kind static_cast_expr clopez at igalia dot com @ 2024-05-08 21:30 ` clopez at igalia dot com 2024-05-08 22:10 ` clopez at igalia dot com ` (3 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: clopez at igalia dot com @ 2024-05-08 21:30 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114997 --- Comment #1 from Carlos Alberto Lopez Perez <clopez at igalia dot com> --- The original cpp file that causes the issue can be found here: https://raw.githubusercontent.com/WebKit/WebKit/4855c7a1dc4214523c0b3d0c430215456ed7a0a9/Source/JavaScriptCore/runtime/JSONObject.cpp just for reference, the md5hash of the file is $ md5sum Source/JavaScriptCore/runtime/JSONObject.cpp a4799453f1b2b3c0e2bec60a095c962d Source/JavaScriptCore/runtime/JSONObject.cpp ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/114997] ICE with -std=c++20: unexpected expression ‘static_cast<UnsignedType>('\"')’ of kind static_cast_expr 2024-05-08 21:20 [Bug c++/114997] New: ICE with -std=c++20: unexpected expression ‘static_cast<UnsignedType>('\"')’ of kind static_cast_expr clopez at igalia dot com 2024-05-08 21:30 ` [Bug c++/114997] " clopez at igalia dot com @ 2024-05-08 22:10 ` clopez at igalia dot com 2024-05-09 5:53 ` pinskia at gcc dot gnu.org ` (2 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: clopez at igalia dot com @ 2024-05-08 22:10 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114997 --- Comment #2 from Carlos Alberto Lopez Perez <clopez at igalia dot com> --- On WebKit we finally work-arounded the problem by replacing `constexpr` with `const` at commit https://github.com/WebKit/WebKit/commit/1ee00a2309c03ed119e8591022ba14f936440d71 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/114997] ICE with -std=c++20: unexpected expression ‘static_cast<UnsignedType>('\"')’ of kind static_cast_expr 2024-05-08 21:20 [Bug c++/114997] New: ICE with -std=c++20: unexpected expression ‘static_cast<UnsignedType>('\"')’ of kind static_cast_expr clopez at igalia dot com 2024-05-08 21:30 ` [Bug c++/114997] " clopez at igalia dot com 2024-05-08 22:10 ` clopez at igalia dot com @ 2024-05-09 5:53 ` pinskia at gcc dot gnu.org 2024-05-09 6:03 ` [Bug c++/114997] ICE: " pinskia at gcc dot gnu.org 2024-05-09 6:07 ` [Bug c++/114997] [11/12 Only] " pinskia at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: pinskia at gcc dot gnu.org @ 2024-05-09 5:53 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114997 --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Reduced testcase: ``` typedef int vv __attribute__((__vector_size__(sizeof(int)))); constexpr vv ff(int code) { return vv{code}; } template <typename _Tp> struct h { typedef _Tp type; }; template <class T> void f() { using ut = h<unsigned char>::type; constexpr auto c = ff(static_cast<ut>('\\')); } ``` ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/114997] ICE: unexpected expression ‘static_cast<UnsignedType>('\"')’ of kind static_cast_expr 2024-05-08 21:20 [Bug c++/114997] New: ICE with -std=c++20: unexpected expression ‘static_cast<UnsignedType>('\"')’ of kind static_cast_expr clopez at igalia dot com ` (2 preceding siblings ...) 2024-05-09 5:53 ` pinskia at gcc dot gnu.org @ 2024-05-09 6:03 ` pinskia at gcc dot gnu.org 2024-05-09 6:07 ` [Bug c++/114997] [11/12 Only] " pinskia at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: pinskia at gcc dot gnu.org @ 2024-05-09 6:03 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114997 --- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- My reduced testcase has failed since 4.8.0 and started to pass in GCC 13.1.0. I wonder what fixed it (I suspect r13-3438 and if so I doubt that can be backported). Note the issue is with constexpr and vector initializers (which is why I suspect r13-3438 was the fix). ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/114997] [11/12 Only] ICE: unexpected expression ‘static_cast<UnsignedType>('\"')’ of kind static_cast_expr 2024-05-08 21:20 [Bug c++/114997] New: ICE with -std=c++20: unexpected expression ‘static_cast<UnsignedType>('\"')’ of kind static_cast_expr clopez at igalia dot com ` (3 preceding siblings ...) 2024-05-09 6:03 ` [Bug c++/114997] ICE: " pinskia at gcc dot gnu.org @ 2024-05-09 6:07 ` pinskia at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: pinskia at gcc dot gnu.org @ 2024-05-09 6:07 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114997 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |11.5 Summary|ICE: unexpected expression |[11/12 Only] ICE: |‘static_cast<UnsignedType>( |unexpected expression |'\"')’ of kind |‘static_cast<UnsignedType>( |static_cast_expr |'\"')’ of kind | |static_cast_expr ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-05-09 6:07 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2024-05-08 21:20 [Bug c++/114997] New: ICE with -std=c++20: unexpected expression ‘static_cast<UnsignedType>('\"')’ of kind static_cast_expr clopez at igalia dot com 2024-05-08 21:30 ` [Bug c++/114997] " clopez at igalia dot com 2024-05-08 22:10 ` clopez at igalia dot com 2024-05-09 5:53 ` pinskia at gcc dot gnu.org 2024-05-09 6:03 ` [Bug c++/114997] ICE: " pinskia at gcc dot gnu.org 2024-05-09 6:07 ` [Bug c++/114997] [11/12 Only] " pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).