https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122772
--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <[email protected]>: https://gcc.gnu.org/g:1eb6a757b060087731162d821410a9b384568079 commit r16-6270-g1eb6a757b060087731162d821410a9b384568079 Author: Jakub Jelinek <[email protected]> Date: Fri Dec 19 11:24:02 2025 +0100 c++: Fix stabilization of bitfields [PR122772] The following testcase is rejected, because due to the C++17 b @= a ordering of side-effects cp_stabilize_reference is called on the lhs of the compound assignment. For some cases cp_stabilize_reference just uses stabilize_reference, but for other cases it attempts to bind a reference to the expression. This doesn't work for bit-fields and DECL_PACKED fields though, we can't take address of a bit-field (nor DECL_PACKED field) and error on that. This patch introduces for this another wrapper around stabilize_reference, which for clk_bitfield | clk_packed handles some trees stabilize_reference doesn't handle correctly for C++, and for the rest defers to stabilize_reference. This way, we can introduce multiple SAVE_EXPRs (like stabilize_expr itself already can as well), but can handle even the weirdest lhs expressions for which lvalue_kind returns clk_bitfield or clk_packed set. 2025-12-19 Jakub Jelinek <[email protected]> PR c++/122772 * tree.cc (cp_stabilize_bitfield_reference): New function. (cp_stabilize_reference): Use it for stabilization of clk_bitfield or clk_packed lvalues. * g++.dg/cpp1z/eval-order14.C: New test.
