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

--- Comment #3 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Uroš Bizjak from comment #1)
> Also fails with "-mtune=znver1 -mavx":
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x00000000004048ef in func_21 (p_22=0x41b330 <g_277>, p_23=0, p_24=8) at
> runData/keep/in.11.c:597
> 597     in runData/keep/in.11.c
> (gdb) disass $pc-10, $pc+10
> Dump of assembler code from 0x4048e5 to 0x4048f9:
>    0x00000000004048e5 <func_21+8160>:   mov    (%rax),%rdx
>    0x00000000004048e8 <func_21+8163>:   mov    -0x1378(%rbp),%rax
> => 0x00000000004048ef <func_21+8170>:   vmovdqa (%rdx),%ymm0
>    0x00000000004048f3 <func_21+8174>:   vmovdqa %ymm0,(%rax)
>    0x00000000004048f7 <func_21+8178>:   vmovdqa 0x20(%rdx),%ymm0
> End of assembler dump.
> (gdb) p/x $rdx
> $3 = 0x41a824
> 
> Unaligned access.

After some more analysis, the above *IS* unaligned access. At the end of
func_21, we have:

=> 0x00000000004048ef <+8170>:  vmovdqa (%rdx),%ymm0
   0x00000000004048f3 <+8174>:  vmovdqa %ymm0,(%rax)
   0x00000000004048f7 <+8178>:  vmovdqa 0x20(%rdx),%ymm0
   0x00000000004048fc <+8183>:  vmovdqa %ymm0,0x20(%rax)
   0x0000000000404901 <+8188>:  vmovdqa 0x40(%rdx),%ymm0
   0x0000000000404906 <+8193>:  vmovdqa %ymm0,0x40(%rax)
   0x000000000040490b <+8198>:  vmovdqa 0x60(%rdx),%ymm0
   0x0000000000404910 <+8203>:  vmovdqa %ymm0,0x60(%rax)

which looks like a memory copy to me. Unfortunately, the address is unaligned:

(gdb) p/x $rdx
$2 = 0x41a824

Changing the above vmovdqa insns to vmovdqu results in a successful run.

Reply via email to