From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13321 invoked by alias); 25 May 2012 15:09:35 -0000 Received: (qmail 13309 invoked by uid 22791); 25 May 2012 15:09:34 -0000 X-SWARE-Spam-Status: No, hits=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_AV,TW_CX,TW_DC,TW_RB 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; Fri, 25 May 2012 15:09:20 +0000 From: "ian at nasoftware dot co.uk" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/53485] New: gcc -O -mavx generates illegal instruction on win64 Date: Fri, 25 May 2012 15:14:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ian at nasoftware dot co.uk 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-05/txt/msg02480.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53485 Bug #: 53485 Summary: gcc -O -mavx generates illegal instruction on win64 Classification: Unclassified Product: gcc Version: 4.6.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned@gcc.gnu.org ReportedBy: ian@nasoftware.co.uk Created attachment 27495 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27495 preprocessed source Compiling the attached program with optimization and AVX for Win64 generates an illegal instruction. The same code runs correctly on Win32 and on Linux64. $ x86_64-w64-mingw32-gcc -m64 -mavx bug.c -O -g -o bug.exe -Wall -Wextra -save-temps $ ./bug.exe BUG PROGRAM START: We should get this message once. DEBUG fun1 start... Illegal instruction $ gdb bug.exe (gdb) r Starting program: C:\cygwin\home\nas/bug.exe [New Thread 2436.0x38c] BUG PROGRAM START: We should get this message once. DEBUG fun1 start... Program received signal SIGILL, Illegal instruction. fun1 () at bug.c:95 95 v1 = vfone; (gdb) x/i $pc => 0x4015e7 : vmovaps 0x7b11(%rip),%ymm0 # 0x409100 (gdb) p $rip $1 = (void (*)()) 0x4015e7 (gdb) info frame Stack level 0, frame at 0x22fe40: rip = 0x4015e7 in fun1 (bug.c:95); saved rip 0x40171b called by frame at 0x22fe70 source language c. Arglist at 0x22fe30, args: Locals at 0x22fe30, Previous frame's sp is 0x22fe40 Saved registers: rbx at 0x22fe20, rsi at 0x22fe28, rbp at 0x22fe30, rip at 0x22fe38, xmm15 at 0x22fe38 $ x86_64-w64-mingw32-gcc -v Using built-in specs. COLLECT_GCC=C:\cygwin\home\nas\mingw64\bin\x86_64-w64-mingw32-gcc.exe COLLECT_LTO_WRAPPER=c:/cygwin/home/nas/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/4.6.3/lto-wrapper.exe Target: x86_64-w64-mingw32 Configured with: /home/drangon/work/mingw-w64-dgn/source/gcc/configure --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --disable-nls --enable-languages=c,c++,objc,obj-c++ --with-gmp=/home/drangon/work/mingw-w64-dgn/build/for_target --enable-twoprocess --disable-libstdcxx-pch --disable-win32-registry --prefix=/home/drangon/work/mingw-w64-dgn/target --with-sysroot=/home/drangon/work/mingw-w64-dgn/target Thread model: win32 gcc version 4.6.3 20120225 (prerelease) (GCC) I have also tried the mingw64 cross compiler from http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Automated%20Builds/ gcc version 4.8.0 20120509 (experimental) (GCC) and I get the same error (though I need to use -O3) If I download an older version, gcc version 4.5.4 20111030 (prerelease) [svn/rev.180676 - mingw-w64/oz] (GCC) then I don't get the illegal instruction.