]> git.ipfire.org Git - thirdparty/gcc.git/commit
forwprop: Fix non-call exceptions some more with copy prop for aggregates [PR121494]
authorAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Mon, 11 Aug 2025 20:47:30 +0000 (20:47 +0000)
committerAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Tue, 12 Aug 2025 08:06:23 +0000 (08:06 +0000)
commit2fe432175ef135037dea210002881a093f328779
tree713a8513ee921d5dd83b30aed3ec07fd9d551943
parent1786be14e94bf1a7806b9dc09186f021737f0227
forwprop: Fix non-call exceptions some more with copy prop for aggregates [PR121494]

Note this conflicts with my not yet approved patch for copy prop for aggregates into
function arguments (I will get back to that soon).

So the problem here is that I assumed if:
*a = decl1;
would not cause an exception that:
decl2 = *a;
would cause not cause one too.

I was wrong, in some cases where the Ada front-end marks `*a` in the store
as TREE_THIS_NOTRAP (due to knowing never be null or some other cases).
So that means when we prop decl1 into the statement storing decl2, we need to
mark that statement as possible to cleanup for eh.

Bootstraped and tested on x86_64-linux-gnu.
Also tested on x86_64-linux-gnu with a hack to force generate LC constant decls in the gimplifier.

PR tree-optimization/121494
gcc/ChangeLog:

* tree-ssa-forwprop.cc (optimize_agr_copyprop): Mark the bb of the use
stmt if needed for eh cleanup.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
gcc/tree-ssa-forwprop.cc