This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/52571] vectorizer changes alignment of common symbols
- From: "rguenther at suse dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 14 Mar 2012 09:35:12 +0000
- Subject: [Bug tree-optimization/52571] vectorizer changes alignment of common symbols
- Auto-submitted: auto-generated
- References: <bug-52571-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52571
--- Comment #4 from rguenther at suse dot de <rguenther at suse dot de> 2012-03-14 09:35:12 UTC ---
On Tue, 13 Mar 2012, ian at airs dot com wrote:
> 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.
Ok, thanks for the clarification, I'll produce a patch.
Richard.