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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Arsen Arsenovic <ar...@gcc.gnu.org>:

https://gcc.gnu.org/g:5b4476a165565cb20729c0a97a3f43b060595209

commit r15-2702-g5b4476a165565cb20729c0a97a3f43b060595209
Author: Arsen ArsenoviÄ <ar...@aarsen.me>
Date:   Thu Jul 25 22:41:34 2024 +0200

    c++/coroutines: check for members we use in handle_types [PR105475]

    Currently, it is possible to ICE GCC by giving it sufficiently broken
    code, where sufficiently broken means a std::coroutine_handle missing a
    default on the promise_type template argument, and missing members.
    As the code generator relies on lookups in the coroutine_handle never
    failing (and has no way to signal that error), lets do it ahead of time,
    save the result, and use that.  This saves us some lookups and allows us
    to propagate an error.

    PR c++/105475 - coroutines: ICE in coerce_template_parms, at cp/pt.cc:9183

    gcc/cp/ChangeLog:

            PR c++/105475
            * coroutines.cc (struct coroutine_info): Add from_address.
            Carries the from_address member we looked up earlier.
            (coro_resume_identifier): Remove.  Unused.
            (coro_init_identifiers): Do not initialize the above.
            (void_coro_handle_address): New variable.  Contains the baselink
            for the std::coroutine_handle<void>::address() instance method.
            (get_handle_type_address): New function.  Looks up and validates
            handle_type::address in a given handle_type.
            (get_handle_type_from_address): New function.  Looks up and
            validates handle_type::from_address in a given handle_type.
            (coro_promise_type_found_p): Remove reliance on
            coroutine_handle<> defaulting the promise type to void.  Store
            get_handle_type_* results where appropriate.
            (get_coroutine_from_address): New helper.  Gets the
            handle_type::from_address BASELINK from a coroutine_info.
            (build_actor_fn): Use the get_coroutine_from_address helper and
            void_coro_handle_address.

    gcc/testsuite/ChangeLog:

            PR c++/105475
            * g++.dg/coroutines/pr103868.C: Add std::coroutine_handle
            members we check for now.
            * g++.dg/coroutines/pr105287.C: Ditto.
            * g++.dg/coroutines/pr105301.C: Ditto.
            * g++.dg/coroutines/pr94528.C: Ditto.
            * g++.dg/coroutines/pr94879-folly-1.C: Ditto.
            * g++.dg/coroutines/pr94883-folly-2.C: Ditto.
            * g++.dg/coroutines/pr98118.C: Ditto.
            * g++.dg/coroutines/pr105475.C: New test.
            * g++.dg/coroutines/pr105475-1.C: New test.
            * g++.dg/coroutines/pr105475-2.C: New test.
            * g++.dg/coroutines/pr105475-3.C: New test.
            * g++.dg/coroutines/pr105475-4.C: New test.
            * g++.dg/coroutines/pr105475-5.C: New test.
            * g++.dg/coroutines/pr105475-6.C: New test.
            * g++.dg/coroutines/pr105475-broken-spec.C: New test.
            * g++.dg/coroutines/pr105475-broken-spec-2.C: New test.
  • [Bug c++/105475] coroutines: IC... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to