https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70277
Bug ID: 70277
Summary: Improve code generation for large initializer lists
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jakub at gcc dot gnu.org
Target Milestone: ---
#include <string>
#include <vector>
#define T10 "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
#define T100 T10, T10, T10, T10, T10, T10, T10, T10, T10, T10
#define T1000 T100, T100, T100, T100, T100, T100, T100, T100, T100, T100
#define T10000 T1000, T1000, T1000, T1000, T1000, T1000, T1000, T1000, T1000,
T1000
#define T100000 T10000, T10000, T10000, T10000, T10000, T10000, T10000, T10000,
T10000, T10000
int
main ()
{
std::vector<std::string> v {
T100000, T100000
};
}
ICEs during GC, 200000 nested try {} finally {} gimple stmts is just too much
for typical stack size limits.
Perhaps the compiler should find out that all initializers (over certain
threshold, perhaps --param?) are the same type and need to be constructed the
same (or at least significant range of them, e.g. if there are 1000 constant
string literals, then one other initializer that needs another kind of
constructor, then 10000 other initializers that need yet another kind), and
expand it as a loop over some const POD array instead of emitting huge
spaghetti code?