[Bug middle-end/63244] [4.9 regression] internal compiler error: Segmentation fault (program cc1plus)

trippels at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Sep 12 18:40:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63244

--- Comment #7 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
When one uses a naive test script one arrives at the testcase
from comment 4. Using a differential script (-O2 vs. -flto -O2 -g)
one gets:

markus@x4 /tmp % cat context2.ii
namespace std {
template <typename _Tp>
_Tp declval();
}
class A {};
namespace std {
template <typename>
using __allocator_base = A;
template <typename>
class H : __allocator_base<int> {};
template <typename _Tp, typename = std::H<_Tp>>
class I {};
}

template <typename>
class D;
struct F;
namespace detail {
template <typename, typename...>
class iterator_adaptor;
template <typename, typename, typename>
class basic_range {
 public:
  template <typename>
  using store_traits = int;
  template <typename V>
  operator V() const {}
};
template <typename T>
using preferred_iterator_type = decltype(std::declval<T>);
}

template <typename... Os>
class adaptor_range
    : public detail::basic_range<
          adaptor_range<Os...>,
          detail::iterator_adaptor<F, detail::preferred_iterator_type<Os>...>,
          detail::iterator_adaptor<
              F, detail::preferred_iterator_type<const Os>...>> {};
class J : public adaptor_range<std::I<int *>> {};
template <typename>
using property_list = int;
class G {
  G(const property_list<int> &props, const J &);
  std::I<D<int>> devs;
};
G::G(const property_list<int> &props, const J &devs) : devs(devs) {}

markus@x4 /tmp % g++ -std=c++11 -flto -O2 -g -c context2.ii
g++: internal compiler error: Segmentation fault (program cc1plus)
0x40c96c execute
        ../../gcc/gcc/gcc.c:2855
0x40cd34 do_spec_1
        ../../gcc/gcc/gcc.c:4659
0x40f5f6 process_brace_body
        ../../gcc/gcc/gcc.c:5942
0x40f5f6 handle_braces
        ../../gcc/gcc/gcc.c:5856
0x40dba9 do_spec_1
        ../../gcc/gcc/gcc.c:5313
0x40f5f6 process_brace_body
        ../../gcc/gcc/gcc.c:5942
0x40f5f6 handle_braces
        ../../gcc/gcc/gcc.c:5856
0x40dba9 do_spec_1
        ../../gcc/gcc/gcc.c:5313
0x40d913 do_spec_1
        ../../gcc/gcc/gcc.c:5428
0x40f5f6 process_brace_body
        ../../gcc/gcc/gcc.c:5942
0x40f5f6 handle_braces
        ../../gcc/gcc/gcc.c:5856
0x40dba9 do_spec_1
        ../../gcc/gcc/gcc.c:5313
0x40f5f6 process_brace_body
        ../../gcc/gcc/gcc.c:5942
0x40f5f6 handle_braces
        ../../gcc/gcc/gcc.c:5856
0x40dba9 do_spec_1
        ../../gcc/gcc/gcc.c:5313
0x40f5f6 process_brace_body
        ../../gcc/gcc/gcc.c:5942
0x40f5f6 handle_braces
        ../../gcc/gcc/gcc.c:5856
0x40dba9 do_spec_1
        ../../gcc/gcc/gcc.c:5313
0x40f5f6 process_brace_body
        ../../gcc/gcc/gcc.c:5942
0x40f5f6 handle_braces
        ../../gcc/gcc/gcc.c:5856
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

Looks like a stack overflow.

(-g and -flto alone are fine)
markus@x4 /tmp % g++ -std=c++11 -O2 -g -c context2.ii
markus@x4 /tmp % g++ -std=c++11 -flto -O2 -c context2.ii
markus@x4 /tmp %



More information about the Gcc-bugs mailing list