[Bug c++/63728] Memory exhaustion using constexpr constructors for classes with large array members
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri May 13 21:47:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63728
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2016-05-13
CC| |msebor at gcc dot gnu.org
Blocks| |55004
Ever confirmed|0 |1
Known to fail| |4.9.3, 5.3.0, 6.1.0
--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed. Unbounded constexpr can eat up a lot of memory. Here's a smaller
test case:
$ (cat xx.cpp && ulimit -v $(expr 4096 \* 16) && /build/gcc-trunk-svn/gcc/xg++
-B /build/gcc-trunk-svn/gcc -DNBITS=10000 -S -Wall -Wextra xx.cpp); echo $?
template <int N>
struct S
{
int a [N / (8 * sizeof (int))];
constexpr S (): a () { }
};
S<NBITS> s;
0
$ (ulimit -v $(expr 4096 \* 16) && /build/gcc-trunk-svn/gcc/xg++ -B
/build/gcc-trunk-svn/gcc -DNBITS=10000000 -S -Wall -Wextra xx.cpp); echo
$?virtual memory exhausted: Cannot allocate memory
1
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55004
[Bug 55004] [meta-bug] constexpr issues
More information about the Gcc-bugs
mailing list