https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110055
--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-13 branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:b0856bb588c76e16a518b459a8c9a012dc2b4e21 commit r13-7467-gb0856bb588c76e16a518b459a8c9a012dc2b4e21 Author: Richard Biener <rguent...@suse.de> Date: Mon Jun 5 08:56:53 2023 +0200 middle-end/110055 - avoid CLOBBERing static variables The gimplifier can elide initialized constant automatic variables to static storage in which case TARGET_EXPR gimplification needs to avoid emitting a CLOBBER for them since their lifetime is no longer limited. Failing to do so causes spurious dangling-pointer diagnostics on the added testcase for some targets. PR middle-end/110055 * gimplify.cc (gimplify_target_expr): Do not emit CLOBBERs for variables which have static storage duration after gimplifying their initializers. * g++.dg/warn/Wdangling-pointer-pr110055.C: New testcase. (cherry picked from commit 84eec2916fa68cd2e2b3a2cf764f2ba595cce843)