This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/31775] static object mangling conflicts with extern object



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]