]> git.ipfire.org Git - thirdparty/gcc.git/commit
middle-end/119119 - re-gimplification of empty CTOR assignments
authorRichard Biener <rguenther@suse.de>
Thu, 6 Mar 2025 08:08:07 +0000 (09:08 +0100)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 2 Apr 2025 12:00:18 +0000 (14:00 +0200)
commit2f87983131eab6bdad7da4c6ef9ce026966966a5
tree43a001cdd6b8b3699aa1b5d077ea2d3b9a6c0793
parentd3e4c092c4f167d3c3ae8aa59d273b0202cef6cf
middle-end/119119 - re-gimplification of empty CTOR assignments

The following testcase runs into a re-gimplification issue during
inlining when processing

  MEM[(struct e *)this_2(D)].a = {};

where re-gimplification does not handle assignments in the same
way than the gimplifier but instead relies on rhs_predicate_for
and gimplifying the RHS standalone.  This fails to handle
special-casing of CTORs.  The is_gimple_mem_rhs_or_call predicate
already handles clobbers but not empty CTORs so we end up in
the fallback code trying to force the CTOR into a separate stmt
using a temporary - but as we have a non-copyable type here that ICEs.

The following generalizes empty CTORs in is_gimple_mem_rhs_or_call
since those need no additional re-gimplification.

PR middle-end/119119
* gimplify.cc (is_gimple_mem_rhs_or_call): All empty CTORs
are OK when not a register type.

* g++.dg/torture/pr11911.C: New testcase.

(cherry picked from commit 3bd61c1dfaa2d7153eb4be82f423533ea937d0f9)
gcc/gimplify.cc
gcc/testsuite/g++.dg/torture/pr11911.C [new file with mode: 0644]