public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "persgray at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/66902] New: _S_debug_messages is unneccessary public
Date: Fri, 17 Jul 2015 02:18:00 -0000	[thread overview]
Message-ID: <bug-66902-4@http.gcc.gnu.org/bugzilla/> (raw)

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.


             reply	other threads:[~2015-07-17  2:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-17  2:18 persgray at gmail dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-66902-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).