public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/59472] New: Many warnings "type of 'X' does not match original declaration" when linking with libstdc++ static library compiled with -flto
@ 2013-12-11 16:06 d.g.gorbachev at gmail dot com
  2014-01-22 21:36 ` [Bug libstdc++/59472] " glisse at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: d.g.gorbachev at gmail dot com @ 2013-12-11 16:06 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59472

            Bug ID: 59472
           Summary: Many warnings "type of 'X' does not match original
                    declaration" when linking with libstdc++ static
                    library compiled with -flto
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: d.g.gorbachev at gmail dot com

$ cat > hello.cc
#include <iostream>

int main()
{
  std::cout << "Hello, world\n";
  return 0;
}
^D
$ g++ -flto hello.cc
../../../../../gcc-4.9/libstdc++-v3/src/c++98/ios_init.cc:66:18: warning: type
of 'cin' does not match original declaration [enabled by default]
../../../../../gcc-4.9/libstdc++-v3/src/c++98/globals_io.cc:56:16: note:
previously declared here
../../../../../gcc-4.9/libstdc++-v3/src/c++98/ios_init.cc:68:18: warning: type
of 'cerr' does not match original declaration [enabled by default]
../../../../../gcc-4.9/libstdc++-v3/src/c++98/globals_io.cc:58:16: note:
previously declared here
../../../../../gcc-4.9/libstdc++-v3/src/c++98/ios_init.cc:69:18: warning: type
of 'clog' does not match original declaration [enabled by default]
../../../../../gcc-4.9/libstdc++-v3/src/c++98/globals_io.cc:59:16: note:
previously declared here
../../../../../gcc-4.9/libstdc++-v3/src/c++98/ios_init.cc:72:19: warning: type
of 'wcin' does not match original declaration [enabled by default]
../../../../../gcc-4.9/libstdc++-v3/src/c++98/globals_io.cc:66:17: note:
previously declared here
../../../../../gcc-4.9/libstdc++-v3/src/c++98/ios_init.cc:73:19: warning: type
of 'wcout' does not match original declaration [enabled by default]
../../../../../gcc-4.9/libstdc++-v3/src/c++98/globals_io.cc:67:17: note:
previously declared here
../../../../../gcc-4.9/libstdc++-v3/src/c++98/ios_init.cc:74:19: warning: type
of 'wcerr' does not match original declaration [enabled by default]
../../../../../gcc-4.9/libstdc++-v3/src/c++98/globals_io.cc:68:17: note:
previously declared here
../../../../../gcc-4.9/libstdc++-v3/src/c++98/ios_init.cc:75:19: warning: type
of 'wclog' does not match original declaration [enabled by default]
../../../../../gcc-4.9/libstdc++-v3/src/c++98/globals_io.cc:69:17: note:
previously declared here
../../../../../gcc-4.9/libstdc++-v3/src/c++98/ios_init.cc:41:35: warning: type
of 'buf_cout_sync' does not match original declaration [enabled by default]
../../../../../gcc-4.9/libstdc++-v3/src/c++98/globals_io.cc:84:17: note:
previously declared here
../../../../../gcc-4.9/libstdc++-v3/src/c++98/ios_init.cc:42:35: warning: type
of 'buf_cin_sync' does not match original declaration [enabled by default]
../../../../../gcc-4.9/libstdc++-v3/src/c++98/globals_io.cc:85:17: note:
previously declared here
../../../../../gcc-4.9/libstdc++-v3/src/c++98/ios_init.cc:43:35: warning: type
of 'buf_cerr_sync' does not match original declaration [enabled by default]
../../../../../gcc-4.9/libstdc++-v3/src/c++98/globals_io.cc:86:17: note:
previously declared here
../../../../../gcc-4.9/libstdc++-v3/src/c++98/ios_init.cc:45:30: warning: type
of 'buf_cout' does not match original declaration [enabled by default]
../../../../../gcc-4.9/libstdc++-v3/src/c++98/globals_io.cc:90:16: note:
previously declared here
../../../../../gcc-4.9/libstdc++-v3/src/c++98/ios_init.cc:46:30: warning: type
of 'buf_cin' does not match original declaration [enabled by default]
../../../../../gcc-4.9/libstdc++-v3/src/c++98/globals_io.cc:91:16: note:
previously declared here
../../../../../gcc-4.9/libstdc++-v3/src/c++98/ios_init.cc:47:30: warning: type
of 'buf_cerr' does not match original declaration [enabled by default]
../../../../../gcc-4.9/libstdc++-v3/src/c++98/globals_io.cc:92:16: note:
previously declared here
../../../../../gcc-4.9/libstdc++-v3/src/c++98/ios_init.cc:50:38: warning: type
of 'buf_wcout_sync' does not match original declaration [enabled by default]
../../../../../gcc-4.9/libstdc++-v3/src/c++98/globals_io.cc:97:18: note:
previously declared here
../../../../../gcc-4.9/libstdc++-v3/src/c++98/ios_init.cc:51:38: warning: type
of 'buf_wcin_sync' does not match original declaration [enabled by default]
../../../../../gcc-4.9/libstdc++-v3/src/c++98/globals_io.cc:98:18: note:
previously declared here
../../../../../gcc-4.9/libstdc++-v3/src/c++98/ios_init.cc:52:38: warning: type
of 'buf_wcerr_sync' does not match original declaration [enabled by default]
../../../../../gcc-4.9/libstdc++-v3/src/c++98/globals_io.cc:99:18: note:
previously declared here
../../../../../gcc-4.9/libstdc++-v3/src/c++98/ios_init.cc:54:33: warning: type
of 'buf_wcout' does not match original declaration [enabled by default]
../../../../../gcc-4.9/libstdc++-v3/src/c++98/globals_io.cc:103:17: note:
previously declared here
../../../../../gcc-4.9/libstdc++-v3/src/c++98/ios_init.cc:55:33: warning: type
of 'buf_wcin' does not match original declaration [enabled by default]
../../../../../gcc-4.9/libstdc++-v3/src/c++98/globals_io.cc:104:17: note:
previously declared here
../../../../../gcc-4.9/libstdc++-v3/src/c++98/ios_init.cc:56:33: warning: type
of 'buf_wcerr' does not match original declaration [enabled by default]
../../../../../gcc-4.9/libstdc++-v3/src/c++98/globals_io.cc:105:17: note:
previously declared here
/usr/local/lib/gcc/i686-pc-linux-gnu/4.9.0/include/c++/iostream:61:18: warning:
type of 'cout' does not match original declaration [enabled by default]
   extern ostream cout;  /// Linked to standard output
                  ^
../../../../../gcc-4.9/libstdc++-v3/src/c++98/ios_init.cc:67:18: warning: type
of 'cout' does not match original declaration [enabled by default]
../../../../../gcc-4.9/libstdc++-v3/src/c++98/globals_io.cc:57:16: note:
previously declared here

(To reproduce it, libstdc++ should be compiled with LTO (for example, by
passing --enable-cxx-flags='-flto -ffat-lto-objects' to the configure script).)

These warnings cause some displeasure, and there is no way to disable them.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/59472] Many warnings "type of 'X' does not match original declaration" when linking with libstdc++ static library compiled with -flto
  2013-12-11 16:06 [Bug lto/59472] New: Many warnings "type of 'X' does not match original declaration" when linking with libstdc++ static library compiled with -flto d.g.gorbachev at gmail dot com
@ 2014-01-22 21:36 ` glisse at gcc dot gnu.org
  2014-05-08 13:24 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-01-22 21:36 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59472

