public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/10591] Members of anonymous namespaces should not be TREE_PUBLIC
       [not found] <bug-10591-102@http.gcc.gnu.org/bugzilla/>
@ 2006-03-09  0:35 ` 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
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: geoffk at gcc dot gnu dot org @ 2006-03-09  0:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from geoffk at gcc dot gnu dot org  2006-03-09 00:35 -------
*** Bug 25915 has been marked as a duplicate of this bug. ***


-- 

geoffk at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sabre at nondot dot org


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


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

* [Bug c++/10591] use ODR rules to make C++ objects not be TREE_PUBLIC
       [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 ` geoffk at gcc dot gnu dot org
  2006-03-09  0:44 ` geoffk at gcc dot gnu dot org
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: geoffk at gcc dot gnu dot org @ 2006-03-09  0:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from geoffk at gcc dot gnu dot org  2006-03-09 00:37 -------
This is the same original report as bug 25915, which then was generalised as
follows:

Any entity which could be defined more than once (like a class or an inline
function) but whose token stream refers to a function or variable which is not
TREE_PUBLIC, actually can't be defined more than once, and so every part of
such entity can be made not-TREE_PUBLIC.

Exception: if the object referred to is 'const', is of scalar type, is
initialized with a constant expression, and the value but not the address of
the object is used, it doesn't count.  For additional details, including
additional cases where this applies and an explanation of how it applies to
templates, see [basic.def.odr] paragraph 5.


-- 

geoffk at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Members of anonymous        |use ODR rules to make C++
                   |namespaces should not be    |objects not be TREE_PUBLIC
                   |TREE_PUBLIC                 |


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


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

* [Bug c++/10591] use ODR rules to make C++ objects not be TREE_PUBLIC
       [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
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: geoffk at gcc dot gnu dot org @ 2006-03-09  0:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #15 from geoffk at gcc dot gnu dot org  2006-03-09 00:44 -------
Another case is when someone writes

struct a_struct __attribute__((visibility(hidden)));
void foo(a_struct &) { }

Even though "foo" is not marked hidden it should still be hidden, because it
could be overloaded in a different shared object with a parameter which has
type 'a_struct &' but is a different type.

This is especially important when 'func' is 'operator ==' or similar.


-- 


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


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

* [Bug c++/10591] use ODR rules to make C++ objects not be TREE_PUBLIC
       [not found] <bug-10591-102@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  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
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: geoffk at gcc dot gnu dot org @ 2006-03-09  0:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #16 from geoffk at gcc dot gnu dot org  2006-03-09 00:48 -------
Oops!  I got confused about visibility vs. TREE_PUBLIC.  I think it would be
better to track the visibility stuff under a different bug.  The previous
comment does apply when something is in an anonymous namespace, but it's only
an optimisation, not required for correctness, since at the moment we give
things in an anonymous namespace a random name to avoid exactly this kind of
problem.


-- 

geoffk at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|19664                       |
              nThis|                            |


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


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

* [Bug c++/10591] use ODR rules to make C++ objects not be TREE_PUBLIC
       [not found] <bug-10591-102@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  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
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: geoffk at gcc dot gnu dot org @ 2006-03-09  0:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #17 from geoffk at gcc dot gnu dot org  2006-03-09 00:53 -------
I made 26612 to track the similar situation with visibility.


-- 


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


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

* [Bug c++/10591] use ODR rules to make C++ objects not be TREE_PUBLIC
       [not found] <bug-10591-102@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  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
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: jason at gcc dot gnu dot org @ 2006-03-21 18:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #18 from jason at gcc dot gnu dot org  2006-03-21 18:22 -------
I think the summary is misleading; the change requested is an optimization. 
The testcase breaks because PCH breaks anonymous namespace naming so that it
gets the same name in all translation units.  I assume that the same problem
happens with other users of get_file_function_name.


-- 


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


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

* [Bug c++/10591] use ODR rules to make C++ objects not be TREE_PUBLIC
       [not found] <bug-10591-102@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  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
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: cpence at gmail dot com @ 2006-03-21 19:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #19 from cpence at gmail dot com  2006-03-21 19:12 -------
@#18: I disagree.  This bug is the only thing preventing anonymous namespaces
from working together with PCH.  As such, it's a bug, insofar as it keeps a
_very_ worthwhile feature (namely, precompiling massive C++ headers like Boost)
from working.


-- 


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


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

* [Bug c++/10591] use ODR rules to make C++ objects not be TREE_PUBLIC
       [not found] <bug-10591-102@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  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
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: jason at redhat dot com @ 2006-03-21 19:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #20 from jason at redhat dot com  2006-03-21 19:19 -------
Subject: Re:  use ODR rules to make C++ objects not be TREE_PUBLIC

Sorry I wasn't clear; I agree that this is an important bug.  I meant 
that fixing the unique anonymous namespace name in the presence of PCH 
is the right way to fix it.

Jason


-- 


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


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

* [Bug c++/10591] use ODR rules to make C++ objects not be TREE_PUBLIC
       [not found] <bug-10591-102@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  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
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-28  3:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #21 from pinskia at gcc dot gnu dot org  2006-03-28 03:06 -------
*** Bug 26895 has been marked as a duplicate of this bug. ***


-- 


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


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

* [Bug c++/10591] PCH breaks anonymous namespaces
       [not found] <bug-10591-102@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2006-03-28  3:06 ` pinskia at gcc dot gnu dot org
