public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/66902] New: _S_debug_messages is unneccessary public
@ 2015-07-17  2:18 persgray at gmail dot com
  2015-07-17  9:13 ` [Bug libstdc++/66902] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: persgray at gmail dot com @ 2015-07-17  2:18 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 66902
           Summary: _S_debug_messages is unneccessary public
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: persgray at gmail dot com
  Target Milestone: ---

Created attachment 36000
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36000&action=edit
proposed patch

The _S_debug_messages array is defined in libstdc++-v3/src/c++11/debug.cc
without "static" modifier, therefore becoming exported one. But it isn't used
in GCC anywhere outside the debug.cc source module. I found no users installed
in my laptop running many KDE-, GTK- and console-based programs.

On the other side, size of _S_debug_messages differs in different versions of
libstdc++. This way, while libstdc++ 4.9 is ABI-compatible with libstdc++ 4.2,
this particular symbol causes warnings from ld.so (at least here on OpenBSD).
Yes, libstdc++ versions are "mixed": some software requires decent versions of
GCC and doesn't build on the base one (4.2.1); therefore, such software gets
built and linked with GCC 4.9 (as of now), and libstdc++ 4.9 is forced to be
searched for symbols before libstdc++ 4.2. This works in general, but there is
a nasty warning produced:

WARNING: symbol(_ZN11__gnu_debug17_S_debug_messagesE) size mismatch, relink
your program

This happens because _S_debug_messages contains different number of strings in
different libstdc++ versions.

Since there is no real reason to keep _S_debug_messages public, I propose
making it static. There is an interface for accessing this array:

  const _Error_formatter&
  _Error_formatter::_M_message(_Debug_msg_id __id) const
  { return this->_M_message(_S_debug_messages[__id]); }

So the lack of "static" keyword looks like a simple overlook problem.

The attached patch simply adds "static" keyword. I've been running with this
patch for many weeks without any problem on OpenBSD/amd64.


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

end of thread, other threads:[~2015-09-11 11:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-17  2:18 [Bug libstdc++/66902] New: _S_debug_messages is unneccessary public persgray at gmail dot com
2015-07-17  9:13 ` [Bug libstdc++/66902] " redi at gcc dot gnu.org
2015-08-26 21:01 ` redi at gcc dot gnu.org
2015-09-03 19:05 ` redi at gcc dot gnu.org
2015-09-11 10:09 ` persgray at gmail dot com
2015-09-11 10:38 ` redi at gcc dot gnu.org
2015-09-11 11:13 ` persgray at gmail 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).