[Bug c++/79225] New: Memory hog for large initializers
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jan 25 10:22:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79225
Bug ID: 79225
Summary: Memory hog for large initializers
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Keywords: memory-hog
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: rguenth at gcc dot gnu.org
Target Milestone: ---
With
#include <bitset>
const auto SIEVE_SIZE = 1UL<<32;
int main() {
std::bitset<SIEVE_SIZE> set;
return 0;
}
the C++ FE builds a large zero-initializer:
;; Function int main() (null)
;; enabled by -tree-original
{
struct bitset set = {.D.24903={._M_w={0, 0, 0, 0, 0, 0, 0,.... 0, 0}}};
<<cleanup_point struct bitset set = {.D.24903={._M_w={0, 0, 0,...0,
0}}};>>;
return <retval> = 0;
}
return <retval> = 0;
which while nicely optimized at gimplification time to
int main() ()
{
int D.27535;
{
struct bitset set;
try
{
set = {};
D.27535 = 0;
return D.27535;
}
finally
{
set = {CLOBBER};
}
}
D.27535 = 0;
return D.27535;
}
hogs >4GB of memory (don't try to enlarge the bitset...).
More information about the Gcc-bugs
mailing list