Discussion:
ICE building a libsupc++ file, pdp11 target
Paul Koning
2018-07-13 18:27:05 UTC
Permalink
I'm trying to see if I can build the pdp11 target for languages other than just C, and the answer is for the most part yes. But I' running into an ICE I can't figure out. It's way before the back end comes into the picture as far as I can see, and there's nothing particularly strange looking in the input file that suggests anything.

Any suggestions on where to look? The failure is:

libtool: compile: /Users/pkoning/Documents/svn/buildpdp+/./gcc/xgcc -shared-libgcc -B/Users/pkoning/Documents/svn/buildpdp+/./gcc -nostdinc++ -L/Users/pkoning/Documents/svn/buildpdp+/pdp11-aout/libstdc++-v3/src -L/Users/pkoning/Documents/svn/buildpdp+/pdp11-aout/libstdc++-v3/src/.libs -L/Users/pkoning/Documents/svn/buildpdp+/pdp11-aout/libstdc++-v3/libsupc++/.libs -B/usr/local/pdp11-aout/pdp11-aout/bin/ -B/usr/local/pdp11-aout/pdp11-aout/lib/ -isystem /usr/local/pdp11-aout/pdp11-aout/include -isystem /usr/local/pdp11-aout/pdp11-aout/sys-include -I/Users/pkoning/Documents/svn/gcc/libstdc++-v3/../libgcc -I/Users/pkoning/Documents/svn/buildpdp+/pdp11-aout/libstdc++-v3/include/pdp11-aout -I/Users/pkoning/Documents/svn/buildpdp+/pdp11-aout/libstdc++-v3/include -I/Users/pkoning/Documents/svn/gcc/libstdc++-v3/libsupc++ -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi -fdiagnostics-show-location=once -frandom-seed=new_opa.lo -g -O2 -std=gnu++1z -c ../../../../gcc/libstdc++-v3/libsupc++/new_opa.cc -o new_opa.o
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
../../../../gcc/libstdc++-v3/libsupc++/new_opa.cc:112:1: internal compiler error: in import_export_decl, at cp/decl2.c:2877
}
^
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
make[3]: *** [new_opa.lo] Error 1

paul
U.Mutlu
2018-07-13 18:52:44 UTC
Permalink
Post by Paul Koning
I'm trying to see if I can build the pdp11 target for languages other than just C, and the answer is for the most part yes. But I' running into an ICE I can't figure out. It's way before the back end comes into the picture as far as I can see, and there's nothing particularly strange looking in the input file that suggests anything.
libtool: compile: /Users/pkoning/Documents/svn/buildpdp+/./gcc/xgcc -shared-libgcc -B/Users/pkoning/Documents/svn/buildpdp+/./gcc -nostdinc++ -L/Users/pkoning/Documents/svn/buildpdp+/pdp11-aout/libstdc++-v3/src -L/Users/pkoning/Documents/svn/buildpdp+/pdp11-aout/libstdc++-v3/src/.libs -L/Users/pkoning/Documents/svn/buildpdp+/pdp11-aout/libstdc++-v3/libsupc++/.libs -B/usr/local/pdp11-aout/pdp11-aout/bin/ -B/usr/local/pdp11-aout/pdp11-aout/lib/ -isystem /usr/local/pdp11-aout/pdp11-aout/include -isystem /usr/local/pdp11-aout/pdp11-aout/sys-include -I/Users/pkoning/Documents/svn/gcc/libstdc++-v3/../libgcc -I/Users/pkoning/Documents/svn/buildpdp+/pdp11-aout/libstdc++-v3/include/pdp11-aout -I/Users/pkoning/Documents/svn/buildpdp+/pdp11-aout/libstdc++-v3/include -I/Users/pkoning/Documents/svn/gcc/libstdc++-v3/libsupc++ -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi -fdiagnostics-show-location=once -frandom-seed=new_opa.lo -g -O2 -std=gnu++1z -c ../../../../gcc/lib
stdc++-v3/libsupc++/new_opa.cc -o new_opa.o
Post by Paul Koning
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
../../../../gcc/libstdc++-v3/libsupc++/new_opa.cc:112:1: internal compiler error: in import_export_decl, at cp/decl2.c:2877
}
^
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
make[3]: *** [new_opa.lo] Error 1
It's failing at the last gcc_assert() below (file
../gcc_src/gcc/cp/decl2.c:2877 ):


