[Bug tree-optimization/119930] [15 regression] g++.dg/coroutines/torture/pr103953.C FAILs with -O3

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Mar 13 05:06:22 GMT 2026


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

--- Comment #27 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-15 branch has been updated by Andrew Pinski
<pinskia@gcc.gnu.org>:

https://gcc.gnu.org/g:f5adcf34b094458c5e49cd7642360db7b8b9cdbf

commit r15-10946-gf5adcf34b094458c5e49cd7642360db7b8b9cdbf
Author: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Date:   Sat Mar 7 11:24:14 2026 -0800

    testsuite/c++: Fix lifetime of lambda in pr103953.C [PR119930]

    So in the end the problem with pr103953.C is the lifetime
    of a lambda object is not extended past the statement.
    With sane operator new we are able to delete stores using
    that object as it is dead afterwards.

    So the fix to the testcase is to make the lambda its own
    object and then call it.

    I also went back to check to make sure the original issue was
    reproducible with this version too.

    Tested on x86_64-linux-gnu and the testcase failure is gone.

            PR testsuite/119930

    gcc/testsuite/ChangeLog:

            * g++.dg/coroutines/torture/pr103953.C: Store the second
            lambda into its own object to extend its lifeime.

    Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
    (cherry picked from commit c7f44415a2788ec3879c2fcae56297a346852066)


More information about the Gcc-bugs mailing list