public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "geoffk at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/10591] PCH breaks anonymous namespaces
Date: Fri, 07 Apr 2006 00:55:00 -0000	[thread overview]
Message-ID: <20060407005526.16553.qmail@sourceware.org> (raw)
In-Reply-To: <bug-10591-102@http.gcc.gnu.org/bugzilla/>



------- Comment #23 from geoffk at gcc dot gnu dot org  2006-04-07 00:55 -------
(In reply to comment #22)
> The PCH problem with get_file_function_name is independent of the question of
> giving anonymous namespace members internal linkage.  We still need to give
> them distinct names; we are giving up on address comparison of type_infos
> because of problems with plugins.

If you're giving up address comparison on type_info, you still have to find a
way where two typeinfo objects with the same C++ name can be different, due to
this example:

A shared object contains

class A { };
class B __attribute__((visibility("hidden"))) : class A { };
void f () { throw new B(); }

A main program contains:

class A { };
extern void f();
class B __attribute__((visibility("hidden"))) { int x; };  // not an A
int main() {
  try {
    f();
  } catch (B * p) {
    abort();
  } catch (A * p) {
    exit (0);
  }
  abort();
}

This program should not abort, because the 'B' in the main program is not the
same as the 'B' in the dylib.

My suggestion would be to include &__dso_handle in the typeinfo for objects
with hidden visibility, and also compare that.

Now, if you're doing this for visibility, you can also do it for anonymous
namespaces.  Just find any address in the translation unit that contains the
anonymous namespace (hey, how about the address of the typeinfo itself?), and
consistently include that address in the typeinfo, and compare that.


-- 


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


  parent reply	other threads:[~2006-04-07  0:55 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-10591-102@http.gcc.gnu.org/bugzilla/>
2006-03-09  0:35 ` [Bug c++/10591] Members of anonymous namespaces should not be TREE_PUBLIC geoffk at gcc dot gnu dot org
2006-03-09  0:37 ` [Bug c++/10591] use ODR rules to make C++ objects " geoffk at gcc dot gnu dot org
2006-03-09  0:44 ` geoffk at gcc dot gnu dot org
2006-03-09  0:48 ` geoffk at gcc dot gnu dot org
2006-03-09  0:53 ` geoffk at gcc dot gnu dot org
2006-03-21 18:23 ` jason at gcc dot gnu dot org
2006-03-21 19:12 ` cpence at gmail dot com
2006-03-21 19:19 ` jason at redhat dot com
2006-03-28  3:06 ` pinskia at gcc dot gnu dot org
2006-04-05 22:26 ` [Bug c++/10591] PCH breaks anonymous namespaces jason at gcc dot gnu dot org
2006-04-07  0:55 ` geoffk at gcc dot gnu dot org [this message]
2006-06-30 22:39 ` jason at gcc dot gnu dot org
2006-07-05  3:02 ` pinskia at gcc dot gnu dot org
2006-09-14 16:02 ` pinskia at gcc dot gnu dot org
2007-01-27  3:32 ` loban dot rahman at gmail dot com
2007-12-08 20:29 ` pinskia at gcc dot gnu dot org

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=20060407005526.16553.qmail@sourceware.org \
    --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).