GCC version as follows: (nothing but svn checkout release_6_1.. && ./configure --prefix=/usr && make && make install): adiog@box:~/dev/wangle/build-6.1$ c++ --version c++ (GCC) 6.1.0 Copyright (C) 2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. The problem should be easy to reproduce (compilation fails on first file in a project). I have compiled https://github.com/facebook/wangle, but with changed flag from -std=c++0x to -std=c++14. In first case compilation terminates after few seconds, in second one there is a gcc internal error (after few minutes with whole ram 4gb and whole swap consumed). htop does not show any cpu usage. adiog@box:~/dev/wangle/build-6.1$ time /usr/bin/c++ -I/home/adiog/dev/wangle/.. -I/usr/local/include -I/home/adiog/dev/wangle/gmock/src/gmock/include -I/home/adiog/dev/wangle/gmock/src/gmock/gtest/include -std=c++0x -fPIC -o CMakeFiles/wangle.dir/acceptor/Acceptor.cpp.o -c /home/adiog/dev/wangle/acceptor/Acceptor.cpp real 0m6.311s user 0m6.036s sys 0m0.256s adiog@box:~/dev/wangle/build-6.1$ time /usr/bin/c++ -I/home/adiog/dev/wangle/.. -I/usr/local/include -I/home/adiog/dev/wangle/gmock/src/gmock/include -I/home/adiog/dev/wangle/gmock/src/gmock/gtest/include -std=c++14 -fPIC -o CMakeFiles/wangle.dir/acceptor/Acceptor.cpp.o -c /home/adiog/dev/wangle/acceptor/Acceptor.cpp c++: internal compiler error: Killed (program cc1plus) Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. real 3m41.641s user 1m5.628s sys 0m5.684s
Compiled on Debian 8 with gcc-5.3.
Please attach the preprocessed file, see https://gcc.gnu.org/bugs/.
Created attachment 38429 [details] Preprocessed file Preprocessed file causing gcc-6.1 crash.
Created attachment 38430 [details] Preprocessed file compiled by gcc-6.1.
Confirmed. The compiler keeps allocating memory until it gets killed by the OOM killer. Overhead Command Shared Object Symbol 19.35% cc1plus cc1plus [.] push_to_top_level 5.78% cc1plus cc1plus [.] ht_lookup 3.43% cc1plus libc-2.23.so [.] _int_malloc 2.69% cc1plus cc1plus [.] tsubst_copy_and_build 2.55% cc1plus cc1plus [.] ggc_internal_alloc 2.23% cc1plus cc1plus [.] maybe_constant_init 2.16% cc1plus cc1plus [.] implicit_conversion 2.16% cc1plus cc1plus [.] cp_type_quals 2.05% cc1plus libc-2.23.so [.] __libc_calloc
#0 tree_code_size (code=code@entry=CONSTRUCTOR) at ../../gcc/gcc/tree.c:848 #1 0x0000000000fc562d in make_node_stat (code=code@entry=CONSTRUCTOR) at ../../gcc/gcc/tree.c:1005 #2 0x0000000000fc88e4 in build_constructor (type=0x7ffff71ddb28, vals=vals@entry=0x0) at ../../gcc/gcc/tree.c:1842 #3 0x000000000064d1e6 in reshape_init_array_1 (elt_type=0x7ffff701e000, max_index=0x7ffff70c5030, d=0x7fffffffb190, d@entry=0x7fffffffb188, complain=complain@entry=1) at ../../gcc/gcc/cp/decl.c:5514 #4 0x000000000064c500 in reshape_init_vector (complain=<optimized out>, d=<optimized out>, type=<optimized out>) at ../../gcc/gcc/cp/decl.c:5599 #5 reshape_init_r (type=type@entry=0x7ffff16dee70, d=d@entry=0x7fffffffb190, first_initializer_p=first_initializer_p@entry=true, complain=complain@entry=1) at ../../gcc/gcc/cp/decl.c:5905 #6 0x000000000064c0ab in reshape_init (type=0x7ffff16dee70, init=init@entry=0x7fff64da1ab0, complain=complain@entry=1) at ../../gcc/gcc/cp/decl.c:5945 #7 0x00000000007ce2a9 in finish_compound_literal (type=<optimized out>, type@entry=0x7ffff16dee70, compound_literal=0x7fff64da1ab0, complain=complain@entry=1) at ../../gcc/gcc/cp/semantics.c:2719 #8 0x00000000006a8bb9 in tsubst_copy_and_build (t=t@entry=0x7fff64da1a98, args=args@entry=0x0, complain=complain@entry=1, in_decl=in_decl@entry=0x0, function_p=function_p@entry=false, integral_constant_expression_p=integral_constant_expression_p@entry=true) at ../../gcc/gcc/cp/pt.c:16962 #9 0x00000000006aa654 in instantiate_non_dependent_expr_internal (complain=1, expr=0x7fff64da1a98) at ../../gcc/gcc/cp/pt.c:5640 #10 instantiate_non_dependent_or_null (expr=0x7fff64da1a98) at ../../gcc/gcc/cp/pt.c:5689 #11 0x00000000007a719c in constant_value_1 (decl=0x7fff64da7480, strict_p=true, return_aggregate_cst_ok_p=return_aggregate_cst_ok_p@entry=true) at ../../gcc/gcc/cp/init.c:2076 #12 0x00000000007a8fac in decl_constant_value (decl=<optimized out>) at ../../gcc/gcc/cp/init.c:2128 #13 0x0000000000861f29 in cxx_eval_constant_expression (ctx=ctx@entry=0x7fffffffb800, t=<optimized out>, t@entry=0x7ffff16b5f30, lval=lval@entry=false, non_constant_p=non_constant_p@entry=0x7fffffffd78e, overflow_p=overflow_p@entry=0x7fffffffd78f, jump_target=jump_target@entry=0x0) at ../../gcc/gcc/cp/constexpr.c:3509 #14 0x000000000086052c in cxx_eval_array_reference (overflow_p=0x7fffffffd78f, non_constant_p=0x7fffffffd78e, lval=false, t=0x7ffff24f9818, ctx=0x7fffffffb800) at ../../gcc/gcc/cp/constexpr.c:1961 #15 cxx_eval_constant_expression (ctx=ctx@entry=0x7fffffffb800, t=<optimized out>, lval=lval@entry=false, non_constant_p=non_constant_p@entry=0x7fffffffd78e, overflow_p=overflow_p@entry=0x7fffffffd78f, jump_target=jump_target@entry=0x0) at ../../gcc/gcc/cp/constexpr.c:3832 #16 0x00000000008610fa in cxx_eval_indirect_ref (overflow_p=0x7fffffffd78f, non_constant_p=0x7fffffffd78e, lval=false, t=0x7ffff16e0d40, ctx=0x7fffffffb800) at ../../gcc/gcc/cp/constexpr.c:2868 #17 cxx_eval_constant_expression (ctx=ctx@entry=0x7fffffffb800, t=<optimized out>, t@entry=0x7ffff16e0d40, lval=lval@entry=false, non_constant_p=non_constant_p@entry=0x7fffffffd78e, overflow_p=overflow_p@entry=0x7fffffffd78f, jump_target=jump_target@entry=0x0) at ../../gcc/gcc/cp/constexpr.c:3695 #18 0x000000000086968e in cxx_eval_binary_expression (ctx=ctx@entry=0x7fffffffb800, t=t@entry=0x7ffff24a4528, non_constant_p=non_constant_p@entry=0x7fffffffd78e, overflow_p=overflow_p@entry=0x7fffffffd78f) at ../../gcc/gcc/cp/constexpr.c:1725 #19 0x00000000008604cd in cxx_eval_constant_expression (ctx=ctx@entry=0x7fffffffb800, t=<optimized out>, t@entry=0x7ffff24a4528, lval=lval@entry=false, non_constant_p=non_constant_p@entry=0x7fffffffd78e, overflow_p=overflow_p@entry=0x7fffffffd78f, jump_target=jump_target@entry=0x0) at ../../gcc/gcc/cp/constexpr.c:3809 ...
markus@x4 tmp % cat Acceptor-c++14.ii namespace __gnu_cxx { namespace __ops { struct _Iter_less_iter { template <typename _Iterator1, typename _Iterator2> constexpr int operator()(_Iterator1, _Iterator2 __it2) { return *__it2; } }; constexpr _Iter_less_iter __iter_less_iter() { return _Iter_less_iter(); } } } namespace std { template <class> struct initializer_list { typedef int *const_iterator; int *_M_array; unsigned long size; constexpr const_iterator begin() { return _M_array; } constexpr const_iterator end() { return 0; } }; template <typename _FIter> constexpr _FIter max_element(_FIter, _FIter); template <typename _Tp> constexpr _Tp max(initializer_list<_Tp> __l) { max_element(__l.begin(), __l.end()); } template <typename _ForwardIterator, typename _Compare> constexpr _ForwardIterator __max_element(_ForwardIterator __first, _ForwardIterator, _Compare __comp) { __comp(0, __first); } template <typename _ForwardIterator> constexpr _ForwardIterator max_element(_ForwardIterator __first, _ForwardIterator __last) { __max_element(__first, __last, __gnu_cxx::__ops::__iter_less_iter()); } template <class> void estimateSpaceNeeded() { const int kMaxPositiveSpace = max({0}); } } markus@x4 tmp % g++ -c Acceptor-c++14.ii <<OOM killer kicks in>>
Started with r231863.
Note: this affects builds of Facebook's Folly in C++14 with gcc 6 too. See https://github.com/facebook/folly/issues/418
This is actually a dup of #70824 which was just fixed in trunk.
dup. *** This bug has been marked as a duplicate of bug 70824 ***