[Bug c/13134] [3.4 regression] Visibility attribute is ignored

geoffk at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Nov 24 22:08:00 GMT 2003


------- Additional Comments From geoffk at gcc dot gnu dot org  2003-11-24 22:08 -------
I think Bryan's testcase,

int i __attribute__((visibility ("hidden")));
int i __attribute__((visibility ("default"))) = 5;

should be an error.  Between the declarations, GCC will generate code based on the assumption 
that 'i' is defined in this shared object, which will be wrong.

ISO C makes similar constructs undefined behaviour for exactly this reason:

> If, within a translation unit, the same identifier appears with both internal and external linkage, 
the behavior is undefined. 

-- 


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



More information about the Gcc-bugs mailing list