From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30239 invoked by alias); 30 Aug 2012 01:10:22 -0000 Received: (qmail 30225 invoked by uid 22791); 30 Aug 2012 01:10:21 -0000 X-SWARE-Spam-Status: No, hits=-3.5 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_AV 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; Thu, 30 Aug 2012 01:10:08 +0000 From: "rcopley at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/54412] New: Request for 32-byte stack alignment with -mavx on Windows Date: Thu, 30 Aug 2012 01:10:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rcopley at gmail 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-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-08/txt/msg01954.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54412 Bug #: 54412 Summary: Request for 32-byte stack alignment with -mavx on Windows Classification: Unclassified Product: gcc Version: 4.7.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned@gcc.gnu.org ReportedBy: rcopley@gmail.com Created attachment 28103 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28103 Self-contained C source, with AVX alignment bug on Windows Code generated by GCC 4.7.1 for the Windows x86_64-w64-mingw32 target, with "-mavx", can segfault due to alignment errors when the 32-byte ymm registers are spilled onto the stack. May I please submit a feature request for 32-byte stack alignment on this target where necessary? Compiled for Windows with "gcc -O0 -m64 -mavx bug.c" using GCC 4.7.1 with the MingGW W64 toolchain, the attached program segfaults. Specifically, it uses vmovapd to copy the value of %ymm0 to a location on the stack before calling f(), but doesn't align the location to 32 bytes as required by that instruction. In contrast, the generated code for Linux (using GCC 4.6.3 from Ubuntu) does explicitly align the stack to 32 bytes. The lack of stack alignment on Windows has been noted before; see for example http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49001 and http://stackoverflow.com/questions/5983389.