https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106713

            Bug ID: 106713
           Summary: Coroutine regression in GCC 11.3.0: if (co_await ...)
                    crashes with a jump to ud2
           Product: gcc
           Version: 11.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: arsen at aarsen dot me
  Target Milestone: ---

I can reproduce the jump to ud2 on 11.3.0, GCC 12.2.0, as well as
g:b6316324fceaef431799a8b386de5cc9881d6898 but not 11.2.0, on x86_64 Gentoo
Linux with glibc 2.35.

GCC command line: g++ -v -save-temps -fsanitize=undefined -Wall -Wextra
-std=c++20 -I. -o bad bad-test.ii
(though, this is also reproducible with just g++ -std=c++20 -o bad bad-test.ii)

Compiler output:
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/11.3.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-11.3.0/work/gcc-11.3.0/configure
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/11.3.0
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/11.3.0
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/11.3.0/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/11.3.0/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include/g++-v11
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/11.3.0/python
--enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt
--disable-werror --with-system-zlib --enable-nls --without-included-gettext
--disable-libunwind-exceptions --enable-checking=release
--with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 11.3.0 p5'
--disable-esp --enable-libstdcxx-time --disable-libstdcxx-pch --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
--enable-multilib --with-multilib-list=m32,m64 --disable-fixed-point
--enable-targets=all --enable-libgomp --disable-libssp --disable-libada
--disable-cet --disable-systemtap --disable-valgrind-annotations
--disable-vtable-verify --disable-libvtv --without-zstd --enable-lto
--without-isl --enable-default-pie --enable-default-ssp
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.3.0 (Gentoo 11.3.0 p5) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-fsanitize=undefined' '-Wall' '-Wextra'
'-std=c++20' '-I' '.' '-o' 'bad' '-shared-libgcc' '-mtune=generic'
'-march=x86-64' '-dumpdir' 'bad-'
 /usr/libexec/gcc/x86_64-pc-linux-gnu/11.3.0/cc1plus -fpreprocessed bad-test.ii
-quiet -dumpdir bad- -dumpbase bad-test.ii -dumpbase-ext .ii -mtune=generic
-march=x86-64 -Wall -Wextra -std=c++20 -version -fsanitize=undefined -o
bad-bad-test.s
GNU C++20 (Gentoo 11.3.0 p5) version 11.3.0 (x86_64-pc-linux-gnu)
        compiled by GNU C version 11.3.0, GMP version 6.2.1, MPFR version
4.1.0-p13, MPC version 1.2.1, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++20 (Gentoo 11.3.0 p5) version 11.3.0 (x86_64-pc-linux-gnu)
        compiled by GNU C version 11.3.0, GMP version 6.2.1, MPFR version
4.1.0-p13, MPC version 1.2.1, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: e1914a2c1e0f5aa3fac1881c1e8f375c
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-fsanitize=undefined' '-Wall' '-Wextra'
'-std=c++20' '-I' '.' '-o' 'bad' '-shared-libgcc' '-mtune=generic'
'-march=x86-64' '-dumpdir' 'bad-'
 /usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/../../../../x86_64-pc-linux-gnu/bin/as
-v -I . --64 -o bad-bad-test.o bad-bad-test.s
GNU assembler version 2.38 (x86_64-pc-linux-gnu) using BFD version (Gentoo 2.38
p4) 2.38
COMPILER_PATH=/usr/libexec/gcc/x86_64-pc-linux-gnu/11.3.0/:/usr/libexec/gcc/x86_64-pc-linux-gnu/11.3.0/:/usr/libexec/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/../../../../x86_64-pc-linux-gnu/bin/
LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/:/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/../../../../x86_64-pc-linux-gnu/lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-fsanitize=undefined' '-Wall' '-Wextra'
'-std=c++20' '-I' '.' '-o' 'bad' '-shared-libgcc' '-mtune=generic'
'-march=x86-64' '-dumpdir' 'bad.'
 /usr/libexec/gcc/x86_64-pc-linux-gnu/11.3.0/collect2 -plugin
/usr/libexec/gcc/x86_64-pc-linux-gnu/11.3.0/liblto_plugin.so
-plugin-opt=/usr/libexec/gcc/x86_64-pc-linux-gnu/11.3.0/lto-wrapper
-plugin-opt=-fresolution=bad.res -plugin-opt=-pass-through=-lgcc_s
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc
--eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie
-o bad /usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/../../../../lib64/Scrt1.o
/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/../../../../lib64/crti.o
/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/crtbeginS.o
-L/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0
-L/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/../../../../lib64 -L/lib/../lib64
-L/usr/lib/../lib64
-L/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/../../../../x86_64-pc-linux-gnu/lib
-L/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/../../.. bad-bad-test.o -lstdc++ -lm
-lubsan -lgcc_s -lgcc -lc -lgcc_s -lgcc
/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/crtendS.o
/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/../../../../lib64/crtn.o
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-fsanitize=undefined' '-Wall' '-Wextra'
'-std=c++20' '-I' '.' '-o' 'bad' '-shared-libgcc' '-mtune=generic'
'-march=x86-64' '-dumpdir' 'bad.'

I bisected by testing the attached test case with various gcc commits to land
between g:70ee703c479081ac2ea67eb67041551216e66783 (bad) and
g:de07cff96abd43f6f65dcf333958899c2ec42598 (good). Each commit that doesn't
crash with ud2 was considered good, and each one that does was considered bad
by my bisect setup.
The commit in between doesn't compile, and I don't understand the code enough
to figure out which of the two bad ones is responsible :/

I'm currently C-Vise reducing with a (hopefully) more precise interestingness
test, will post later if it works out

Reply via email to