/* DECL is a FUNCTION_DECL or VAR_DECL. If the object file linkage
for DECL has not already been determined, do so now by setting
DECL_EXTERNAL, DECL_COMDAT and other related flags. Until this
function is called entities with vague linkage whose definitions
are available must have TREE_PUBLIC set.

If this function decides to place DECL in COMDAT, it will set
appropriate flags -- but will not clear DECL_EXTERNAL. It is up to
the caller to decide whether or not to clear DECL_EXTERNAL. Some
callers defer that decision until it is clear that DECL is actually
required. */

void
import_export_decl (tree decl)
{
int emit_p;
bool comdat_p;
bool import_p;
tree class_type = NULL_TREE;

if (DECL_INTERFACE_KNOWN (decl))
return;

/* We cannot determine what linkage to give to an entity with vague
linkage until the end of the file. For example, a virtual table
for a class will be defined if and only if the key method is
defined in this translation unit. As a further example, consider
that when compiling a translation unit that uses PCH file with
"-frepo" it would be incorrect to make decisions about what
entities to emit when building the PCH; those decisions must be
delayed until the repository information has been processed. */
gcc_assert (at_eof);
/* Object file linkage for explicit instantiations is handled in
mark_decl_instantiated. For static variables in functions with
vague linkage, maybe_commonize_var is used.

Therefore, the only declarations that should be provided to this
function are those with external linkage that are:

* implicit instantiations of function templates

* inline function

* implicit instantiations of static data members of class
templates

* virtual tables

* typeinfo objects

Furthermore, all entities that reach this point must have a
definition available in this translation unit.

The following assertions check these conditions. */
gcc_assert (VAR_OR_FUNCTION_DECL_P (decl));
/* Any code that creates entities with TREE_PUBLIC cleared should
also set DECL_INTERFACE_KNOWN. */
gcc_assert (TREE_PUBLIC (decl));
Paul Koning
2018-07-13 18:56:39 UTC
Permalink
Post by Paul Koning
Post by Paul Koning
I'm trying to see if I can build the pdp11 target for languages other than just C, and the answer is for the most part yes. But I' running into an ICE I can't figure out. It's way before the back end comes into the picture as far as I can see, and there's nothing particularly strange looking in the input file that suggests anything.
libtool: compile: /Users/pkoning/Documents/svn/buildpdp+/./gcc/xgcc -shared-libgcc -B/Users/pkoning/Documents/svn/buildpdp+/./gcc -nostdinc++ -L/Users/pkoning/Documents/svn/buildpdp+/pdp11-aout/libstdc++-v3/src -L/Users/pkoning/Documents/svn/buildpdp+/pdp11-aout/libstdc++-v3/src/.libs -L/Users/pkoning/Documents/svn/buildpdp+/pdp11-aout/libstdc++-v3/libsupc++/.libs -B/usr/local/pdp11-aout/pdp11-aout/bin/ -B/usr/local/pdp11-aout/pdp11-aout/lib/ -isystem /usr/local/pdp11-aout/pdp11-aout/include -isystem /usr/local/pdp11-aout/pdp11-aout/sys-include -I/Users/pkoning/Documents/svn/gcc/libstdc++-v3/../libgcc -I/Users/pkoning/Documents/svn/buildpdp+/pdp11-aout/libstdc++-v3/include/pdp11-aout -I/Users/pkoning/Documents/svn/buildpdp+/pdp11-aout/libstdc++-v3/include -I/Users/pkoning/Documents/svn/gcc/libstdc++-v3/libsupc++ -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi -fdiagnostics-show-location=once -frandom-seed=new_opa.lo -g -O2 -std=gnu++1z -c ../../../../gcc/lib
stdc++-v3/libsupc++/new_opa.cc -o new_opa.o
Post by Paul Koning
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
../../../../gcc/libstdc++-v3/libsupc++/new_opa.cc:112:1: internal compiler error: in import_export_decl, at cp/decl2.c:2877
}
^
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
make[3]: *** [new_opa.lo] Error 1
Sorry, I should have been more explicit. I saw that, but my question is: what is the underlying problem that triggers the assert? The comment is not much help to me. And more specifically: what could a target be doing wrong that would make an early stage of the compiler fail like this on what seems like a pretty straightforward source file?

Many of the other libstdc++ bits compile just fine, as do plenty of testsuite cases and some test files of my own.

