From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30717 invoked by alias); 13 Mar 2012 17:09:49 -0000 Received: (qmail 30708 invoked by uid 22791); 13 Mar 2012 17:09:48 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 13 Mar 2012 17:09:36 +0000 From: "ian at airs dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/52571] vectorizer changes alignment of common symbols Date: Tue, 13 Mar 2012 17:12:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ian at airs dot com X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-03/txt/msg01183.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52571 --- Comment #3 from Ian Lance Taylor 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.