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

melg melg <public.melg8 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |public.melg8 at gmail dot com

--- Comment #26 from melg melg <public.melg8 at gmail dot com> ---
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<std::string> 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 <coroutine>
#include <vector>
#include <string>

auto use_vector_of_strings(std::vector<std::string> 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<std::string> 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:
<source>: In function 'task string_test_1()':
<source>: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*, false, default_hash_traits<tree_node*> >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*))
        ???:0
0x10f5a63 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*))
        ???:0

Reply via email to