tree-optimization/111123 - indirect clobbers thrown away too early
commitabf915193fbf725bb359e6936e10dcc282eb94cc
authorRichard Biener <rguenther@suse.de>
Thu, 24 Aug 2023 07:32:54 +0000 (24 09:32 +0200)
committerRichard Biener <rguenther@suse.de>
Thu, 24 Aug 2023 13:10:28 +0000 (24 15:10 +0200)
tree461abf0be17e149d479237d195c99c3a19fe7087
parent0c78240fd7d519fc27ca822f66a92f85edf43f70
tree-optimization/111123 - indirect clobbers thrown away too early

The testcase in the PR shows that late uninit diagnostic relies
on indirect clobbers in CTORs but we throw those away in the fab
pass which is too early.  The reasoning was they were supposed
to keep SSA names live but that's no longer the case since DCE
doesn't treat them as keeping SSA uses live.

The following instead removes them before out-of-SSA coalescing
which is the thing that's still affected by them.

PR tree-optimization/111123
* tree-ssa-ccp.cc (pass_fold_builtins::execute): Do not
remove indirect clobbers here ...
* tree-outof-ssa.cc (rewrite_out_of_ssa): ... but here.
(remove_indirect_clobbers): New function.

* g++.dg/warn/Wuninitialized-pr111123-1.C: New testcase.
gcc/testsuite/g++.dg/warn/Wuninitialized-pr111123-1.C [new file with mode: 0644]
gcc/tree-outof-ssa.cc
gcc/tree-ssa-ccp.cc