@ 2006-04-05 22:26 ` jason at gcc dot gnu dot org
  2006-04-07  0:55 ` geoffk at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: jason at gcc dot gnu dot org @ 2006-04-05 22:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #22 from jason at gcc dot gnu dot org  2006-04-05 22:26 -------
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.


-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|21581, 25915                |
              nThis|                            |
            Summary|use ODR rules to make C++   |PCH breaks anonymous
                   |objects not be TREE_PUBLIC  |namespaces


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


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

* [Bug c++/10591] PCH breaks anonymous namespaces
       [not found] <bug-10591-102@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  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
  2006-06-30 22:39 ` jason at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: geoffk at gcc dot gnu dot org @ 2006-04-07  0:55 UTC (permalink / raw)
  To: gcc-bugs



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


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

* [Bug c++/10591] PCH breaks anonymous namespaces
       [not found] <bug-10591-102@http.gcc.gnu.org/bugzilla/>
                   ` (10 preceding siblings ...)
  2006-04-07  0:55 ` geoffk at gcc dot gnu dot org
@ 2006-06-30 22:39 ` jason at gcc dot gnu dot org
  2006-07-05  3:02 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: jason at gcc dot gnu dot org @ 2006-06-30 22:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #24 from jason at gcc dot gnu dot org  2006-06-30 21:30 -------
Did my recent visibility patch fix this?


-- 


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


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

* [Bug c++/10591] PCH breaks anonymous namespaces
       [not found] <bug-10591-102@http.gcc.gnu.org/bugzilla/>
                   ` (11 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-07-05  3:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #25 from pinskia at gcc dot gnu dot org  2006-07-05 03:01 -------
Fixed for 4.2.0.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.2.0


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


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

* [Bug c++/10591] PCH breaks anonymous namespaces
       [not found] <bug-10591-102@http.gcc.gnu.org/bugzilla/>
                   ` (12 preceding siblings ...)
  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
  15 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-14 16:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #26 from pinskia at gcc dot gnu dot org  2006-09-14 16:01 -------
*** Bug 29085 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |_vi at list dot ru


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


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

* [Bug c++/10591] PCH breaks anonymous namespaces
       [not found] <bug-10591-102@http.gcc.gnu.org/bugzilla/>
                   ` (13 preceding siblings ...)
  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
  15 siblings, 0 replies; 16+ messages in thread
From: loban dot rahman at gmail dot com @ 2007-01-27  3:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #27 from loban dot rahman at gmail dot com  2007-01-27 03:32 -------
Would it be possible to backport this fix to the 4.1 tree? It would prove very,
very useful.


-- 


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


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

* [Bug c++/10591] PCH breaks anonymous namespaces
       [not found] <bug-10591-102@http.gcc.gnu.org/bugzilla/>
                   ` (14 preceding siblings ...)
  2007-01-27  3:32 ` loban dot rahman at gmail dot com
@ 2007-12-08 20:29 ` pinskia at gcc dot gnu dot org
  15 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-12-08 20:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #28 from pinskia at gcc dot gnu dot org  2007-12-08 20:29 -------
*** Bug 34309 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rbuergel at web dot de


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


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

end of thread, other threads:[~2007-12-08 20:29 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [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
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

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