[Bug c++/94288] New: co_await in while loop crashes g++
chbugzilla at outlook dot com
gcc-bugzilla@gcc.gnu.org
Mon Mar 23 16:59:42 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94288
Bug ID: 94288
Summary: co_await in while loop crashes g++
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: chbugzilla at outlook dot com
Target Milestone: ---
Created attachment 48095
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48095&action=edit
Pre-processed sample code
I am using a recent development build of g++-10 to test some coroutine code
that I am able to run successfully using MSVC but that leads to a compiler
crash with g++.
I attached a small sample to reproduce the issue. I am not sure what's the root
cause but I am able to workaround the problem by pulling the co_await out of
the while loop condition. Replacing std::vector<int> with e.g. int and testing
for zero in the while loop also crashes the compiler, albeit with a different
error.
Build command:
--------------
g++-10 -fcoroutines -std=c++20 -pthread sample.cpp
Output of build:
----------------
sample.cpp: In function ‘void _Z3barv.actor(bar()::_Z3barv.frame*)’:
sample.cpp:72:5: internal compiler error: in fold_convert_loc, at
fold-const.c:2435
72 | while ((co_await foo()).empty())
| ^~~~~
0x5d60f2 fold_convert_loc(unsigned int, tree_node*, tree_node*)
../../src/gcc/fold-const.c:2435
0x9d6a1a gimplify_cond_expr
../../src/gcc/gimplify.c:4149
0x9ce9e2 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../src/gcc/gimplify.c:13559
0x9cf0fd gimplify_stmt(tree_node**, gimple**)
../../src/gcc/gimplify.c:6823
0x9cf0fd gimplify_statement_list
../../src/gcc/gimplify.c:1869
0x9cf0fd gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../src/gcc/gimplify.c:14046
0x9d1f59 gimplify_stmt(tree_node**, gimple**)
../../src/gcc/gimplify.c:6823
0x9d1f59 gimplify_and_add(tree_node*, gimple**)
../../src/gcc/gimplify.c:486
0x9d1f59 gimplify_loop_expr
../../src/gcc/gimplify.c:1843
0x9cf216 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../src/gcc/gimplify.c:13807
0x9cf0fd gimplify_stmt(tree_node**, gimple**)
../../src/gcc/gimplify.c:6823
0x9cf0fd gimplify_statement_list
../../src/gcc/gimplify.c:1869
0x9cf0fd gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../src/gcc/gimplify.c:14046
0x9cf0fd gimplify_stmt(tree_node**, gimple**)
../../src/gcc/gimplify.c:6823
0x9cf0fd gimplify_statement_list
../../src/gcc/gimplify.c:1869
0x9cf0fd gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../src/gcc/gimplify.c:14046
0x9ce267 gimplify_stmt(tree_node**, gimple**)
../../src/gcc/gimplify.c:6823
0x9ce267 gimplify_and_add(tree_node*, gimple**)
../../src/gcc/gimplify.c:486
0x9ce267 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../src/gcc/gimplify.c:13953
0x9cf0fd gimplify_stmt(tree_node**, gimple**)
../../src/gcc/gimplify.c:6823
Output of g++-10 -v:
--------------------
Using built-in specs.
COLLECT_GCC=g++-10
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/10/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
10-20200321-1ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs
--enable-languages=c,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-10
--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 --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 --enable-offload-targets=nvptx-none,amdgcn-amdhsa,hsa
--without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.0.1 20200321 (experimental) [master revision
15711e837b2:ab6586cb024:497498c878d48754318e486428e2aa30854020b9] (Ubuntu
10-20200321-1ubuntu1)
More information about the Gcc-bugs
mailing list