From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20438 invoked by alias); 13 Mar 2012 01:20:04 -0000 Received: (qmail 20425 invoked by uid 22791); 13 Mar 2012 01:20:03 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_DQ,TW_VD 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 01:19:50 +0000 From: "doko at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/52574] New: [4.6 Regression] gcc tree optimizer generates incorrect vector load instructions for x86_64, app crashes Date: Tue, 13 Mar 2012 01:20: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-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: doko 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-Changed-Fields: Message-ID: 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/msg00942.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52574 Bug #: 52574 Summary: [4.6 Regression] gcc tree optimizer generates incorrect vector load instructions for x86_64, app crashes Classification: Unclassified Product: gcc Version: 4.6.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned@gcc.gnu.org ReportedBy: doko@gcc.gnu.org [forwarded from http://bugs.debian.org/663654] The following versions of gcc: Debian gcc-4.6.3-1, Debain gcc-4.4.6-14, Debian gcc-4.6.2-14, Debian gcc-4.4.6-15, Ubuntu 4.4.3-4ubuntu5 generates *wrong* code - aligned vector loads instead of unaligned vector loads for x86_64 arch. This causes the compiled code to crash with SIGSEGV(General Protection Fault). Bug *not* present on trunk and gcc-4.5.3-12. Consider the following program: void foo(int* __restrict ia, int n){ int i; for(i=0;i) But x86_64 SSE has two kinds of vector instructions - aligned vector move (movdqa) - unaligned vector move (movdqu) Use of aligned vector move with an unaligned vector address, will trigger the application to crash. When compiled with any of the following command lines: gcc -O3 foo.c g++ -O3 foo.c gcc -m64 -O2 -ftree-vectorize gcc_bug.c g++ -m64 -O2 -ftree-vectorize gcc_bug.c gcc generates an aligned vector load movdqa -54(%rsp,%rax), %xmm0 instead of unaligned vector load - movdqu. This result in above application to crash with SIGSEGV(General Protection Fault). gcc-4.7 correctly generates movdqu -54(%rsp), %xmm0