https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96717
Bug ID: 96717 Summary: -flifetime-dse=2 breaks webkit-gtk-2.28.4 Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: slyfox at gcc dot gnu.org Target Milestone: --- Created attachment 49084 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49084&action=edit part-of-webkit-gtk-2.28.4.tar.gz Initially I noticed the bug on liferea which uses webkit-gtk-2.28.4 as a rendering engine. I was not able to extract minimal example because I got lost in SFINATE instance selections. I am not sure if it's a webkit bug or gcc bug. I'm leaning to gcc bug. gcc-10 used to work. gcc-11 generates code that hits 'ud2'. The webkit client code looks simple: we create a hash set of raw pointers and add pointers there to see how hashset resizes: """ #define USE_SYSTEM_MALLOC 1 /* avoid bmalloc */ #include "wtf/HashSet.h" #include "wtf/Threading.h" using namespace WTF; int main() { HashSet<Thread*> hst; for (int i = 1; i < 1000; ++i) { Thread * v = (Thread*)(long)(i * 128); hst.add(v); } } """ But headers take almost 2 megabytes. Building the example with -fno-lifetime-dse produces working code. Building without breaks on first hash table resize: $ ./mk.bash ./a ./mk.bash: line 50: 1054935 Illegal instruction (core dumped) ./a 132 ./a-nodse 0 The 'ud2' is encountered in HashTable::rehash() method: https://github.com/WebKit/webkit/blob/master/Source/WTF/wtf/HashTable.h#L1304 Attaching self-contained directory with sources and headers. Can you help me rule out gcc's misbehaviour?