[Bug c++/125376] Distinct C++26 placeholder variables (P2169) share storage inside coroutine frames
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jun 1 15:51:59 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125376
--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-16 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:58d805dc29e883bc41b9e14e518a1c88c5a186d3
commit r16-9031-g58d805dc29e883bc41b9e14e518a1c88c5a186d3
Author: Jakub Jelinek <jakub@redhat.com>
Date: Thu May 21 16:26:22 2026 +0200
c++: Fix up handling of name independent decls in coroutine lowering
[PR125376]
For variables which do have non-NULL DECL_NAME, register_local_var_uses
uses either that name or name_depth_idx (that itself is a bug as it
can clash with user variables named that way) for the fields. In C++26
we can have multiple _ variables in the same scope, so the following
testcase is miscompiled by using the same FIELD_DECL multiple times
(once for the first _ variable, once for the second one).
The following patch fixes it by pretending such variables don't have
a name, so it uses a serial number then instead.
2026-05-21 Jakub Jelinek <jakub@redhat.com>
PR c++/125376
* coroutines.cc (register_local_var_uses): Ignore DECL_NAME for
name independent decls.
* g++.dg/coroutines/pr125376.C: New test.
(cherry picked from commit 960e68941db7412cfdfb429161d77db206a06acc)
More information about the Gcc-bugs
mailing list