https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119015
Bug ID: 119015
Summary: [14 Regression] g++ -O2 uses huge amounts of time and
memory
Product: gcc
Version: 14.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: bunk at stusta dot de
Target Milestone: ---
Created attachment 60585
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60585&action=edit
preprocessed amd64 source
KDE Marble failed to build in Debian on armhf with "virtual memory exhausted:
Cannot allocate memory", and of all files the only one where gcc runs out of
address space is the source of the "About" dialog.
While running out of address space is specific to architecture and compile
flags, the issue itself does not seem to be.
This also indicates that this is not an infinite loop, it's just using a huge
amount of time and memory.
On armhf the build time difference is more like a factor of 50, but the issue
is also visible on amd64:
$ time g++-14 MarbleAboutDialog.cpp.ii -c -Os
real 0m2.694s
user 0m2.665s
sys 0m0.024s
$ time g++-14 MarbleAboutDialog.cpp.ii -c -O2
real 0m18.784s
user 0m18.683s
sys 0m0.072s
$
With gcc 13 both -Os and -O2 are fast (~ 50% time increase -Os -> -O2 on
amd64).