public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56671] New: Gcc uses large amounts of memory and processor power with large C++11 bitsets
@ 2013-03-21  1:34 m101010a at gmail dot com
  2013-03-21  8:32 ` [Bug c++/56671] " markus at trippelsdorf dot de
  2013-09-10 19:02 ` tudorb at fb dot com
  0 siblings, 2 replies; 3+ messages in thread
From: m101010a at gmail dot com @ 2013-03-21  1:34 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56671

             Bug #: 56671
           Summary: Gcc uses large amounts of memory and processor power
                    with large C++11 bitsets
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: m101010a@gmail.com


When I attempt to instantiate std::bitset<1024*1024*1024> in C++98 mode,
compilation takes a quarter-second and uses almost no RAM.  In C++11 mode, it
takes 8 seconds and almost 2GB of RAM.  The time and memory usage appear to
scale linearly with the size of the bitset.  No errors or warnings are reported
in either mode.

Full code:
#include <bitset>
int main()
{
    std::bitset<1024*1024*1024> bs;
}

Compilation lines:
g++ -std=c++98 x.cpp
g++ -std=c++11 x.cpp

g++ -v:
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /build/src/gcc-4.7.2/configure --prefix=/usr --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch
--enable-libstdcxx-time --enable-gnu-unique-object --enable-linker-build-id
--with-ppl --enable-cloog-backend=isl --disable-ppl-version-check
--disable-cloog-version-check --enable-lto --enable-gold --enable-ld=default
--enable-plugin --with-plugin-ld=ld.gold --with-linker-hash-style=gnu
--enable-multilib --disable-libssp --disable-build-with-cxx
--disable-build-poststage1-with-cxx --enable-checking=release
Thread model: posix
gcc version 4.7.2 (GCC)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/56671] Gcc uses large amounts of memory and processor power with large C++11 bitsets
  2013-03-21  1:34 [Bug c++/56671] New: Gcc uses large amounts of memory and processor power with large C++11 bitsets m101010a at gmail dot com
@ 2013-03-21  8:32 ` markus at trippelsdorf dot de
  2013-09-10 19:02 ` tudorb at fb dot com
  1 sibling, 0 replies; 3+ messages in thread
From: markus at trippelsdorf dot de @ 2013-03-21  8:32 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56671

--- Comment #1 from Markus Trippelsdorf <markus at trippelsdorf dot de> 2013-03-21 08:31:57 UTC ---
Created attachment 29703
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29703
callgraph

Looks like a bug in constant expression handling.

perf shows:
 15.51%   cc1plus  cc1plus            [.] gt_ggc_mx_lang_tree_node(void*)
 11.14%   cc1plus  cc1plus            [.] walk_tree_1(tree_node**, tree_node*
(*)(tree_node**, int*, void*), void*, pointer_set_t*, tree_node*
(*)(tree_node**, int*, tree_no
  9.54%   cc1plus  cc1plus            [.] htab_expand.1557810
  7.28%   cc1plus  cc1plus            [.] ggc_set_mark(void const*)
  6.35%   cc1plus  cc1plus            [.] lookup_page_table_entry(void const*)
[clone .218759]
  6.32%   cc1plus  cc1plus            [.] build_int_cst(tree_node*, long)
  5.07%   cc1plus  [kernel.kallsyms]  [k] clear_page_c
  3.60%   cc1plus  cc1plus            [.]
initializer_constant_valid_p_1(tree_node*, tree_node*, tree_node**) [clone
.1222026]
  3.46%   cc1plus  cc1plus            [.] mostly_copy_tree_r(tree_node**, int*,
void*) [clone .459380]
  2.57%   cc1plus  cc1plus            [.] gt_ggc_mx(constructor_elt_d&)
  2.21%   cc1plus  cc1plus            [.] vec<constructor_elt_d, va_gc,
vl_embed>::copy() const [clone .local.823]
  1.97%   cc1plus  cc1plus            [.] int_cst_hash_hash(void const*) [clone
.1202876]
  1.94%   cc1plus  cc1plus            [.] cxx_eval_vec_init_1(constexpr_call
const*, tree_node*, tree_node*, bool, bool, bool, bool*, bool*) [clone
.109131.20812] 


cxx_eval_outermost_constant_expr -> cxx_eval_constant_expression ->
-> cxx_eval_vec_init_1 -> build_int_cst 
(see attached callgraph)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/56671] Gcc uses large amounts of memory and processor power with large C++11 bitsets
  2013-03-21  1:34 [Bug c++/56671] New: Gcc uses large amounts of memory and processor power with large C++11 bitsets m101010a at gmail dot com
  2013-03-21  8:32 ` [Bug c++/56671] " markus at trippelsdorf dot de
@ 2013-09-10 19:02 ` tudorb at fb dot com
  1 sibling, 0 replies; 3+ messages in thread
From: tudorb at fb dot com @ 2013-09-10 19:02 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56671

Tudor Bosman <tudorb at fb dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tudorb at fb dot com

--- Comment #2 from Tudor Bosman <tudorb at fb dot com> ---
We're encountering the same with huge (16M elements) std::array, I presume the
issue is the same.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-09-10 19:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-21  1:34 [Bug c++/56671] New: Gcc uses large amounts of memory and processor power with large C++11 bitsets m101010a at gmail dot com
2013-03-21  8:32 ` [Bug c++/56671] " markus at trippelsdorf dot de
2013-09-10 19:02 ` tudorb at fb dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).