https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117631
Bug ID: 117631
Summary: Not removing only set static variable with an array
which is set with a constructor
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: ipa
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Take:
```
struct Foo { int i; Foo() { i = 1; } };
struct A { Foo foo[2]; };
static A a;
static Foo b;
static Foo c[2];
static int d[2] = {1,1};
void foo()
{
a.foo[0].i = 2;
a.foo[1].i = 2;
b.i = 2;
c[0].i = 2;
c[1].i = 2;
d[0] = 2;
d[1] = 2;
}
```
GCC currently is able to remove b and d but not a nor c.