From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21336 invoked by alias); 15 Oct 2014 22:35:56 -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 21000 invoked by uid 48); 15 Oct 2014 22:35:50 -0000 From: "congh at google dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/63530] GCC generates incorrect aligned store on ARM after the loop is unrolled. Date: Wed, 15 Oct 2014 22:35: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-Version: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: congh at google dot com 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: Message-ID: In-Reply-To: References: 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: 2014-10/txt/msg01201.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63530 --- Comment #2 from Cong Hou --- This issue can also be reproduced on x86_64. Compile the following code with options (assume the file name is t.c): -O2 -ftree-vectorize t.c -fdump-tree-all-alias #include typedef struct { unsigned char map[256]; int i; } A, *AP; AP foo(int n) { AP b = malloc(sizeof(A)); int i; for (i = n; i < 256; i++) b->map[i] = i; return b; } The from t.c.116t.vect we can find such a statement: # ALIGN = 8, MISALIGN = 0 vectp_b.15_47 = b_5 + _48; Here b_5 is obtained from malloc which can be 8 bytes aligned, but _48 is from input parameter n, and the alignment of vectp_b.15_47 should be unknown instead of 8 here. I suspect the ptr_info_def object of vectp_b.15_47 is just copied from that of b_5, which is incorrect.