public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/53485] New: gcc -O -mavx generates illegal instruction on win64
@ 2012-05-25 15:14 ian at nasoftware dot co.uk
  2012-05-25 15:54 ` [Bug c/53485] " hjl.tools at gmail dot com
  2021-07-17 20:04 ` [Bug target/53485] " pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: ian at nasoftware dot co.uk @ 2012-05-25 15:14 UTC (permalink / raw)
  To: gcc-bugs

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 <fun1+54>:  vmovaps 0x7b11(%rip),%ymm0        # 0x409100
(gdb) p $rip
$1 = (void (*)()) 0x4015e7 <fun1+54>
(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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c/53485] gcc -O -mavx generates illegal instruction on win64
  2012-05-25 15:14 [Bug c/53485] New: gcc -O -mavx generates illegal instruction on win64 ian at nasoftware dot co.uk
@ 2012-05-25 15:54 ` hjl.tools at gmail dot com
  2021-07-17 20:04 ` [Bug target/53485] " pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: hjl.tools at gmail dot com @ 2012-05-25 15:54 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53485

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl.tools at gmail dot com

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> 2012-05-25 15:49:05 UTC ---
(In reply to comment #0)
> Created attachment 27495 [details]
> 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 <fun1+54>:  vmovaps 0x7b11(%rip),%ymm0        # 0x409100
> (gdb) p $rip
> $1 = (void (*)()) 0x4015e7 <fun1+54>
> (gdb) info frame
> Stack level 0, frame at 0x22fe40:
>  rip = 0x4015e7 in fun1 (bug.c:95); saved rip 0x40171b

It looks like 0x7b11(%rip) isn't aligned to 16 byte.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/53485] gcc -O -mavx generates illegal instruction on win64
  2012-05-25 15:14 [Bug c/53485] New: gcc -O -mavx generates illegal instruction on win64 ian at nasoftware dot co.uk
  2012-05-25 15:54 ` [Bug c/53485] " hjl.tools at gmail dot com
@ 2021-07-17 20:04 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-17 20:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53485

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|WAITING                     |RESOLVED

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
No feedback in over 4 years so closing as invalid.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-17 20:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-25 15:14 [Bug c/53485] New: gcc -O -mavx generates illegal instruction on win64 ian at nasoftware dot co.uk
2012-05-25 15:54 ` [Bug c/53485] " hjl.tools at gmail dot com
2021-07-17 20:04 ` [Bug target/53485] " pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).