public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/64275] New: Warnings when linking GCC go1: "(virtual table of) type 'struct X' violates one definition rule"
@ 2014-12-11 19:09 d.g.gorbachev at gmail dot com
2014-12-11 19:10 ` [Bug libstdc++/64275] " d.g.gorbachev at gmail dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: d.g.gorbachev at gmail dot com @ 2014-12-11 19:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64275
Bug ID: 64275
Summary: Warnings when linking GCC go1: "(virtual table of)
type 'struct X' violates one definition rule"
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: d.g.gorbachev at gmail dot com
GCC 5.0.0 20141207 (experimental). To reproduce the warnings, GCC and libstdc++
must be compiled with LTO (as in PR59472).
/tmp/build/prev-i686-pc-linux-gnu/libstdc++-v3/include/bits/ios_base.h:249:34:
warning: type 'struct failure' violates one definition rule [-Wodr]
class _GLIBCXX_ABI_TAG_CXX11 failure : public system_error
^
/tmp/build/i686-pc-linux-gnu/libstdc++-v3/include/bits/ios_base.h:111:0: note:
a type with different memory representation is defined in another translation
unit
../../../../../gcc-5/libstdc++-v3/src/c++98/ios_init.cc:56:0: warning: type of
'buf_wcerr' does not match original declaration
../../../../../gcc-5/libstdc++-v3/src/c++98/globals_io.cc:76:0: note:
previously declared here
../../../../../gcc-5/libstdc++-v3/src/c++98/ios_init.cc:56:0: warning: type of
'buf_wcin' does not match original declaration
../../../../../gcc-5/libstdc++-v3/src/c++98/globals_io.cc:76:0: note:
previously declared here
../../../../../gcc-5/libstdc++-v3/src/c++98/ios_init.cc:56:0: warning: type of
'buf_wcout' does not match original declaration
../../../../../gcc-5/libstdc++-v3/src/c++98/globals_io.cc:76:0: note:
previously declared here
../../../../../gcc-5/libstdc++-v3/src/c++98/ios_init.cc:56:0: warning: type of
'buf_cerr' does not match original declaration
../../../../../gcc-5/libstdc++-v3/src/c++98/globals_io.cc:76:0: note:
previously declared here
../../../../../gcc-5/libstdc++-v3/src/c++98/ios_init.cc:56:0: warning: type of
'buf_cin' does not match original declaration
../../../../../gcc-5/libstdc++-v3/src/c++98/globals_io.cc:76:0: note:
previously declared here
../../../../../gcc-5/libstdc++-v3/src/c++98/ios_init.cc:56:0: warning: type of
'buf_cout' does not match original declaration
../../../../../gcc-5/libstdc++-v3/src/c++98/globals_io.cc:76:0: note:
previously declared here
../../../../../gcc-5/libstdc++-v3/src/c++98/ios_init.cc:37:0: warning: type of
'wclog' does not match original declaration
../../../../../gcc-5/libstdc++-v3/src/c++98/globals_io.cc:64:0: note:
previously declared here
../../../../../gcc-5/libstdc++-v3/src/c++98/ios_init.cc:37:0: warning: type of
'wcerr' does not match original declaration
../../../../../gcc-5/libstdc++-v3/src/c++98/globals_io.cc:64:0: note:
previously declared here
../../../../../gcc-5/libstdc++-v3/src/c++98/ios_init.cc:37:0: warning: type of
'wcin' does not match original declaration
../../../../../gcc-5/libstdc++-v3/src/c++98/globals_io.cc:64:0: note:
previously declared here
../../../../../gcc-5/libstdc++-v3/src/c++98/ios_init.cc:37:0: warning: type of
'wcout' does not match original declaration
../../../../../gcc-5/libstdc++-v3/src/c++98/globals_io.cc:64:0: note:
previously declared here
../../../../../gcc-5/libstdc++-v3/src/c++98/ios_init.cc:37:0: warning: type of
'buf_wcerr_sync' does not match original declaration
../../../../../gcc-5/libstdc++-v3/src/c++98/globals_io.cc:76:0: note:
previously declared here
../../../../../gcc-5/libstdc++-v3/src/c++98/ios_init.cc:37:0: warning: type of
'buf_wcin_sync' does not match original declaration
../../../../../gcc-5/libstdc++-v3/src/c++98/globals_io.cc:76:0: note:
previously declared here
../../../../../gcc-5/libstdc++-v3/src/c++98/ios_init.cc:37:0: warning: type of
'buf_wcout_sync' does not match original declaration
../../../../../gcc-5/libstdc++-v3/src/c++98/globals_io.cc:76:0: note:
previously declared here
../../../../../gcc-5/libstdc++-v3/src/c++98/ios_init.cc:37:0: warning: type of
'clog' does not match original declaration
../../../../../gcc-5/libstdc++-v3/src/c++98/globals_io.cc:64:0: note:
previously declared here
../../../../../gcc-5/libstdc++-v3/src/c++98/ios_init.cc:37:0: warning: type of
'cerr' does not match original declaration
../../../../../gcc-5/libstdc++-v3/src/c++98/globals_io.cc:64:0: note:
previously declared here
../../../../../gcc-5/libstdc++-v3/src/c++98/ios_init.cc:37:0: warning: type of
'cin' does not match original declaration
../../../../../gcc-5/libstdc++-v3/src/c++98/globals_io.cc:64:0: note:
previously declared here
../../../../../gcc-5/libstdc++-v3/src/c++98/ios_init.cc:37:0: warning: type of
'cout' does not match original declaration
../../../../../gcc-5/libstdc++-v3/src/c++98/globals_io.cc:64:0: note:
previously declared here
../../../../../gcc-5/libstdc++-v3/src/c++98/ios_init.cc:37:0: warning: type of
'buf_cerr_sync' does not match original declaration
../../../../../gcc-5/libstdc++-v3/src/c++98/globals_io.cc:76:0: note:
previously declared here
../../../../../gcc-5/libstdc++-v3/src/c++98/ios_init.cc:37:0: warning: type of
'buf_cin_sync' does not match original declaration
../../../../../gcc-5/libstdc++-v3/src/c++98/globals_io.cc:76:0: note:
previously declared here
../../../../../gcc-5/libstdc++-v3/src/c++98/ios_init.cc:37:0: warning: type of
'buf_cout_sync' does not match original declaration
../../../../../gcc-5/libstdc++-v3/src/c++98/globals_io.cc:76:0: note:
previously declared here
/tmp/build/prev-i686-pc-linux-gnu/libstdc++-v3/include/bits/basic_ios.h:67:11:
warning: virtual table of type 'struct basic_ios' violates one definition rule
class basic_ios : public ios_base
^
/tmp/build/i686-pc-linux-gnu/libstdc++-v3/include/bits/basic_ios.h:91:0: note:
the conflicting type defined in another translation unit
/tmp/build/i686-pc-linux-gnu/libstdc++-v3/include/bits/basic_ios.h:67:0: note:
virtual method '_ZTISt9basic_iosIcSt11char_traitsIcEE'
/tmp/build/i686-pc-linux-gnu/libstdc++-v3/include/bits/basic_ios.h:67:0: note:
ought to match virtual method '__comp_dtor ' but does not
/tmp/build/prev-i686-pc-linux-gnu/libstdc++-v3/include/fstream:656:11: warning:
virtual table of type 'struct basic_ofstream' violates one definition rule
class basic_ofstream : public basic_ostream<_CharT,_Traits>
^
/tmp/build/i686-pc-linux-gnu/libstdc++-v3/include/fstream:467:0: note: the
conflicting type defined in another translation unit
/tmp/build/i686-pc-linux-gnu/libstdc++-v3/include/fstream:467:0: note: contains
additional virtual method '_ZTISo'
/tmp/build/prev-i686-pc-linux-gnu/libstdc++-v3/include/fstream:656:11: warning:
virtual table of type 'struct basic_ofstream' violates one definition rule
class basic_ofstream : public basic_ostream<_CharT,_Traits>
^
/tmp/build/i686-pc-linux-gnu/libstdc++-v3/include/fstream:467:0: note: the
conflicting type defined in another translation unit
/tmp/build/i686-pc-linux-gnu/libstdc++-v3/include/fstream:238:0: note: virtual
method '__deleting_dtor '
/tmp/build/i686-pc-linux-gnu/libstdc++-v3/include/fstream:238:0: note: ought to
match virtual method '__comp_dtor ' but does not
../../gcc-5/gcc/dwarf2out.c: In function 'add_addr_table_entry':
../../gcc-5/gcc/dwarf2out.c:4253:41: warning: 'finder.addr.label' may be used
uninitialized in this function [-Wmaybe-uninitialized]
inchash::add_rtx (a->addr.rtl, hstate);
^
../../gcc-5/gcc/dwarf2out.c:4303:20: note: 'finder.addr.label' was declared
here
addr_table_entry finder;
^
../../gcc-5/gcc/auto-profile.c: In member function 'execute':
/tmp/build/prev-i686-pc-linux-gnu/libstdc++-v3/include/bits/stl_tree.h:1523:2:
warning: 'only_one' may be used uninitialized in this function
[-Wmaybe-uninitialized]
if (!_M_impl._M_key_compare(_S_key(__x), __k))
^
../../gcc-5/gcc/auto-profile.c:1282:12: note: 'only_one' was declared here
edge only_one;
^
../../gcc-5/libbacktrace/elf.c: In function 'elf_add':
../../gcc-5/libbacktrace/mmapio.c:98:7: warning: 'ehdr_view.len' may be used
uninitialized in this function [-Wmaybe-uninitialized]
if (munmap (const_cast.v, view->len) < 0)
^
../../gcc-5/libbacktrace/elf.c:524:25: note: 'ehdr_view.len' was declared here
struct backtrace_view ehdr_view;
^
../../gcc-5/libbacktrace/mmapio.c:98:7: warning: 'ehdr_view.base' may be used
uninitialized in this function [-Wmaybe-uninitialized]
if (munmap (const_cast.v, view->len) < 0)
^
../../gcc-5/libbacktrace/elf.c:524:25: note: 'ehdr_view.base' was declared here
struct backtrace_view ehdr_view;
^
../../gcc-5/libbacktrace/elf.c:564:3: warning: 'ehdr_view.data' may be used
uninitialized in this function [-Wmaybe-uninitialized]
memcpy (&ehdr, ehdr_view.data, sizeof ehdr);
^
../../gcc-5/libbacktrace/elf.c:524:25: note: 'ehdr_view.data' was declared here
struct backtrace_view ehdr_view;
^
../../gcc-5/gcc/calls.c: In function 'expand_call':
../../gcc-5/gcc/dojump.c:127:56: warning: 'save.x_stack_pointer_delta' may be
used uninitialized in this function [-Wmaybe-uninitialized]
stack_pointer_delta = save->x_stack_pointer_delta;
^
../../gcc-5/gcc/calls.c:2799:34: note: 'save.x_stack_pointer_delta' was
declared here
saved_pending_stack_adjust save;
^
../../gcc-5/gcc/dojump.c:126:58: warning: 'save.x_pending_stack_adjust' may be
used uninitialized in this function [-Wmaybe-uninitialized]
pending_stack_adjust = save->x_pending_stack_adjust;
^
../../gcc-5/gcc/calls.c:2799:34: note: 'save.x_pending_stack_adjust' was
declared here
saved_pending_stack_adjust save;
^
../../gcc-5/gcc/builtins.c: In function 'c_readstr':
../../gcc-5/gcc/builtins.c:663:17: warning: 'tmp[0]' may be used uninitialized
in this function [-Wmaybe-uninitialized]
HOST_WIDE_INT tmp[MAX_BITSIZE_MODE_ANY_INT / HOST_BITS_PER_WIDE_INT];
^
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libstdc++/64275] Warnings when linking GCC go1: "(virtual table of) type 'struct X' violates one definition rule"
2014-12-11 19:09 [Bug libstdc++/64275] New: Warnings when linking GCC go1: "(virtual table of) type 'struct X' violates one definition rule" d.g.gorbachev at gmail dot com
@ 2014-12-11 19:10 ` d.g.gorbachev at gmail dot com
2015-01-30 11:24 ` redi at gcc dot gnu.org
2015-02-12 14:54 ` redi at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: d.g.gorbachev at gmail dot com @ 2014-12-11 19:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64275
Dmitry Gorbachev <d.g.gorbachev at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |lto
--- Comment #1 from Dmitry Gorbachev <d.g.gorbachev at gmail dot com> ---
If necessary, I can add a self-sufficing testcase extracted from GCC...
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libstdc++/64275] Warnings when linking GCC go1: "(virtual table of) type 'struct X' violates one definition rule"
2014-12-11 19:09 [Bug libstdc++/64275] New: Warnings when linking GCC go1: "(virtual table of) type 'struct X' violates one definition rule" d.g.gorbachev at gmail dot com
2014-12-11 19:10 ` [Bug libstdc++/64275] " d.g.gorbachev at gmail dot com
@ 2015-01-30 11:24 ` redi at gcc dot gnu.org
2015-02-12 14:54 ` redi at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2015-01-30 11:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64275
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The simplest way to solve this might be to replace the extern declarations in
ios_init.cc such as:
extern stdio_sync_filebuf<char> buf_cout_sync;
with a pointer:
extern stdio_sync_filebuf<char>* buf_cout_sync_p;
then in globals_io.cc do:
stdio_sync_filebuf<char>* buf_cout_sync_p =
reintepret_cast<stdio_sync_filebuf<char>*>(buf_cout_sync);
That way we have an explicit cast rather than just relying on the linker
finding the symbol.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libstdc++/64275] Warnings when linking GCC go1: "(virtual table of) type 'struct X' violates one definition rule"
2014-12-11 19:09 [Bug libstdc++/64275] New: Warnings when linking GCC go1: "(virtual table of) type 'struct X' violates one definition rule" d.g.gorbachev at gmail dot com
2014-12-11 19:10 ` [Bug libstdc++/64275] " d.g.gorbachev at gmail dot com
2015-01-30 11:24 ` redi at gcc dot gnu.org
@ 2015-02-12 14:54 ` redi at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2015-02-12 14:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64275
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-02-12
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-02-12 14:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-11 19:09 [Bug libstdc++/64275] New: Warnings when linking GCC go1: "(virtual table of) type 'struct X' violates one definition rule" d.g.gorbachev at gmail dot com
2014-12-11 19:10 ` [Bug libstdc++/64275] " d.g.gorbachev at gmail dot com
2015-01-30 11:24 ` redi at gcc dot gnu.org
2015-02-12 14:54 ` redi at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).