This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/31775] static object mangling conflicts with extern object
- From: "geoffk at geoffk dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Mar 2008 04:05:35 -0000
- Subject: [Bug c++/31775] static object mangling conflicts with extern object
- References: <bug-31775-638@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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