public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/31775] static object mangling conflicts with extern object
[not found] <bug-31775-4@http.gcc.gnu.org/bugzilla/>
@ 2020-10-06 11:41 ` nathan at gcc dot gnu.org
2020-10-07 14:35 ` nathan at gcc dot gnu.org
1 sibling, 0 replies; 13+ messages in thread
From: nathan at gcc dot gnu.org @ 2020-10-06 11:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31775
Nathan Sidwell <nathan at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |ASSIGNED
CC| |nathan at gcc dot gnu.org
Assignee|geoffk at gcc dot gnu.org |nathan at gcc dot gnu.org
Resolution|FIXED |---
--- Comment #10 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
the resolution of this report is incorrect.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/31775] static object mangling conflicts with extern object
[not found] <bug-31775-4@http.gcc.gnu.org/bugzilla/>
2020-10-06 11:41 ` [Bug c++/31775] static object mangling conflicts with extern object nathan at gcc dot gnu.org
@ 2020-10-07 14:35 ` nathan at gcc dot gnu.org
1 sibling, 0 replies; 13+ messages in thread
From: nathan at gcc dot gnu.org @ 2020-10-07 14:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31775
Nathan Sidwell <nathan at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #11 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
ReFixed 4e62aca0e05
This is DR1839, the original patch was supporting ill-formed code
the static mangling is unchanged though
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/31775] static object mangling conflicts with extern object
2007-05-01 18:53 [Bug c++/31775] New: " geoffk at gcc dot gnu dot org
` (8 preceding siblings ...)
2008-03-01 4:20 ` pinskia at gmail dot com
@ 2010-01-07 7:04 ` pinskia at gcc dot gnu dot org
9 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-01-07 7:04 UTC (permalink / raw)
To: gcc-bugs
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31775
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/31775] static object mangling conflicts with extern object
2007-05-01 18:53 [Bug c++/31775] New: " geoffk at gcc dot gnu dot org
` (7 preceding siblings ...)
2008-03-01 4:06 ` geoffk at geoffk dot org
@ 2008-03-01 4:20 ` pinskia at gmail dot com
2010-01-07 7:04 ` pinskia at gcc dot gnu dot org
9 siblings, 0 replies; 13+ messages in thread
From: pinskia at gmail dot com @ 2008-03-01 4:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from pinskia at gmail dot com 2008-03-01 04:19 -------
Subject: Re: static object mangling conflicts with extern object
Sent from my iPhone
On Feb 29, 2008, at 20:05, "geoffk at geoffk dot org" <gcc-bugzilla@gcc.gnu.org
> wrote:
>
>
> ------- Comment #8 from geoffk at geoffk dot org 2008-03-01 04:05
> ----
>>
>
> It should be mangled, because there are still three different things
> named 'i' declared in this program, and so the two that have assembler
> names have to have different names, and I don't think we want to start
> mangling non-static variable names.
Also mangling non-static variables will cause an ABI change.
Thanks,
Andrew Pinski
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31775
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Bug c++/31775] static object mangling conflicts with extern object
2008-03-01 4:06 ` geoffk at geoffk dot org
@ 2008-03-01 4:19 ` Andrew Pinski
0 siblings, 0 replies; 13+ messages in thread
From: Andrew Pinski @ 2008-03-01 4:19 UTC (permalink / raw)
To: gcc-bugzilla; +Cc: gcc-bugs
Sent from my iPhone
On Feb 29, 2008, at 20:05, "geoffk at geoffk dot org" <gcc-bugzilla@gcc.gnu.org
> wrote:
>
>
> ------- Comment #8 from geoffk at geoffk dot org 2008-03-01 04:05
> ----
>>
>
> It should be mangled, because there are still three different things
> named 'i' declared in this program, and so the two that have assembler
> names have to have different names, and I don't think we want to start
> mangling non-static variable names.
Also mangling non-static variables will cause an ABI change.
Thanks,
Andrew Pinski
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/31775] static object mangling conflicts with extern object
2007-05-01 18:53 [Bug c++/31775] New: " geoffk at gcc dot gnu dot org
` (6 preceding siblings ...)
2008-02-29 13:57 ` mueller at gcc dot gnu dot org
@ 2008-03-01 4:06 ` geoffk at geoffk dot org
2008-03-01 4:19 ` Andrew Pinski
2008-03-01 4:20 ` pinskia at gmail dot com
2010-01-07 7:04 ` pinskia at gcc dot gnu dot org
9 siblings, 1 reply; 13+ messages in thread
From: geoffk at geoffk dot org @ 2008-03-01 4:06 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from geoffk at geoffk dot org 2008-03-01 04:05 -------
Subject: Re: static object mangling conflicts with extern object
On 29/02/2008, at 5:57 AM, mueller at gcc dot gnu dot org wrote:
> extern "C" void abort();
> extern "C" { static int i; }
> int *p = &i;
> int main()
> {
> int i;
> {
> extern int i;
> i = 1;
> *p = 2;
> if (i == 2)
> abort ();
> }
> return 0;
> }
>
> in this case, the "i" name should not be mangled, right?
It should be mangled, because there are still three different things
named 'i' declared in this program, and so the two that have assembler
names have to have different names, and I don't think we want to start
mangling non-static variable names.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31775
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/31775] static object mangling conflicts with extern object
2007-05-01 18:53 [Bug c++/31775] New: " geoffk at gcc dot gnu dot org
` (5 preceding siblings ...)
2007-05-06 0:27 ` geoffk at gcc dot gnu dot org
@ 2008-02-29 13:57 ` mueller at gcc dot gnu dot org
2008-03-01 4:06 ` geoffk at geoffk dot org
` (2 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: mueller at gcc dot gnu dot org @ 2008-02-29 13:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from mueller at gcc dot gnu dot org 2008-02-29 13:57 -------
how about
extern "C" void abort();
extern "C" { static int i; }
int *p = &i;
int main()
{
int i;
{
extern int i;
i = 1;
*p = 2;
if (i == 2)
abort ();
}
return 0;
}
in this case, the "i" name should not be mangled, right?
--
mueller at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mueller at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31775
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/31775] static object mangling conflicts with extern object
2007-05-01 18:53 [Bug c++/31775] New: " geoffk at gcc dot gnu dot org
` (4 preceding siblings ...)
2007-05-06 0:02 ` geoffk at gcc dot gnu dot org
@ 2007-05-06 0:27 ` geoffk at gcc dot gnu dot org
2008-02-29 13:57 ` mueller at gcc dot gnu dot org
` (3 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: geoffk at gcc dot gnu dot org @ 2007-05-06 0:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from geoffk at gcc dot gnu dot org 2007-05-06 01:27 -------
That should do it.
--
geoffk at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31775
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/31775] static object mangling conflicts with extern object
2007-05-01 18:53 [Bug c++/31775] New: " geoffk at gcc dot gnu dot org
` (3 preceding siblings ...)
2007-05-02 0:46 ` geoffk at gcc dot gnu dot org
@ 2007-05-06 0:02 ` geoffk at gcc dot gnu dot org
2007-05-06 0:27 ` geoffk at gcc dot gnu dot org
` (4 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: geoffk at gcc dot gnu dot org @ 2007-05-06 0:02 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from geoffk at gcc dot gnu dot org 2007-05-06 01:01 -------
Subject: Bug 31775
Author: geoffk
Date: Sun May 6 00:01:36 2007
New Revision: 124467
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124467
Log:
Index: libiberty/ChangeLog
2007-05-04 Geoffrey Keating <geoffk@apple.com>
* cp-demangle.c (d_name): Detect local-source-name.
(d_prefix): Likewise.
(d_unqualified_name): Implement local-source-name.
Index: gcc/cp/ChangeLog
2007-05-04 Geoffrey Keating <geoffk@apple.com>
PR 31775
* mangle.c (write_mangled_name): Mangle static variable names.
(write_unqualified_name): Use local-source-name for
namespace-scope static variables.
Index: gcc/testsuite/ChangeLog
2007-05-04 Geoffrey Keating <geoffk@apple.com>
PR 31775
* g++.dg/other/nested-extern.cc: New.
* g++.dg/other/nested-extern-1.C: New.
* g++.dg/other/nested-extern-2.C: New.
Added:
trunk/gcc/testsuite/g++.dg/other/nested-extern-1.C
trunk/gcc/testsuite/g++.dg/other/nested-extern-2.C
trunk/gcc/testsuite/g++.dg/other/nested-extern.cc
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/mangle.c
trunk/gcc/testsuite/ChangeLog
trunk/libiberty/ChangeLog
trunk/libiberty/cp-demangle.c
trunk/libiberty/testsuite/demangle-expected
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31775
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/31775] static object mangling conflicts with extern object
2007-05-01 18:53 [Bug c++/31775] New: " geoffk at gcc dot gnu dot org
` (2 preceding siblings ...)
2007-05-01 23:54 ` geoffk at gcc dot gnu dot org
@ 2007-05-02 0:46 ` geoffk at gcc dot gnu dot org
2007-05-06 0:02 ` geoffk at gcc dot gnu dot org
` (5 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: geoffk at gcc dot gnu dot org @ 2007-05-02 0:46 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from geoffk at gcc dot gnu dot org 2007-05-02 01:46 -------
I just happen to have a patch which fixes this.
--
geoffk at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |geoffk at gcc dot gnu dot
|dot org |org
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2007-05-02 01:46:13
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31775
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/31775] static object mangling conflicts with extern object
2007-05-01 18:53 [Bug c++/31775] New: " geoffk at gcc dot gnu dot org
2007-05-01 18:56 ` [Bug c++/31775] " geoffk at gcc dot gnu dot org
2007-05-01 19:44 ` rguenth at gcc dot gnu dot org
@ 2007-05-01 23:54 ` geoffk at gcc dot gnu dot org
2007-05-02 0:46 ` geoffk at gcc dot gnu dot org
` (6 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: geoffk at gcc dot gnu dot org @ 2007-05-01 23:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from geoffk at gcc dot gnu dot org 2007-05-02 00:54 -------
You would add a translation unit that says
int i;
or similar. It's not "main::i", it's "::i", because of [basic.link] paragraph
7:
When a block scope declaration of an entity with linkage is not found to refer
to some other declaration,
then that entity is a member of the innermost enclosing namespace.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31775
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/31775] static object mangling conflicts with extern object
2007-05-01 18:53 [Bug c++/31775] New: " geoffk at gcc dot gnu dot org
2007-05-01 18:56 ` [Bug c++/31775] " geoffk at gcc dot gnu dot org
@ 2007-05-01 19:44 ` rguenth at gcc dot gnu dot org
2007-05-01 23:54 ` geoffk at gcc dot gnu dot org
` (7 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-05-01 19:44 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from rguenth at gcc dot gnu dot org 2007-05-01 20:44 -------
How do you define main"::"i? That is, how'd you make the testcase work from a
second translation unit if it would fail now?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31775
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/31775] static object mangling conflicts with extern object
2007-05-01 18:53 [Bug c++/31775] New: " geoffk at gcc dot gnu dot org
@ 2007-05-01 18:56 ` geoffk at gcc dot gnu dot org
2007-05-01 19:44 ` rguenth at gcc dot gnu dot org
` (8 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: geoffk at gcc dot gnu dot org @ 2007-05-01 18:56 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from geoffk at gcc dot gnu dot org 2007-05-01 19:56 -------
This testcase is the same principle, but might use a different code path in the
compiler:
extern "C" void abort();
extern int *p;
int main()
{
extern int i;
i = 1;
*p = 2;
if (i == 2)
abort ();
return 0;
}
static int i;
int *p = &i;
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31775
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2020-10-07 14:35 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-31775-4@http.gcc.gnu.org/bugzilla/>
2020-10-06 11:41 ` [Bug c++/31775] static object mangling conflicts with extern object nathan at gcc dot gnu.org
2020-10-07 14:35 ` nathan at gcc dot gnu.org
2007-05-01 18:53 [Bug c++/31775] New: " geoffk at gcc dot gnu dot org
2007-05-01 18:56 ` [Bug c++/31775] " geoffk at gcc dot gnu dot org
2007-05-01 19:44 ` rguenth at gcc dot gnu dot org
2007-05-01 23:54 ` geoffk at gcc dot gnu dot org
2007-05-02 0:46 ` geoffk at gcc dot gnu dot org
2007-05-06 0:02 ` geoffk at gcc dot gnu dot org
2007-05-06 0:27 ` geoffk at gcc dot gnu dot org
2008-02-29 13:57 ` mueller at gcc dot gnu dot org
2008-03-01 4:06 ` geoffk at geoffk dot org
2008-03-01 4:19 ` Andrew Pinski
2008-03-01 4:20 ` pinskia at gmail dot com
2010-01-07 7:04 ` 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).