Marc Glisse <glisse at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-01-22
          Component|lto                         |libstdc++
     Ever confirmed|0                           |1

--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
Same here (CXXFLAGS_FOR_TARGET="-O2 -g -flto -ffat-lto-objects" after a trivial
fix for PR 43538):

/data/repos/gcc/trunk/libstdc++-v3/src/c++98/ios_init.cc:56:33: warning: type
of 'buf_wcerr' does not match original declaration [enabled by default]
   extern stdio_filebuf<wchar_t> buf_wcerr;
                                 ^
/data/repos/gcc/trunk/libstdc++-v3/src/c++98/globals_io.cc:105:17: note:
previously declared here
   fake_wfilebuf buf_wcerr;
                 ^

etc.

Reassigning to libstdc++ because the warnings seem to say the truth.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/59472] Many warnings "type of 'X' does not match original declaration" when linking with libstdc++ static library compiled with -flto
  2013-12-11 16:06 [Bug lto/59472] New: Many warnings "type of 'X' does not match original declaration" when linking with libstdc++ static library compiled with -flto d.g.gorbachev at gmail dot com
  2014-01-22 21:36 ` [Bug libstdc++/59472] " glisse at gcc dot gnu.org
@ 2014-05-08 13:24 ` redi at gcc dot gnu.org
  2014-05-08 13:32 ` redi at gcc dot gnu.org
  2014-06-24 16:38 ` paul at scruby dot com
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2014-05-08 13:24 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59472

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Marc Glisse from comment #1)
> Reassigning to libstdc++ because the warnings seem to say the truth.

