https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116375
Bug ID: 116375
Summary: redundant copy not eliminated with CONSTRUCTOR
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: mpolacek at gcc dot gnu.org
Target Milestone: ---
While fixing bug 116015 it came up that we don't elide a redundant copy when
the initializer is a {}:
<https://gcc.gnu.org/pipermail/gcc-patches/2024-August/660058.html>
```
struct A {
int a[1000];
};
void f(A);
void g() { f ({}); }
```
results int:
void g (struct A * a)
{
struct A D.2812;
D.2812 = {};
f (D.2812);
}
Perhaps we should "assign the temporary the location of the argument slot, and
then
recognize that the copy is a no-op".