This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/81474] New: out of memory on constexpr calculation
- From: "bobk-off at yandex dot ru" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 18 Jul 2017 09:59:49 +0000
- Subject: [Bug c++/81474] New: out of memory on constexpr calculation
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81474
Bug ID: 81474
Summary: out of memory on constexpr calculation
Product: gcc
Version: 6.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: bobk-off at yandex dot ru
Target Milestone: ---
Code below cause "cc1plus.exe: out of memory allocating 65536 bytes" error on
gcc 6.3.0 for ARM (32bit version). During compilation memory usage grows to
2GB, after it compilation fails. Argument of foo (100000000) had been picked to
demonstrate bug on simple example. With large types (not trivial types) "out of
memory" error occurs on lower for-cycle depth. Look like the compiler use
"allocation from stack" memory model on each cycle iteration and doesn't free
memory after cycle.
constexpr int foo(size_t c)
{
int a = 0;
for (int i = 0; i < ci++)
{
a += i;
a -= i;
}
return a;
}
constexpr int x = foo(100000000);