paul
U.Mutlu
2018-07-13 19:12:13 UTC
Permalink
Post by Paul Koning
Post by Paul Koning
Post by Paul Koning
I'm trying to see if I can build the pdp11 target for languages other than just C, and the answer is for the most part yes. But I' running into an ICE I can't figure out. It's way before the back end comes into the picture as far as I can see, and there's nothing particularly strange looking in the input file that suggests anything.
libtool: compile: /Users/pkoning/Documents/svn/buildpdp+/./gcc/xgcc -shared-libgcc -B/Users/pkoning/Documents/svn/buildpdp+/./gcc -nostdinc++ -L/Users/pkoning/Documents/svn/buildpdp+/pdp11-aout/libstdc++-v3/src -L/Users/pkoning/Documents/svn/buildpdp+/pdp11-aout/libstdc++-v3/src/.libs -L/Users/pkoning/Documents/svn/buildpdp+/pdp11-aout/libstdc++-v3/libsupc++/.libs -B/usr/local/pdp11-aout/pdp11-aout/bin/ -B/usr/local/pdp11-aout/pdp11-aout/lib/ -isystem /usr/local/pdp11-aout/pdp11-aout/include -isystem /usr/local/pdp11-aout/pdp11-aout/sys-include -I/Users/pkoning/Documents/svn/gcc/libstdc++-v3/../libgcc -I/Users/pkoning/Documents/svn/buildpdp+/pdp11-aout/libstdc++-v3/include/pdp11-aout -I/Users/pkoning/Documents/svn/buildpdp+/pdp11-aout/libstdc++-v3/include -I/Users/pkoning/Documents/svn/gcc/libstdc++-v3/libsupc++ -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi -fdiagnostics-show-location=once -frandom-seed=new_opa.lo -g -O2 -std=gnu++1z -c ../../../../gcc/l
ib
Post by Paul Koning
Post by Paul Koning
stdc++-v3/libsupc++/new_opa.cc -o new_opa.o
Post by Paul Koning
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
../../../../gcc/libstdc++-v3/libsupc++/new_opa.cc:112:1: internal compiler error: in import_export_decl, at cp/decl2.c:2877
}
^
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
make[3]: *** [new_opa.lo] Error 1
Sorry, I should have been more explicit. I saw that, but my question is: what is the underlying problem that triggers the assert? The comment is not much help to me. And more specifically: what could a target be doing wrong that would make an early stage of the compiler fail like this on what seems like a pretty straightforward source file?
Many of the other libstdc++ bits compile just fine, as do plenty of testsuite cases and some test files of my own.
/* In a VAR_DECL, FUNCTION_DECL, NAMESPACE_DECL or TYPE_DECL,
nonzero means name is to be accessible from outside this translation unit.
In an IDENTIFIER_NODE, nonzero means an external declaration
accessible from outside this translation unit was previously seen
for this name in an inner scope. */
#define TREE_PUBLIC(NODE) ((NODE)->base.public_flag)


