From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25583 invoked by alias); 4 Mar 2015 11:28:20 -0000 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 Received: (qmail 25028 invoked by uid 48); 4 Mar 2015 11:28:17 -0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/65310] New: vectorizer uses wrong alignment Date: Wed, 04 Mar 2015 11:28:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-03/txt/msg00461.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65310 Bug ID: 65310 Summary: vectorizer uses wrong alignment Product: gcc Version: 5.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: rguenth at gcc dot gnu.org Noticed by Jan Hubicka in PR65270: Hi, while looking for a testcase that would trigger with tree-tail-merge (because gimple-fold seems to also miss MEM_REF merging) I noticed following oddity: struct a { int a[100000]; }; typedef struct a b __attribute__ ((aligned (32))); typedef struct a c __attribute__ ((aligned (8))); typedef struct a d __attribute__ ((aligned (32))); __attribute__ ((used)) t(b *a, int aligned, b *d) { int i,v; c *ptr = a; for (i=0;i<100000;i++) { ptr->a[i]++; } } main() { } here the loop gets vectorized with assumed alignmen 32. Changing declaretion to: t(c *a, int aligned, b *d) produces correct 8 byte alignment loop. Alignment of the type of variable A shall not be used.