https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100433
Bug ID: 100433 Summary: [modules] segfault with optimization greater than -O0 Product: gcc Version: 11.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gavrilikhin.daniil at gmail dot com Target Milestone: --- Created attachment 50760 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50760&action=edit 2 preprocessed files This code that uses modules with -O0 works well, but with -O1, -O2, or -O3 produces segfault. No flags were helpful (and -fsanitize=undefined does not work with modules. There's already a bug report for it, however). P.S: Tried it without modules - worked well with any optimization level. P.P.S: Additional info: the exact version of GCC: 11.1.1 20210428 (GCC) the system type: Ubuntu 21.04 hirsute the options given when GCC was configured/built: (Default Ubuntu 21.04 g++-11) ../configure -v --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,c++,go,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --target=x86_64-linux-gnu the complete command line that triggers the bug: g++-11 -g -O3 -std=c++20 -fmodules-ts -Wall -Wextra -Wpedantic -fno-strict-aliasing -fwrapv -fno-aggressive-loop-optimizations oauth2.cpp main.cpp the compiler output (error messages, warnings, etc.): Nothing at compile time. Segmentation fault (core dumped) at runtime