Ie. it has todo with the value of the member var public_flag of the tree decl.
Paul Koning
2018-07-16 21:30:31 UTC
Permalink
Post by U.Mutlu
Post by Paul Koning
Post by Paul Koning
Post by Paul Koning
I'm trying to see if I can build the pdp11 target for languages other than just C, and the answer is for the most part yes. But I' running into an ICE I can't figure out. It's way before the back end comes into the picture as far as I can see, and there's nothing particularly strange looking in the input file that suggests anything.
libtool: compile: /Users/pkoning/Documents/svn/buildpdp+/./gcc/xgcc -shared-libgcc -B/Users/pkoning/Documents/svn/buildpdp+/./gcc -nostdinc++ -L/Users/pkoning/Documents/svn/buildpdp+/pdp11-aout/libstdc++-v3/src -L/Users/pkoning/Documents/svn/buildpdp+/pdp11-aout/libstdc++-v3/src/.libs -L/Users/pkoning/Documents/svn/buildpdp+/pdp11-aout/libstdc++-v3/libsupc++/.libs -B/usr/local/pdp11-aout/pdp11-aout/bin/ -B/usr/local/pdp11-aout/pdp11-aout/lib/ -isystem /usr/local/pdp11-aout/pdp11-aout/include -isystem /usr/local/pdp11-aout/pdp11-aout/sys-include -I/Users/pkoning/Documents/svn/gcc/libstdc++-v3/../libgcc -I/Users/pkoning/Documents/svn/buildpdp+/pdp11-aout/libstdc++-v3/include/pdp11-aout -I/Users/pkoning/Documents/svn/buildpdp+/pdp11-aout/libstdc++-v3/include -I/Users/pkoning/Documents/svn/gcc/libstdc++-v3/libsupc++ -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi -fdiagnostics-show-location=once -frandom-seed=new_opa.lo -g -O2 -std=gnu++1z -c ../../../../gcc/l
ib
Post by Paul Koning
Post by Paul Koning
stdc++-v3/libsupc++/new_opa.cc -o new_opa.o
Post by Paul Koning
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
../../../../gcc/libstdc++-v3/libsupc++/new_opa.cc:112:1: internal compiler error: in import_export_decl, at cp/decl2.c:2877
}
^
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
make[3]: *** [new_opa.lo] Error 1
Sorry, I should have been more explicit. I saw that, but my question is: what is the underlying problem that triggers the assert? The comment is not much help to me. And more specifically: what could a target be doing wrong that would make an early stage of the compiler fail like this on what seems like a pretty straightforward source file?
Many of the other libstdc++ bits compile just fine, as do plenty of testsuite cases and some test files of my own.
/* In a VAR_DECL, FUNCTION_DECL, NAMESPACE_DECL or TYPE_DECL,
nonzero means name is to be accessible from outside this translation unit.
In an IDENTIFIER_NODE, nonzero means an external declaration
accessible from outside this translation unit was previously seen
for this name in an inner scope. */
#define TREE_PUBLIC(NODE) ((NODE)->base.public_flag)
Ie. it has todo with the value of the member var public_flag of the tree decl.
I'm still on the same question as before. Why do I get an ICE in the tree phase of the compiler, complaining about flags of a declaration, based on something I apparently have wrong in my target description? I can build C++ for other targets, so this isn't a general bug. But I'm not used to target (back end) stuff affecting the compiler before I even get to the RTL part. And in this case, looking at the failing code gives me no clue at all. I can't do anything with the "tree" object to find out what it describes; it's a VAR_DECL but I don't know what to look at. I tried turning on tree dump files, those gave no clue either. And there is nothing in the manuals.

paul
Richard Biener
2018-07-17 09:46:26 UTC
Permalink
Post by Paul Koning
Post by U.Mutlu
Post by Paul Koning
Post by Paul Koning
Post by Paul Koning
I'm trying to see if I can build the pdp11 target for languages other than just C, and the answer is for the most part yes. But I' running into an ICE I can't figure out. It's way before the back end comes into the picture as far as I can see, and there's nothing particularly strange looking in the input file that suggests anything.
libtool: compile: /Users/pkoning/Documents/svn/buildpdp+/./gcc/xgcc -shared-libgcc -B/Users/pkoning/Documents/svn/buildpdp+/./gcc -nostdinc++ -L/Users/pkoning/Documents/svn/buildpdp+/pdp11-aout/libstdc++-v3/src -L/Users/pkoning/Documents/svn/buildpdp+/pdp11-aout/libstdc++-v3/src/.libs -L/Users/pkoning/Documents/svn/buildpdp+/pdp11-aout/libstdc++-v3/libsupc++/.libs -B/usr/local/pdp11-aout/pdp11-aout/bin/ -B/usr/local/pdp11-aout/pdp11-aout/lib/ -isystem /usr/local/pdp11-aout/pdp11-aout/include -isystem /usr/local/pdp11-aout/pdp11-aout/sys-include -I/Users/pkoning/Documents/svn/gcc/libstdc++-v3/../libgcc -I/Users/pkoning/Documents/svn/buildpdp+/pdp11-aout/libstdc++-v3/include/pdp11-aout -I/Users/pkoning/Documents/svn/buildpdp+/pdp11-aout/libstdc++-v3/include -I/Users/pkoning/Documents/svn/gcc/libstdc++-v3/libsupc++ -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi -fdiagnostics-show-location=once -frandom-seed=new_opa.lo -g -O2 -std=gnu++1z -c ../../../../gcc/l
ib
Post by Paul Koning
Post by Paul Koning
stdc++-v3/libsupc++/new_opa.cc -o new_opa.o
Post by Paul Koning
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
../../../../gcc/libstdc++-v3/libsupc++/new_opa.cc:112:1: internal compiler error: in import_export_decl, at cp/decl2.c:2877
}
^
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
make[3]: *** [new_opa.lo] Error 1
Sorry, I should have been more explicit. I saw that, but my question is: what is the underlying problem that triggers the assert? The comment is not much help to me. And more specifically: what could a target be doing wrong that would make an early stage of the compiler fail like this on what seems like a pretty straightforward source file?
Many of the other libstdc++ bits compile just fine, as do plenty of testsuite cases and some test files of my own.
/* In a VAR_DECL, FUNCTION_DECL, NAMESPACE_DECL or TYPE_DECL,
nonzero means name is to be accessible from outside this translation unit.
In an IDENTIFIER_NODE, nonzero means an external declaration
accessible from outside this translation unit was previously seen
for this name in an inner scope. */
#define TREE_PUBLIC(NODE) ((NODE)->base.public_flag)
Ie. it has todo with the value of the member var public_flag of the tree decl.
I'm still on the same question as before. Why do I get an ICE in the tree phase of the compiler, complaining about flags of a declaration, based on something I apparently have wrong in my target description? I can build C++ for other targets, so this isn't a general bug. But I'm not used to target (back end) stuff affecting the compiler before I even get to the RTL part. And in this case, looking at the failing code gives me no clue at all. I can't do anything with the "tree" object to find out what it describes; it's a VAR_DECL but I don't know what to look at. I tried turning on tree dump files, those gave no clue either. And there is nothing in the manuals.
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?
Post by Paul Koning
paul
Paul Koning
2018-07-17 13:08:25 UTC
Permalink
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
Richard Biener
2018-07-17 13:36:38 UTC
Permalink
Post by Paul Koning
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)
lldb? eh ... ;)

