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

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-09-11
                 CC|                            |trippels at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
 % cat test2.ii
extern "C" void printf(...);
struct A {
  A(int, char *p2) { printf(p2); }
};
template <int, typename> struct B { static A static_var; };
template <int LINE, typename GETTER>
A B<LINE, GETTER>::static_var{0, GETTER::get()};
struct C {
  void unused() {
    static char function_static;
    struct D {
      static char *get() { return &function_static; }
    };
    auto addr = B<0, D>::static_var;
  }
};
int main() {}

 % clang++ -flto -O2 test2.ii
 % clang++ -O2 test2.ii
 % icpc -O2 test2.ii
 % g++ -O2 test2.ii
/tmp/ccskrvWq.o:test2.ii:function _GLOBAL__sub_I_main: error: undefined
reference to 'C::unused()::function_static'
collect2: error: ld returned 1 exit status

(with -flto we get an ICE:)
 % g++ -flto -O2 test2.ii
test2.ii:17:13: internal compiler error: in get_partitioning_class, at
symtab.c:1850
 int main() {}
             ^
0x98fdd1 symtab_node::get_partitioning_class()
        ../../gcc/gcc/symtab.c:1850
0xc4ddb7 lto_output_varpool_node
        ../../gcc/gcc/lto-cgraph.c:614
0xc4ddb7 output_symtab()
        ../../gcc/gcc/lto-cgraph.c:1024
0xc60ba9 lto_output()
        ../../gcc/gcc/lto-streamer-out.c:2395
0xccb4ee write_lto
        ../../gcc/gcc/passes.c:2455
0xccefce ipa_write_summaries_1
        ../../gcc/gcc/passes.c:2519
0xccefce ipa_write_summaries()
        ../../gcc/gcc/passes.c:2579
0x9a8020 ipa_passes
        ../../gcc/gcc/cgraphunit.c:2330
0x9a8020 symbol_table::compile()
        ../../gcc/gcc/cgraphunit.c:2424
0x9aa8a1 symbol_table::compile()
        ../../gcc/gcc/cgraphunit.c:2557
0x9aa8a1 symbol_table::finalize_compilation_unit()
        ../../gcc/gcc/cgraphunit.c:2583
Please submit a full bug report,

Reply via email to