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

            Bug ID: 86386
           Summary: [8/9 Regression] unaligned load from stack with -Os
                    -fno-tree-dce -mstringop-strategy=vector_loop
                    -mavx512bw
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu

Created attachment 44346
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44346&action=edit
reduced testcase

I am not 100% sure the testcase has defined behavior (due to the cast to
char*), but there are no compilation warning and -fsanitize=undefined does not
give any error.

Output:
$ x86_64-pc-linux-gnu-gcc -Os -fno-tree-dce -mstringop-strategy=vector_loop
-mavx512bw testcase.c
$ ./a.out 
Segmentation fault


Program received signal SIGSEGV, Segmentation fault.
0x0000000000400529 in a (g=g@entry=0 '\000', h=h@entry=0, i=i@entry=0,
j=j@entry=0, k=k@entry=0 '\000', l=l@entry=4, m=1, n=<optimized out>) at
testcase.c:14
14        __builtin_memcpy (&m, 2 + (char *) &n, 1);


   0x000000000040051f <+61>:    mov    -0x8(%rsp),%rcx
   0x0000000000400524 <+66>:    mov    %rax,-0x10(%rsp)
=> 0x0000000000400529 <+71>:    vmovdqa -0x10(%rsp),%xmm0
   0x000000000040052f <+77>:    mov    -0x10(%rsp),%rax
   0x0000000000400534 <+82>:    vpextrb $0x2,%xmm0,0x10(%rbp)

(gdb) p $rsp
$1 = (void *) 0x7fffffffd648


$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-262329-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/9.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--disable-bootstrap --with-cloog --with-ppl --with-isl
--build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-262329-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
gcc version 9.0.0 20180703 (experimental) (GCC)

Reply via email to