Post by Richard Biener...
There is not enough information for anyone to help you without
reproducing the issue which is maybe too much to ask for ;)
Can you debug_tree () the offending decl in gdb?
Yes, here it is. I don't know anything about debugging in this area, so tools like debug_tree are good to learn about. How would I interpret its output?
pkoning:gcc pkoning$ lldb ./cc1plus -- new_opa.ii -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi -fdiagnostics-show-location=once -frandom-seed=new_opa.lo -g -O2 -std=gnu++1z
(lldb) target create "./cc1plus"
Current executable set to './cc1plus' (x86_64).
(lldb) settings set -- target.run-args "new_opa.ii" "-fno-implicit-templates" "-Wall" "-Wextra" "-Wwrite-strings" "-Wcast-qual" "-Wabi" "-fdiagnostics-show-location=once" "-frandom-seed=new_opa.lo" "-g" "-O2" "-std=gnu++1z"
(lldb) b internal_error
Breakpoint 1: where = cc1plus`internal_error(char const*, ...) + 104 at diagnostic.c:1441, address = 0x0000000100c21378
(lldb) run
Process 10880 launched: './cc1plus' (x86_64)
cc1plus: warning: -Wabi won't warn about anything [-Wabi]
cc1plus: note: -Wabi warns about differences from the most up-to-date ABI, which is also used by default
cc1plus: note: use e.g. -Wabi=11 to warn about changes from GCC 7
long int std::abs(long int) long long int std::abs(long long int) constexpr double std::abs(double) constexpr float std::abs(float) constexpr long double std::abs(long double) ldiv_t std::div(long int, long int) std::exception::exception() std::exception::exception() std::exception::exception() std::bad_exception::bad_exception() std::bad_exception::bad_exception() std::bad_exception::bad_exception() const char* std::type_info::name() const bool std::type_info::operator!=(const std::type_info&) const std::size_t std::type_info::hash_code() const std::type_info::type_info(const char*) std::type_info::type_info(const char*) std::type_info::type_info(const char*) std::bad_cast::bad_cast() std::bad_cast::bad_cast() std::bad_cast::bad_cast() std::bad_typeid::bad_typeid() std::bad_typeid::bad_typeid() std::bad_typeid::bad_typeid() std::__exception_ptr::exception_ptr::exception_ptr(std::nullptr_t) std::__exception_ptr::exception_ptr::exception_ptr(std::nullptr_t) std::__exception_ptr::exception_ptr::exception_ptr(std::nullptr_t) std::__exception_ptr::exception_ptr::exception_ptr(std::__exception_ptr::exception_ptr&&) std::__exception_ptr::exception_ptr::exception_ptr(std::__exception_ptr::exception_ptr&&) std::__exception_ptr::exception_ptr::exception_ptr(std::__exception_ptr::exception_ptr&&) std::__exception_ptr::exception_ptr& std::__exception_ptr::exception_ptr::operator=(std::__exception_ptr::exception_ptr&&) std::__exception_ptr::exception_ptr::operator bool() const void std::__exception_ptr::swap(std::__exception_ptr::exception_ptr&, std::__exception_ptr::exception_ptr&) void std::__exception_ptr::__dest_thunk(void*) std::__exception_ptr::exception_ptr std::make_exception_ptr(_Ex) constexpr _Tp* std::__addressof(_Tp&) constexpr std::integral_constant<_Tp, __v>::operator std::integral_constant<_Tp, __v>::value_type() const constexpr std::integral_constant<_Tp, __v>::value_type std::integral_constant<_Tp, __v>::operator()() const std::integral_constant<bool, false> constexpr const bool std::integral_constant<bool, false>::value constexpr const bool std::integral_constant<bool, false>::value std::integral_constant<bool, true> constexpr const bool std::integral_constant<bool, true>::value constexpr const bool std::integral_constant<bool, true>::value std::integral_constant<short unsigned int, 0> constexpr const short unsigned int std::integral_constant<short unsigned int, 0>::value constexpr const short unsigned int std::integral_constant<short unsigned int, 0>::value std::__make_unsigned_selector_base::_List<unsigned char, short unsigned int, unsigned int, long unsigned int, long long unsigned int> std::__make_unsigned_selector_base::_List<short unsigned int, unsigned int, long unsigned int, long long unsigned int> std::__make_unsigned_selector_base::_List<unsigned int, long unsigned int, long long unsigned int> std::__make_unsigned_selector_base::_List<long unsigned int, long long unsigned int> std::__make_unsigned_selector_base::_List<long long unsigned int> std::__make_unsigned_selector_base::_List<> constexpr const size_t std::__make_unsigned_selector_base::_List<long long unsigned int>::__size constexpr const size_t std::__make_unsigned_selector_base::_List<long long unsigned int>::__size constexpr const size_t std::__make_unsigned_selector_base::_List<long unsigned int, long long unsigned int>::__size constexpr const size_t std::__make_unsigned_selector_base::_List<long unsigned int, long long unsigned int>::__size constexpr const size_t std::__make_unsigned_selector_base::_List<unsigned int, long unsigned int, long long unsigned int>::__size constexpr const size_t std::__make_unsigned_selector_base::_List<unsigned int, long unsigned int, long long unsigned int>::__size constexpr const size_t std::__make_unsigned_selector_base::_List<short unsigned int, unsigned int, long unsigned int, long long unsigned int>::__size constexpr const size_t std::__make_unsigned_selector_base::_List<short unsigned int, unsigned int, long unsigned int, long long unsigned int>::__size constexpr const size_t std::__make_unsigned_selector_base::_List<unsigned char, short unsigned int, unsigned int, long unsigned int, long long unsigned int>::__size constexpr const size_t std::__make_unsigned_selector_base::_List<unsigned char, short unsigned int, unsigned int, long unsigned int, long long unsigned int>::__size constexpr const size_t std::__make_unsigned_selector_base::_List<unsigned char, short unsigned int, unsigned int, long unsigned int, long long unsigned int>::__size std::__make_unsigned_selector<wchar_t, false, true> std::__make_unsigned_selector_base::__select<2, std::__make_unsigned_selector_base::_List<unsigned char, short unsigned int, unsigned int, long unsigned int, long long unsigned int>, false> constexpr const size_t std::__make_unsigned_selector_base::_List<short unsigned int, unsigned int, long unsigned int, long long unsigned int>::__size std::__make_unsigned_selector_base::__select<2, std::__make_unsigned_selector_base::_List<short unsigned int, unsigned int, long unsigned int, long long unsigned int>, true> std::is_const<wchar_t> constexpr const bool std::integral_constant<bool, false>::value std::is_volatile<wchar_t> std::__match_cv_qualifiers<wchar_t, short unsigned int, false, false> std::__cv_selector<short unsigned int, false, false> std::__make_unsigned_selector<char16_t, false, true> std::is_const<char16_t> std::is_volatile<char16_t> std::__match_cv_qualifiers<char16_t, short unsigned int, false, false> std::__make_unsigned_selector<char32_t, false, true> std::__make_unsigned_selector_base::__select<4, std::__make_unsigned_selector_base::_List<unsigned char, short unsigned int, unsigned int, long unsigned int, long long unsigned int>, false> std::__make_unsigned_selector_base::__select<4, std::__make_unsigned_selector_base::_List<short unsigned int, unsigned int, long unsigned int, long long unsigned int>, false> constexpr const size_t std::__make_unsigned_selector_base::_List<unsigned int, long unsigned int, long long unsigned int>::__size std::__make_unsigned_selector_base::__select<4, std::__make_unsigned_selector_base::_List<unsigned int, long unsigned int, long long unsigned int>, false> constexpr const size_t std::__make_unsigned_selector_base::_List<long unsigned int, long long unsigned int>::__size std::__make_unsigned_selector_base::__select<4, std::__make_unsigned_selector_base::_List<long unsigned int, long long unsigned int>, true> std::is_const<char32_t> std::is_volatile<char32_t> std::__match_cv_qualifiers<char32_t, long unsigned int, false, false> std::__cv_selector<long unsigned int, false, false> std::__make_signed_selector<wchar_t, false, true> std::is_integral<wchar_t> std::remove_cv<wchar_t> std::remove_volatile<wchar_t> std::remove_const<wchar_t> constexpr const bool std::integral_constant<bool, true>::value std::is_enum<wchar_t> std::__make_unsigned_selector<wchar_t, true, false> std::is_integral<short unsigned int> std::remove_cv<short unsigned int> std::remove_volatile<short unsigned int> std::remove_const<short unsigned int> std::is_enum<short unsigned int> std::__make_signed_selector<short unsigned int, true, false> std::is_const<short unsigned int> std::is_volatile<short unsigned int> std::__match_cv_qualifiers<short unsigned int, short int, false, false> std::__cv_selector<short int, false, false> std::__make_signed_selector<char16_t, false, true> std::is_integral<char16_t> std::remove_cv<char16_t> std::remove_volatile<char16_t> std::remove_const<char16_t> std::is_enum<char16_t> std::__make_unsigned_selector<char16_t, true, false> std::__make_signed_selector<char32_t, false, true> std::is_integral<char32_t> std::remove_cv<char32_t> std::remove_volatile<char32_t> std::remove_const<char32_t> std::is_enum<char32_t> std::__make_unsigned_selector<char32_t, true, false> std::is_integral<long unsigned int> std::remove_cv<long unsigned int> std::remove_volatile<long unsigned int> std::remove_const<long unsigned int> std::is_enum<long unsigned int> std::__make_signed_selector<long unsigned int, true, false> std::is_const<long unsigned int> std::is_volatile<long unsigned int> std::__match_cv_qualifiers<long unsigned int, long int, false, false> std::__cv_selector<long int, false, false> decltype (__declval<_Tp>(0)) std::declval() constexpr bool std::__call_is_nt(std::__invoke_memfun_ref) constexpr bool std::__call_is_nt(std::__invoke_memfun_deref) constexpr bool std::__call_is_nt(std::__invoke_memobj_ref) constexpr bool std::__call_is_nt(std::__invoke_memobj_deref) constexpr bool std::__call_is_nt(std::__invoke_other) constexpr _Tp&& std::forward(typename std::remove_reference<_Tp>::type&) constexpr _Tp&& std::forward(typename std::remove_reference<_Tp>::type&&) constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&) constexpr typename std::conditional<std::__move_if_noexcept_cond<_Tp>::value, const _Tp&, _Tp&&>::type std::move_if_noexcept(_Tp&) constexpr _Tp* std::addressof(_Tp&) _Tp std::__exchange(_Tp&, _Up&&) typename std::enable_if<std::__and_<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> >::value>::type std::swap(_Tp&, _Tp&) typename std::enable_if<std::__is_swappable<_Tp>::value>::type std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm]) std::nested_exception::nested_exception() std::nested_exception::nested_exception() std::nested_exception::nested_exception() void std::nested_exception::rethrow_nested() const std::__exception_ptr::exception_ptr std::nested_exception::nested_ptr() const std::_Nested_exception<_Except>::_Nested_exception(const _Except&) std::_Nested_exception<_Except>::_Nested_exception(_Except&&) void std::__throw_with_nested_impl(_Tp&&, std::true_type) void std::__throw_with_nested_impl(_Tp&&, std::false_type) void std::throw_with_nested(_Tp&&) std::__rethrow_if_nested_cond<_Ex> std::__rethrow_if_nested_impl(const _Ex*) void std::__rethrow_if_nested_impl(const void*) void std::rethrow_if_nested(const _Ex&) std::bad_alloc::bad_alloc() std::bad_alloc::bad_alloc() std::bad_alloc::bad_alloc() std::bad_array_new_length::bad_array_new_length() std::bad_array_new_length::bad_array_new_length() std::bad_array_new_length::bad_array_new_length() void* operator new(std::size_t, void*) void* operator new [](std::size_t, void*) void operator delete(void*, void*) void operator delete [](void*, void*) constexpr _Tp* std::launder(_Tp*) void* operator new(std::size_t, std::align_val_t)cc1plus was compiled with optimization - stepping may behave oddly; variables may not be available.
Process 10880 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x0000000100c21378 cc1plus`internal_error(gmsgid="in %s, at %s:%d") at diagnostic.c:1441 [opt]
1438 internal_error (const char *gmsgid, ...)
1439 {
1440 va_list ap;
-> 1441 va_start (ap, gmsgid);
1442 rich_location richloc (line_table, input_location);
1443 diagnostic_impl (&richloc, -1, gmsgid, &ap, DK_ICE);
1444 va_end (ap);
Target 0: (cc1plus) stopped.
(lldb) frame sel 2
frame #2: 0x0000000100074b36 cc1plus`import_export_decl(decl=0x000000014269c750) at decl2.c:2877 [opt]
2874 gcc_assert (VAR_OR_FUNCTION_DECL_P (decl));
2875 /* Any code that creates entities with TREE_PUBLIC cleared should
2876 also set DECL_INTERFACE_KNOWN. */
-> 2877 gcc_assert (TREE_PUBLIC (decl));
2878 if (TREE_CODE (decl) == FUNCTION_DECL)
2879 gcc_assert (DECL_IMPLICIT_INSTANTIATION (decl)
2880 || DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (decl)
(lldb) call debug_tree(decl)
<var_decl 0x14269c750 value
type <boolean_type 0x1426aa5e8 bool readonly unsigned type_6 QI
size <integer_cst 0x142502768 constant 8>
unit-size <integer_cst 0x142502780 constant 1>
align:8 warn_if_not_align:0 symtab:150 alias-set -1 canonical-type 0x1426aa5e8 precision:1 min <integer_cst 0x1425029d8 0> max <integer_cst 0x142502a08 1>>
readonly constant used static tree_1 tree_2 tree_3 unsigned nonlocal in_system_header read decl_1 QI /Users/pkoning/Documents/svn/buildpdp/pdp11-aout/libstdc++-v3/include/type_traits:59:28 size <integer_cst 0x142502768 8> unit-size <integer_cst 0x142502780 1>
align:8 warn_if_not_align:0 context <record_type 0x1426a7e70 integral_constant> initial <integer_cst 0x1425029d8 0>
template-info 0x1426a64e0 chain <function_decl 0x1426a0600 __conv_op >>
(lldb)
Build/configure info:
pkoning:gcc pkoning$ ./xg++ --verbose
Using built-in specs.
COLLECT_GCC=./xg++
Target: pdp11-aout
Configured with: ../gcc/configure --target=pdp11-aout --prefix=/usr/local/pdp11-aout --without-x target_alias=pdp11-aout --with-mpc=/usr/local --with-mpfr=/usr/local --with-gmp=/usr/local --disable-libssp --disable-shared --with-newlib --enable-languages=c,c++,fortran --enable-checking=rtl
Thread model: single
gcc version 9.0.0 20180716 (experimental) (GCC)
The new_opa.ii file is attached.
paul