Control: tags -1 + upstream

Hello Claude Heiland-Allen,
I tried just to collect some more information for the maintainer.

The issue could be reproduced in a qemu VM
with '-cpu host' on a Ryzen 7 1700.

The resulting binary crashes on Windows at the same instruction,
so I guess Wine can be ruled out.

It seems that the vmovapd instruction expects a 32-byte aligned 
value in register $rcx. Unfortunately it is just 16-byte aligned
and therefore the SIGSEGV.
This could be confirmed by setting a breakpoint to that instruction
and set $rcx to the next aligned value below, then the vmovapd
could be executed.

I think following upstream reports and messages are releated,
mostly 54412. There are also some workarounds mentioned.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49001
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54412
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61730
https://sourceforge.net/p/mingw-w64/mailman/message/36287627/

Kind regards,
Bernhard



$ wine winedbg --gdb a.exe 4
...
Wine-gdb> cont
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x000000000040166d in ?? ()
Wine-gdb> bt
#0  0x000000000040166d in ?? ()
#1  0x00000000004031a8 in ?? ()
#2  0x0000000000000000 in ?? ()
Wine-gdb> print/x $rcx
$1 = 0x33fa10
Wine-gdb> print/x $rcx % 32
$2 = 0x10
Wine-gdb> print/x $rcx % 16
$3 = 0x0



$ x86_64-w64-mingw32-objdump --disassemble a.exe
...
0000000000401665 <_Z9broadcastIDv4_ddET_T0_>:
  401665:       c4 e2 7d 19 c9          vbroadcastsd %xmm1,%ymm1
  40166a:       48 89 c8                mov    %rcx,%rax
  40166d:       c5 fd 29 09             vmovapd %ymm1,(%rcx)
  401671:       c5 f8 77                vzeroupper 
  401674:       c3                      retq   
...
0000000000402e90 <main>:
...
  40319b:       48 8d 8c 24 e0 00 00    lea    0xe0(%rsp),%rcx
  4031a2:       00 
  4031a3:       e8 bd e4 ff ff          callq  401665 
<_Z9broadcastIDv4_ddET_T0_>
  4031a8:       c5 fd 28 94 24 e0 00    vmovapd 0xe0(%rsp),%ymm2
...



That function _Z9broadcastIDv4_ddET_T0_ should unmangled look like:
    double __vector(4) broadcast<double __vector(4), double>(double)
That should be line 53:
    51 template <>
    52 __attribute__ ((noinline))
    53 double4  broadcast<double4 ,double>(double x) { double4 r = { x, x, x, x 
}; return r; }

Reply via email to