Hide Forgot
Created attachment 1137360 [details] Preprocessed translation unit Description of problem: Program cc1plus crashes with ICE on valid input. Version-Release number of selected component (if applicable): gcc version 5.3.1 20151207 (Red Hat 5.3.1-2) (GCC) How reproducible: 100% reproducible. Steps to Reproduce: /usr/libexec/gcc/x86_64-redhat-linux/5.3.1/cc1plus -quiet -std=c++11 -fpreprocessed test.ii Actual results: Segmentation fault (core dumped) Expected results: Default executable (a.out) should be generated.
This runs out of stuck during garbage collection in the compiler, because the testcase is just insane. Why would you do something so silly? int main () { std::vector<std::string> v { // 200000 string literals here }; } Even if you manage to compile this, it is insanely costly at runtime. If you really need them in the form of std::vector<std::string> with 200000 elements, better add the literals into static const char *vv[] = { // 200000 string literals here }; allocate a vector with length 200000 and push them in a loop.
Filed PR70277 to track possible enhancement here, but it will not happen before GCC 7 next year. In the mean time, just use C++ wisely.