anyhow, this is

namespace std
{

# 56 "/Users/pkoning/Documents/svn/buildpdp/pdp11-aout/libstdc++-v3/include/type_traits"
3
template<typename _Tp, _Tp __v>
struct integral_constant
{
static constexpr _Tp value = __v;
^^^

which should have TREE_PUBLIC set. My next step would be to watch how
this flag changes (if it does...)

break at ggc-page.c:1442 (the return stmt of ggc_internal_alloc)
conditional on result == 0x14269c750
and then watch *&the-decl->base.public_flag printing said flag when
the watchpoint hits
(because you're watching the whole integer containing the bitfield bit).

If that doesn't go anywhere try reducing the source file using creduce
or by other means.

Maybe look at reset_decl_linkage () and visibility support in general.

Richard.
Post by Paul Koning
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
Richard Biener
2018-07-17 13:38:30 UTC
Permalink
On Tue, Jul 17, 2018 at 3:36 PM Richard Biener
Post by Richard Biener
Post by Paul Koning
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)
lldb? eh ... ;)
anyhow, this is
namespace std
{
# 56 "/Users/pkoning/Documents/svn/buildpdp/pdp11-aout/libstdc++-v3/include/type_traits"
3
template<typename _Tp, _Tp __v>
struct integral_constant
{
static constexpr _Tp value = __v;
^^^
which should have TREE_PUBLIC set. My next step would be to watch how
this flag changes (if it does...)
break at ggc-page.c:1442 (the return stmt of ggc_internal_alloc)
conditional on result == 0x14269c750
and then watch *&the-decl->base.public_flag printing said flag when
the watchpoint hits
(because you're watching the whole integer containing the bitfield bit).
If that doesn't go anywhere try reducing the source file using creduce
or by other means.
Maybe look at reset_decl_linkage () and visibility support in general.
Oh, and generally a grep for 'targetm' in cp/ might reveal bits that sound
interesting.

Richard.
Post by Richard Biener
Richard.
Post by Paul Koning
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
Paul Koning
2018-07-17 16:27:27 UTC
Permalink
Post by Richard Biener
Post by Richard Biener
...
lldb? eh ... ;)
Yes, gdb is hard to make work on Mac OS.
Post by Richard Biener
Post by Richard Biener
anyhow, this is
namespace std
{
# 56 "/Users/pkoning/Documents/svn/buildpdp/pdp11-aout/libstdc++-v3/include/type_traits"
3
template<typename _Tp, _Tp __v>
struct integral_constant
{
static constexpr _Tp value = __v;
^^^
which should have TREE_PUBLIC set. My next step would be to watch how
this flag changes (if it does...)
break at ggc-page.c:1442 (the return stmt of ggc_internal_alloc)
conditional on result == 0x14269c750
and then watch *&the-decl->base.public_flag printing said flag when
the watchpoint hits
(because you're watching the whole integer containing the bitfield bit).
If that doesn't go anywhere try reducing the source file using creduce
or by other means.
Maybe look at reset_decl_linkage () and visibility support in general.
Oh, and generally a grep for 'targetm' in cp/ might reveal bits that sound
interesting.
That reveals some things but nothing jumps out at me. However... pdp11 is an a.out target, not an ELF target. Would that explain the problem? If yes, is there a workaround (short of implementing ELF)?

paul
Joseph Myers
2018-07-23 14:21:17 UTC
Permalink
Post by Paul Koning
That reveals some things but nothing jumps out at me. However... pdp11
is an a.out target, not an ELF target. Would that explain the problem?
If yes, is there a workaround (short of implementing ELF)?
As there are hardly any targets left without named section support, using
ELF might be a good idea so you don't have to deal with the
no-named-sections issues.

The ELF e_machine value EM_PDP11 was assigned to Lars Brinkoff,
***@nocrew.org, 30 May 2002, according to the comments in
ch4.eheader.html. I don't know if an actual ELF ABI has been defined.
--
Joseph S. Myers
***@codesourcery.com
Paul Koning
2018-07-23 14:30:58 UTC
Permalink
Post by Joseph Myers
Post by Paul Koning
That reveals some things but nothing jumps out at me. However... pdp11
is an a.out target, not an ELF target. Would that explain the problem?
If yes, is there a workaround (short of implementing ELF)?
As there are hardly any targets left without named section support, using
ELF might be a good idea so you don't have to deal with the
no-named-sections issues.
The ELF e_machine value EM_PDP11 was assigned to Lars Brinkoff,
ch4.eheader.html. I don't know if an actual ELF ABI has been defined.
I don't know of pdp11 ELF code in binutils.

The named-section stuff itself doesn't seem to be directly related. If I run the test with the target flag -mdec-asm, it still fails. That mode does support named sections.

I can easily see the issue with the debugger and compare with a target that works (vax). So I should be able to find this, at least once I figure out how to turn off address space randomization on my host.

paul
Paul Koning
2018-10-09 21:39:31 UTC
Permalink
Post by Richard Biener
Post by Paul Koning
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).
...
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)
lldb? eh ... ;)
anyhow, this is
namespace std
{
# 56 "/Users/pkoning/Documents/svn/buildpdp/pdp11-aout/libstdc++-v3/include/type_traits"
3
template<typename _Tp, _Tp __v>
struct integral_constant
{
static constexpr _Tp value = __v;
^^^
which should have TREE_PUBLIC set. My next step would be to watch how
this flag changes (if it does...)
break at ggc-page.c:1442 (the return stmt of ggc_internal_alloc)
conditional on result == 0x14269c750
and then watch *&the-decl->base.public_flag printing said flag when
the watchpoint hits
(because you're watching the whole integer containing the bitfield bit).
If that doesn't go anywhere try reducing the source file using creduce
or by other means.
Maybe look at reset_decl_linkage () and visibility support in general.
I trimmed the file a bit.

Managed to find where public_flag is cleared. It is in cp/expr.c maybe_commonize_var, line 5619, here:

else
{
/* While for initialized variables, we must use internal
linkage -- which means that multiple copies will not
be merged. */
TREE_PUBLIC (decl) = 0;
DECL_COMMON (decl) = 0;

Could it be related to the fact that I have an a.out (rather than ELF) target?

paul
Richard Biener
2018-10-10 09:52:35 UTC
Permalink
Post by Paul Koning
Post by Richard Biener
Post by Paul Koning
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).
...
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)
lldb? eh ... ;)
anyhow, this is
namespace std
{
# 56 "/Users/pkoning/Documents/svn/buildpdp/pdp11-aout/libstdc++-v3/include/type_traits"
3
template<typename _Tp, _Tp __v>
struct integral_constant
{
static constexpr _Tp value = __v;
^^^
which should have TREE_PUBLIC set. My next step would be to watch how
this flag changes (if it does...)
break at ggc-page.c:1442 (the return stmt of ggc_internal_alloc)
conditional on result == 0x14269c750
and then watch *&the-decl->base.public_flag printing said flag when
the watchpoint hits
(because you're watching the whole integer containing the bitfield bit).
If that doesn't go anywhere try reducing the source file using creduce
or by other means.
Maybe look at reset_decl_linkage () and visibility support in general.
I trimmed the file a bit.
else
{
/* While for initialized variables, we must use internal
linkage -- which means that multiple copies will not
be merged. */
TREE_PUBLIC (decl) = 0;
DECL_COMMON (decl) = 0;
Could it be related to the fact that I have an a.out (rather than ELF) target?
I guess a.out is bitrotten (or too incapable) for C++ here. I see the
code above emits warnings about this
being unhandled as well, it possibly should simply sorry() when it can
figure out it
will run into the import_export_decl ICE later...

Richard.
Post by Paul Koning
paul
Loading...