[Bug c++/126215] ICE constant not recomputed when 'ADDR_EXPR' changed
"cvs-commit at gcc dot gnu.org via Gcc-bugs" <[email protected]>
| Newsgroups | gmane.comp.gcc.bugs |
|---|---|
| Message-ID | <[email protected]/bugzilla/> |
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126215 --- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-16 branch has been updated by Marek Polacek <[email protected]>: https://gcc.gnu.org/g:6a2c181f0f75cc4085b6e004973cc74c3922298c commit r16-9376-g6a2c181f0f75cc4085b6e004973cc74c3922298c Author: Marek Polacek <[email protected]> Date: Thu Jul 23 10:58:16 2026 -0400 c++: constant not recomputed when ADDR_EXPR changed [PR126215] Like in PR110822, the attached test produces an ICE in verify_address: error: constant not recomputed when 'ADDR_EXPR' changed since r10-7718, but it wasn't fixed by r15-7762. The reason is that here we have: {.D.3013={.D.3006={.a={.ptr=&<retval>.D.3013.D.3006.a}}, .D.3007={.b={.ptr=&<retval>.D.3013.D.3007.b}}}} and we replace '<retval>' with 'names', but we only call recompute_tree_invariant_expr for the first ADDR_EXPR, not the latter. For the second ADDR_EXPR d->changed will be false: the first replacement changed the shared tree <retval>.D.3013. So I'm afraid we have to recompute the flags unconditionally. It may be a bit slower, but it's correct. PR c++/126215 gcc/cp/ChangeLog: * constexpr.cc (replace_decl_r): Recompute the flags unconditionally. gcc/testsuite/ChangeLog: * g++.dg/cpp1z/constexpr-nsdmi1.C: New test. Reviewed-by: Jason Merrill <[email protected]>