https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106241
Bug ID: 106241 Summary: compiler can't handle large array of strings Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: robert.durkacz at gmail dot com Target Milestone: --- Compiler fails with an internal error when given an unreasonably large source file. This is because I am simply trying to get a large string array put direct into object code. My personal interest in reporting this as a bug, whether it is or not, is to get any advice what is a better way to do what I am trying to do. Source code is included here in this description. Bug report at request of compiler ================================= Transcript: $ g++ -g -std=c++11 -Wall -fPIC -o obj/maps.cpp.o maps.cpp.cpp g++: internal compiler error: Killed (program cc1plus) Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions. Source code: maps.cpp.cpp, which includes ... #include "maps.include.cpp" Compiler version $ g++ --version g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. System type $ uname -a Linux Satellite-Pro-L50-B 5.4.0-121-generic #137~18.04.1-Ubuntu SMP Mon Jun 20 07:25:24 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux Text of source files. ===============================maps.cpp.cpp===================================== #include <iostream> #include <string> using namespace std; struct La {string lemma; string a;}; struct Form_map { string s; struct La la; }; struct Form_map form_array[]= { #include "maps.include.cpp" }; int main() { cout <<form_array[1].s <<" "; cout <<form_array[1].la.lemma <<" "; cout <<form_array[1].la.a <<endl; } ===============================eof============================================== maps.include.cpp consists of 5,200,000 lines similar to this one: {"ADP", {"ADP", "s{NGDAILV}|mq_"}},