[Bug tree-optimization/52571] vectorizer changes alignment of common symbols

ian at airs dot com gcc-bugzilla@gcc.gnu.org
Tue Mar 13 17:12:00 GMT 2012


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

--- Comment #3 from Ian Lance Taylor <ian at airs dot com> 2012-03-13 15:48:36 UTC ---
I agree: if the symbol is always common, the linker should use the largest
alignment.  But the symbol need not always be common.  Consider one file with
"unsigned long int *p;" and another file with "unsigned long int *p = &i;". 
That is a valid use of common symbols.  But now gcc might mark the common
symbol as having an alignment of 16, while leaving the definition with an
alignment of 8.  The rules of common symbol linking mean that the definition
will override the common symbol.  But the definition might have an alignment of
8, and it might not be possible for the linker to fix that--and in any case,
the linker won't even try.

In other words, common symbols are special.  You can't assume that anything you
change about them will stick, because they might become, in effect, an
undefined symbol.  I suspect that vect_can_force_dr_alignment_p should be
checking DECL_COMMON for exactly the reasons that it checks DECL_EXTERNAL.



More information about the Gcc-bugs mailing list