They do tell the truth.

We use char arrays for good reason (see the comment in src/c++98/globals_io.cc)
but I'm not sure why we have to lie about the types in src/c++98/ios_init.cc, I
think it's only so we can call the destructors in ios::sync_with_stdio:

    // Explicitly call dtors to free any memory that is
    // dynamically allocated by filebuf ctor or member functions,
    // but don't deallocate all memory by calling operator delete.
    buf_cout_sync.~stdio_sync_filebuf<char>();
    buf_cin_sync.~stdio_sync_filebuf<char>();
    buf_cerr_sync.~stdio_sync_filebuf<char>();

But I think that could be done by casting the char array to stdio_sync_filebuf*
instead.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/59472] Many warnings "type of 'X' does not match original declaration" when linking with libstdc++ static library compiled with -flto
  2013-12-11 16:06 [Bug lto/59472] New: Many warnings "type of 'X' does not match original declaration" when linking with libstdc++ static library compiled with -flto d.g.gorbachev at gmail dot com
  2014-01-22 21:36 ` [Bug libstdc++/59472] " glisse at gcc dot gnu.org
  2014-05-08 13:24 ` redi at gcc dot gnu.org
@ 2014-05-08 13:32 ` redi at gcc dot gnu.org
  2014-06-24 16:38 ` paul at scruby dot com
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2014-05-08 13:32 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59472

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
That should work for the streambufs, it's not so simple for the standard stream
objects though, as they're user-visible and we declared their (pretend) types
in <iostream>.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/59472] Many warnings "type of 'X' does not match original declaration" when linking with libstdc++ static library compiled with -flto
  2013-12-11 16:06 [Bug lto/59472] New: Many warnings "type of 'X' does not match original declaration" when linking with libstdc++ static library compiled with -flto d.g.gorbachev at gmail dot com
                   ` (2 preceding siblings ...)
  2014-05-08 13:32 ` redi at gcc dot gnu.org
@ 2014-06-24 16:38 ` paul at scruby dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paul at scruby dot com @ 2014-06-24 16:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Paul Scruby <paul at scruby dot com> ---
Is there a patch to fix or suppress the warnings when link-time optimizing to
libstdc++.a ?  I'm using gcc4.8.2, but I'm happy to upgrade to gcc4.9 if this
release is more likely to get fixed first?


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-06-24 16:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-11 16:06 [Bug lto/59472] New: Many warnings "type of 'X' does not match original declaration" when linking with libstdc++ static library compiled with -flto d.g.gorbachev at gmail dot com
2014-01-22 21:36 ` [Bug libstdc++/59472] " glisse at gcc dot gnu.org
2014-05-08 13:24 ` redi at gcc dot gnu.org
2014-05-08 13:32 ` redi at gcc dot gnu.org
2014-06-24 16:38 ` paul at scruby dot com

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).