https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127761
Bug ID: 127761
Summary: when initialization a large range with a designator, a
loop should be created
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: uecker at gcc dot gnu.org
Target Milestone: ---
In the following example, GCC creates a memset and 5000 mov instructions.
void b(const void*);
void a()
{
const int x[10000] = { [0 ... 5000] = 2 };
b(&x);
}
https://godbolt.org/z/PGT6j8Mc7