[Bug c++/98056] coroutines: ICE tree check: expected record_type or union_type or qual_union_type, have array_type since r11-2183-g0f66b8486cea8668
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98056
melg melg changed:
What|Removed |Added
CC||public.melg8 at gmail dot com
--- Comment #26 from melg melg ---
I think i found regression of this bug. Or maybe similar type of bug, but with
slightly different reproducible. Using std::vector as container and std::string
as elements of vector, when you take std::vector as argument by
value to the coroutine and on call side initialize that argument with single
std::string value using initializer list - you get ICE.
Affected versions (tested on godbolt.org):
x86-64 gcc:
- 11.1, 11.2, 11.4
- 12.3
- 13.1, 13.2
Luckily 14.1 version of gcc doesn't have this error.
Minimal reproducer online: https://godbolt.org/z/drnf3PWsY
Compilation flags: "-std=c++20"
Minimal reproducer source code:
#include
#include
#include
auto use_vector_of_strings(std::vector values) {
struct awaitable {
bool await_ready() { return false; }
void await_suspend(std::coroutine_handle<> h) {
h.resume();
}
void await_resume() {}
};
return awaitable{};
}
struct task {
struct promise_type {
task get_return_object() { return {}; }
std::suspend_never initial_suspend() { return {}; }
std::suspend_never final_suspend() noexcept { return {}; }
void return_void() {}
void unhandled_exception() {}
};
};
task string_test_1() {
std::string test = "hello";
co_await use_vector_of_strings({test}); // ICE here.
}
task string_test_2() {
std::string test = "hello";
std::vector container{test}; // No problem here.
co_await use_vector_of_strings(container); // No problem here.
}
int main() {
string_test_1();
string_test_2();
}
ICE error message:
: In function 'task string_test_1()':
:29:1: internal compiler error: in build_special_member_call, at
cp/call.cc:11093
29 | }
| ^
0x1ce62bc internal_error(char const*, ...)
???:0
0x71ee4d fancy_abort(char const*, int, char const*)
???:0
0x10f5a63 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set >*))
???:0
0x10f5a63 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set >*))
???:0
[Bug c++/98056] coroutines: ICE tree check: expected record_type or union_type or qual_union_type, have array_type since r11-2183-g0f66b8486cea8668
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98056 Richard Biener changed: What|Removed |Added Status|NEW |RESOLVED Known to work||11.4.0 Known to fail||10.5.0 Target Milestone|10.5|11.4 Resolution|--- |FIXED --- Comment #25 from Richard Biener --- Fixed in GCC 11+.
[Bug c++/98056] coroutines: ICE tree check: expected record_type or union_type or qual_union_type, have array_type since r11-2183-g0f66b8486cea8668
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98056 --- Comment #24 from CVS Commits --- The releases/gcc-11 branch has been updated by Jason Merrill : https://gcc.gnu.org/g:998e77e55126269b3e67b2f05f0f27a421839673 commit r11-10641-g998e77e55126269b3e67b2f05f0f27a421839673 Author: Jason Merrill Date: Wed Mar 15 16:33:37 2023 -0400 c++: co_await and initializer_list [PR103871] When flatten_await_stmt processes the backing array for an initializer_list, we call cp_build_modify_expr to initialize the promoted variable from the TARGET_EXPR; that needs to be accepted. PR c++/103871 PR c++/98056 gcc/cp/ChangeLog: * typeck.c (cp_build_modify_expr): Allow array initialization of DECL_ARTIFICIAL variable. gcc/testsuite/ChangeLog: * g++.dg/coroutines/co-await-initlist1.C: New test.
[Bug c++/98056] coroutines: ICE tree check: expected record_type or union_type or qual_union_type, have array_type since r11-2183-g0f66b8486cea8668
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98056 --- Comment #23 from CVS Commits --- The releases/gcc-12 branch has been updated by Jason Merrill : https://gcc.gnu.org/g:1da2d99c632a90e5af55c8f8db1c11af587bb0a0 commit r12-9434-g1da2d99c632a90e5af55c8f8db1c11af587bb0a0 Author: Jason Merrill Date: Wed Mar 15 16:33:37 2023 -0400 c++: co_await and initializer_list [PR103871] When flatten_await_stmt processes the backing array for an initializer_list, we call cp_build_modify_expr to initialize the promoted variable from the TARGET_EXPR; that needs to be accepted. PR c++/103871 PR c++/98056 gcc/cp/ChangeLog: * typeck.cc (cp_build_modify_expr): Allow array initialization of DECL_ARTIFICIAL variable. gcc/testsuite/ChangeLog: * g++.dg/coroutines/co-await-initlist1.C: New test.
[Bug c++/98056] coroutines: ICE tree check: expected record_type or union_type or qual_union_type, have array_type since r11-2183-g0f66b8486cea8668
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98056 --- Comment #22 from Avi Kivity --- This is wonderful, thank you.
[Bug c++/98056] coroutines: ICE tree check: expected record_type or union_type or qual_union_type, have array_type since r11-2183-g0f66b8486cea8668
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98056 --- Comment #21 from CVS Commits --- The trunk branch has been updated by Jason Merrill : https://gcc.gnu.org/g:ea4dd8f512979db247c54d6b41377bb73699bcd7 commit r13-6702-gea4dd8f512979db247c54d6b41377bb73699bcd7 Author: Jason Merrill Date: Wed Mar 15 16:33:37 2023 -0400 c++: co_await and initializer_list [PR103871] When flatten_await_stmt processes the backing array for an initializer_list, we call cp_build_modify_expr to initialize the promoted variable from the TARGET_EXPR; that needs to be accepted. PR c++/103871 PR c++/98056 gcc/cp/ChangeLog: * typeck.cc (cp_build_modify_expr): Allow array initialization of DECL_ARTIFICIAL variable. gcc/testsuite/ChangeLog: * g++.dg/coroutines/co-await-initlist1.C: New test.
[Bug c++/98056] coroutines: ICE tree check: expected record_type or union_type or qual_union_type, have array_type since r11-2183-g0f66b8486cea8668
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98056 --- Comment #20 from charles-yubo --- As seen in godbolt, https://godbolt.org/z/qKGdPv94r , it exists in 11.3 and 12.1 with new following message : error: array used as initializer
[Bug c++/98056] coroutines: ICE tree check: expected record_type or union_type or qual_union_type, have array_type since r11-2183-g0f66b8486cea8668
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98056 Jakub Jelinek changed: What|Removed |Added Target Milestone|10.4|10.5 --- Comment #19 from Jakub Jelinek --- GCC 10.4 is being released, retargeting bugs to GCC 10.5.
[Bug c++/98056] coroutines: ICE tree check: expected record_type or union_type or qual_union_type, have array_type since r11-2183-g0f66b8486cea8668
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98056 Iain Sandoe changed: What|Removed |Added CC||me at xecycle dot info --- Comment #18 from Iain Sandoe --- *** Bug 104020 has been marked as a duplicate of this bug. ***
[Bug c++/98056] coroutines: ICE tree check: expected record_type or union_type or qual_union_type, have array_type since r11-2183-g0f66b8486cea8668
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98056
Konstantin changed:
What|Removed |Added
CC||sks_f at mail dot ru
--- Comment #17 from Konstantin ---
Bug still exist in 11.2.1:
/ClientHandshake.cpp:64:1: error: array used as initializer
compiler fails on line:
co_await writer().all({ AS_BYTE(m_sessionType), id });
[Bug c++/98056] coroutines: ICE tree check: expected record_type or union_type or qual_union_type, have array_type since r11-2183-g0f66b8486cea8668
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98056 Iain Sandoe changed: What|Removed |Added CC||lcw at fb dot com --- Comment #16 from Iain Sandoe --- *** Bug 103580 has been marked as a duplicate of this bug. ***
[Bug c++/98056] coroutines: ICE tree check: expected record_type or union_type or qual_union_type, have array_type since r11-2183-g0f66b8486cea8668
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98056 Iain Sandoe changed: What|Removed |Added CC||brad.nemanich at amd dot com --- Comment #15 from Iain Sandoe --- *** Bug 102883 has been marked as a duplicate of this bug. ***
[Bug c++/98056] coroutines: ICE tree check: expected record_type or union_type or qual_union_type, have array_type since r11-2183-g0f66b8486cea8668
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98056 --- Comment #14 from Iain Sandoe --- (In reply to Avi Kivity from comment #13) > In current master (90c3a62272313bb08cd5d9a948ff2d71af73b294), we don't ICE, > but instead get this error: > > coroutine-initializer-list.cc: In member function ‘task task::e()’: > coroutine-initializer-list.cc:23:3: error: array used as initializer I have a draft patch for this bug (actually covers several bugs), but it's not quite ready to post yet - so, I wouldn't expect it to be fixed.
[Bug c++/98056] coroutines: ICE tree check: expected record_type or union_type or qual_union_type, have array_type since r11-2183-g0f66b8486cea8668
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98056 --- Comment #13 from Avi Kivity --- In current master (90c3a62272313bb08cd5d9a948ff2d71af73b294), we don't ICE, but instead get this error: coroutine-initializer-list.cc: In member function ‘task task::e()’: coroutine-initializer-list.cc:23:3: error: array used as initializer
