[Bug lto/87089] [9 regression] tree check: expected class 'type', have 'declaration' (namespace_decl) in type_with_linkage_p, at ipa-utils.h

2019-12-19 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87089

--- Comment #14 from Jonathan Wakely  ---
Commits r268728 and r269799 fixed this but had the wrong PR in the changelog.

[Bug lto/87089] [9 regression] tree check: expected class 'type', have 'declaration' (namespace_decl) in type_with_linkage_p, at ipa-utils.h

2019-03-19 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87089

Jan Hubicka  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #13 from Jan Hubicka  ---
Fixed.

[Bug lto/87089] [9 regression] tree check: expected class 'type', have 'declaration' (namespace_decl) in type_with_linkage_p, at ipa-utils.h

2019-02-27 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87089

Jason Merrill  changed:

   What|Removed |Added

 Status|ASSIGNED|NEW
   Assignee|jason at gcc dot gnu.org   |unassigned at gcc dot 
gnu.org

--- Comment #12 from Jason Merrill  ---
(In reply to Jan Hubicka from comment #9)
> This is caused by:
> 
> _ZN4itpp1cILNS_1aE0EED2Ev/1 (itpp::c< >::~c() [with itpp::a
>   Referring: _ZN4itpp1cILNS_1aE0EED1Ev/2 (alias)
> 
> this is a destructor which is pointed to from virutal table, but it has no
> DECL_VIRTUAL_P flag set. This makes free_lang_data to modify its context and
> point to outer namespace rather than the containing polymorphic type.
> 
> Why we do not set VIRTUAL_P here?

This is the base (D2) variant of the destructor, which is not virtual and does
not appear in the vtable; the complete (D1) variant of the destructor is
virtual and does appear in the vtable, and in this case is an alias for the
base variant.  I imagine that LTO is treating them as interchangeable, which
causes trouble here.

Unassigning myself.

[Bug lto/87089] [9 regression] tree check: expected class 'type', have 'declaration' (namespace_decl) in type_with_linkage_p, at ipa-utils.h

2019-02-27 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87089

Jason Merrill  changed:

   What|Removed |Added

 Status|REOPENED|ASSIGNED
 CC||jason at gcc dot gnu.org
   Assignee|hubicka at gcc dot gnu.org |jason at gcc dot gnu.org

[Bug lto/87089] [9 regression] tree check: expected class 'type', have 'declaration' (namespace_decl) in type_with_linkage_p, at ipa-utils.h

2019-02-26 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87089

--- Comment #11 from Martin Liška  ---
Is Jason working on that? Can you please link a gcc-patches mailing list
discussion (if there's any).

[Bug lto/87089] [9 regression] tree check: expected class 'type', have 'declaration' (namespace_decl) in type_with_linkage_p, at ipa-utils.h

2019-02-09 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87089

--- Comment #10 from Jan Hubicka  ---
Jason,
I can avoid the ICE by simply not simplifying contexts for all C++ destructors.
Index: tree.c
===
--- tree.c  (revision 268728)
+++ tree.c  (working copy)
@@ -5772,7 +5772,7 @@ free_lang_data_in_decl (tree decl, struc
  these are needed by devirtualization.  */
   if (TREE_CODE (decl) != FIELD_DECL
   && ((TREE_CODE (decl) != VAR_DECL && TREE_CODE (decl) != FUNCTION_DECL)
-  || !DECL_VIRTUAL_P (decl)))
+  || (!DECL_VIRTUAL_P (decl) && !DECL_CXX_DESTRUCTOR_P (decl
 DECL_CONTEXT (decl) = fld_decl_context (DECL_CONTEXT (decl));
 }

but it seems to me this is more a workaround - if the destructor is virtual, it
should have VIRTUAL flag set. Or is there any reason we want to handle it
differently then any other normal virutal function in the middle-end?

[Bug lto/87089] [9 regression] tree check: expected class 'type', have 'declaration' (namespace_decl) in type_with_linkage_p, at ipa-utils.h

2019-01-02 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87089

Jan Hubicka  changed:

   What|Removed |Added

 CC||jason at redhat dot com

--- Comment #9 from Jan Hubicka  ---
This is caused by:

_ZN4itpp1cILNS_1aE0EED2Ev/1 (itpp::c< >::~c() [with itpp::a
 = itpp::b]) @0x770e9438
  Type: function definition analyzed
  Visibility: forced_by_abi public weak comdat_group:_ZN4itpp1cILNS_1aE0EED5Ev
one_only
  Same comdat group as: _ZN4itpp1cILNS_1aE0EED1Ev/2 
  Address is taken. 
  Aux: @0x770e95a0  
  References: _ZTVN4itpp1cILNS_1aE0EEE/4 (addr)__gxx_personality_v0/8 (addr)
  Referring: _ZN4itpp1cILNS_1aE0EED1Ev/2 (alias)
  Function flags: body  
  Called by:
  Calls: itpp::CFix::~CFix()/7

this is a destructor which is pointed to from virutal table, but it has no
DECL_VIRTUAL_P flag set. This makes free_lang_data to modify its context and
point to outer namespace rather than the containing polymorphic type.

Why we do not set VIRTUAL_P here?

[Bug lto/87089] [9 regression] tree check: expected class 'type', have 'declaration' (namespace_decl) in type_with_linkage_p, at ipa-utils.h

2018-12-28 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87089

Martin Liška  changed:

   What|Removed |Added

   Priority|P3  |P1

--- Comment #8 from Martin Liška  ---
It's still present for the following test-case:

$ cat 1.ii
namespace itpp {
template  void b(a *c) { c[0].~a(); }
class CFix;
template  class d {
  void e(const char *);
  CFix *data;
};
class CFix {
public:
  virtual ~CFix();
};
template <> void d::e(const char *) { b(data); }
} // namespace itpp

$ cat 2.ii
namespace itpp {
enum a { b };
class CFix {
public:
  virtual ~CFix();
};
template  class c : CFix {
  ~c() {}
};
template class c<>;
} // namespace itpp

$ g++ -flto 1.ii 2.ii -shared -fPIC -O2
during IPA pass: devirt
lto1: internal compiler error: tree check: expected class ‘type’, have
‘declaration’ (namespace_decl) in type_with_linkage_p, at ipa-utils.h:185
0x6c7d51 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
/home/marxin/Programming/gcc/gcc/tree.c:9856
0xa3a7fd tree_class_check(tree_node const*, tree_code_class, char const*, int,
char const*)
/home/marxin/Programming/gcc/gcc/tree.h:3555
0xa3a7fd type_with_linkage_p(tree_node const*)
/home/marxin/Programming/gcc/gcc/ipa-utils.h:185
0xa3a7fd type_in_anonymous_namespace_p(tree_node const*)
/home/marxin/Programming/gcc/gcc/ipa-utils.h:221
0xa311ba maybe_record_node
/home/marxin/Programming/gcc/gcc/ipa-devirt.c:2531
0xa31c7c record_target_from_binfo
/home/marxin/Programming/gcc/gcc/ipa-devirt.c:2675
0xa31b4a record_target_from_binfo
/home/marxin/Programming/gcc/gcc/ipa-devirt.c:2687
0xa31fbd possible_polymorphic_call_targets_1
/home/marxin/Programming/gcc/gcc/ipa-devirt.c:2730
0xa37794 possible_polymorphic_call_targets(tree_node*, long,
ipa_polymorphic_call_context, bool*, void**, bool)
/home/marxin/Programming/gcc/gcc/ipa-devirt.c:3351
0xa39559 possible_polymorphic_call_targets(cgraph_edge*, bool*, void**, bool)
/home/marxin/Programming/gcc/gcc/ipa-utils.h:118
0xa39559 ipa_devirt
/home/marxin/Programming/gcc/gcc/ipa-devirt.c:3770
0xa39559 execute
/home/marxin/Programming/gcc/gcc/ipa-devirt.c:4088

[Bug lto/87089] [9 regression] tree check: expected class 'type', have 'declaration' (namespace_decl) in type_with_linkage_p, at ipa-utils.h

2018-12-28 Thread dimhen at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87089

--- Comment #7 from Dmitry G. Dyachenko  ---
(In reply to Dmitry G. Dyachenko from comment #6)
> r267445 PASS

sorry for noise

1. testcase from PR FAIL for me with r267445
2. real-world-code-compilation not FAIL

[Bug lto/87089] [9 regression] tree check: expected class 'type', have 'declaration' (namespace_decl) in type_with_linkage_p, at ipa-utils.h

2018-12-28 Thread dimhen at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87089

--- Comment #6 from Dmitry G. Dyachenko  ---
r267445 PASS

[Bug lto/87089] [9 regression] tree check: expected class 'type', have 'declaration' (namespace_decl) in type_with_linkage_p, at ipa-utils.h

2018-12-24 Thread dimhen at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87089

Dmitry G. Dyachenko  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

--- Comment #5 from Dmitry G. Dyachenko  ---
r267346 PASS
r267418 FAIL

PR87089]$ g++ -flto -fPIC -DPIC -shared a.o b.o
b.ii:6:8: warning: type ‘struct ASN1C_CertificateListAssertion’ violates the
C++ One Definition Rule [-Wodr]
6 | struct ASN1C_CertificateListAssertion : a{} * b;
  |^
a.ii:2:8: note: a type with different bases is defined in another translation
unit
2 | struct ASN1C_CertificateListAssertion {
  |^
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:185
0x732d05 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
/home/dimhen/src/gcc_current/gcc/tree.c:9856
0xc1880a maybe_record_node
/home/dimhen/src/gcc_current/gcc/ipa-devirt.c:2531
0xc1ec81 possible_polymorphic_call_targets(tree_node*, long,
ipa_polymorphic_call_context, bool*, void**, bool)
/home/dimhen/src/gcc_current/gcc/ipa-devirt.c:3340
0xc55506 possible_polymorphic_call_targets(cgraph_edge*, bool*, void**, bool)
/home/dimhen/src/gcc_current/gcc/ipa-utils.h:118
0xc55506 walk_polymorphic_call_targets
/home/dimhen/src/gcc_current/gcc/ipa.c:183
0xc57cd4 symbol_table::remove_unreachable_nodes(_IO_FILE*)
/home/dimhen/src/gcc_current/gcc/ipa.c:427
0x98d642 read_cgraph_and_symbols
/home/dimhen/src/gcc_current/gcc/lto/lto.c:2978
0x98d642 lto_main()
/home/dimhen/src/gcc_current/gcc/lto/lto.c:3362
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
lto-wrapper: fatal error: g++ returned 1 exit status
compilation terminated.
/usr/local/gdb_current/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
[dimhen:dim PR87089]$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/local/gcc_current/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
Target: x86_64-pc-linux-gnu
Configured with: /home/dimhen/src/gcc_current/configure
--prefix=/usr/local/gcc_current --enable-checking=yes,df,fold,rtl,extra
--enable-languages=c,c++,lto --disable-multilib --enable-shared
--enable-threads=posix --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl
--enable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver
--enable-gnu-indirect-function --with-tune=native
Thread model: posix
gcc version 9.0.0 20181225 (experimental) [trunk revision 267418] (GCC)

[Bug lto/87089] [9 regression] tree check: expected class 'type', have 'declaration' (namespace_decl) in type_with_linkage_p, at ipa-utils.h

2018-11-12 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87089

Martin Liška  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Martin Liška  ---
I can confirm it's fixed.

[Bug lto/87089] [9 regression] tree check: expected class 'type', have 'declaration' (namespace_decl) in type_with_linkage_p, at ipa-utils.h

2018-11-12 Thread dimhen at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87089

--- Comment #3 from Dmitry G. Dyachenko  ---
r266001 PASS

[Bug lto/87089] [9 regression] tree check: expected class 'type', have 'declaration' (namespace_decl) in type_with_linkage_p, at ipa-utils.h

2018-08-25 Thread dimhen at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87089

--- Comment #2 from Dmitry G. Dyachenko  ---
gcc invocation can be simplified : -fno-semantic-interposition can be removed.
(was needed while creducing original testcase)

So,
$ g++ -fpreprocessed -O2 -flto -fPIC -DPIC -c -o a.o a.ii
$ g++ -fpreprocessed -O2 -flto -fPIC -DPIC -c -o b.o b.ii
$ g++ -flto -fPIC -DPIC -shared a.o b.o

[Bug lto/87089] [9 regression] tree check: expected class 'type', have 'declaration' (namespace_decl) in type_with_linkage_p, at ipa-utils.h

2018-08-24 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87089

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |9.0

[Bug lto/87089] [9 regression] tree check: expected class 'type', have 'declaration' (namespace_decl) in type_with_linkage_p, at ipa-utils.h

2018-08-24 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87089

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2018-08-24
   Assignee|unassigned at gcc dot gnu.org  |hubicka at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Martin Liška  ---
Confirmed, started with r263697.