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

--- Comment #4 from rguenther at suse dot de <rguenther at suse dot de> 
2011-03-16 09:40:35 UTC ---
On Tue, 15 Mar 2011, d.g.gorbachev at gmail dot com wrote:

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48127
> 
> --- Comment #3 from Dmitry Gorbachev <d.g.gorbachev at gmail dot com> 
> 2011-03-15 18:00:23 UTC ---
> I do not agree that the testcase is invalid. As the standart says:
> 
>   Common extensions
> 
>   Multiple external definitions
> 
>      There may be more than one external definition for the identifier of
>   an object, with or without the explicit use of the keyword extern; if
>   the definitions disagree, or more than one is initialized, the behavior
>   is undefined.
> 
> According to the Binutils documentation,
> 
>   The linker turns a common symbol into a declaration, if there is a
>   definition of the same variable.
> 
> Also, from Ian Lance Taylor's article [1]:
> 
>   5. If A is a strong definition in an object file:
> 
>     * If B is a common symbol, then we treat B as an undefined reference.
> 
> I think it would be better to fix this problem in the linker. Gold does not
> even warn about it!
> 
> However, I don't understand why GCC makes baz[8] to have 32 bytes alignment,
> while baz[4] has only 4 bytes alignment. It seems to be a GCC bug.

It's an optimization to ensure accesses larger than 4 do not cross
cacheline boundaries.

Richard.

Reply via email to