Bug 1318619 - cc1plus crash compiling huge extended initializer list of std::vector<std::string>
Summary: cc1plus crash compiling huge extended initializer list of std::vector<std::st...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 22
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-03-17 11:21 UTC by Dmitry Antipov
Modified: 2016-03-17 14:57 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-03-17 14:57:15 UTC
Type: Bug


Attachments (Terms of Use)
Preprocessed translation unit (922.46 KB, application/x-xz)
2016-03-17 11:21 UTC, Dmitry Antipov
no flags Details

Description Dmitry Antipov 2016-03-17 11:21:38 UTC
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.

Comment 1 Jakub Jelinek 2016-03-17 13:52:54 UTC
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.

Comment 2 Jakub Jelinek 2016-03-17 14:57:15 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.