https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117684
Bug ID: 117684 Summary: High compiling time for array initialization Product: gcc Version: 8.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: Sebastien.Lemetter at de dot bosch.com Target Milestone: --- Created attachment 59637 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59637&action=edit This is the code example which shows the bug. Just copy the file and run the gcc command Hi, We have a complex data structure which should be initialized with non 0 (default) values. If we set the non default value, the compilation time goes from less than 1s to 5min or more. We understand that initializing a large memory segment takes time, but generating the binary code for doing this task should not last long. Here is the command that we are using for compiling the code: /usr/bin/g++-8 '-std=c++17' '-D_FORTIFY_SOURCE=2' -MD -MF main.d -g0 -O2 -DNDEBUG -Werror -c main.cpp -o main.o Here is the exact version of the compiler we are using: ❯ /usr/bin/g++-8 --version g++-8 (Ubuntu 8.4.0-3ubuntu2) 8.4.0 Copyright (C) 2018 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 Here is the OS version we are using: ❯ cat /etc/os-release NAME="Ubuntu" VERSION="20.04.5 LTS (Focal Fossa)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 20.04.5 LTS" VERSION_ID="20.04" HOME_URL="https://www.ubuntu.com/"