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

            Bug ID: 87089
           Summary: [9 regression] tree check: expected class 'type', have
                    'declaration' (namespace_decl) in type_with_linkage_p,
                    at ipa-utils.h
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dimhen at gmail dot com
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

r263651 PASS
r263798 FAIL

$ g++ -fpreprocessed -O2 -fno-semantic-interposition -flto -fPIC -DPIC -c -o
a.o a.ii
$ g++ -fpreprocessed -O2 -fno-semantic-interposition -flto -fPIC -DPIC -c -o
b.o b.ii
$ g++ -flto -fPIC -DPIC -shared a.o b.o 
b.ii:6:9: warning: type 'struct d' violates the C++ One Definition Rule [-Wodr]
6 |  struct d : a{} * b;
  |         ^
a.ii:2:8: note: a type with different bases is defined in another translation
unit
2 | struct d {
  |        ^
during IPA pass: pure-const
lto1: internal compiler error: tree check: expected class 'type', have
'declaration' (namespace_decl) in type_with_linkage_p, at ipa-utils.h:182
0x6eb2cb tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        /home/dimhen/src/gcc_current/gcc/tree.c:9420
0xb0e697 tree_class_check(tree_node const*, tree_code_class, char const*, int,
char const*)
        /home/dimhen/src/gcc_current/gcc/tree.h:3499
0xb0e697 type_with_linkage_p(tree_node const*)
        /home/dimhen/src/gcc_current/gcc/ipa-utils.h:182
0xb0e6fd type_in_anonymous_namespace_p(tree_node const*)
        /home/dimhen/src/gcc_current/gcc/ipa-utils.h:215
0xb0555a maybe_record_node
        /home/dimhen/src/gcc_current/gcc/ipa-devirt.c:2396
0xb0bd6c possible_polymorphic_call_targets(tree_node*, long,
ipa_polymorphic_call_context, bool*, void**, bool)
        /home/dimhen/src/gcc_current/gcc/ipa-devirt.c:3205
0xb423da possible_polymorphic_call_targets(cgraph_edge*, bool*, void**, bool)
        /home/dimhen/src/gcc_current/gcc/ipa-utils.h:116
0xb423da walk_polymorphic_call_targets
        /home/dimhen/src/gcc_current/gcc/ipa.c:171
0xb44b40 symbol_table::remove_unreachable_nodes(_IO_FILE*)
        /home/dimhen/src/gcc_current/gcc/ipa.c:418
0x879c32 read_cgraph_and_symbols
        /home/dimhen/src/gcc_current/gcc/lto/lto.c:3016
0x879c32 lto_main()
        /home/dimhen/src/gcc_current/gcc/lto/lto.c:3400
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
lto-wrapper: fatal error: /usr/local/gcc_current/bin/g++ returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status

$ cat a.ii
namespace A {
struct d {
  ~d();
};
d::~d() {}
}

$ cat b.ii
class a {
protected:
  virtual ~a();
};
namespace A {
        struct d : a{} * b;
        void c() { b->~d(); }
}

Reply via email to