[llvm-bugs] [Bug 34038] New: program crashes at movaps, unaligned stack address, -O3

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Aug 2 17:49:10 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=34038

            Bug ID: 34038
           Summary: program crashes at movaps, unaligned stack address,
                    -O3
           Product: libraries
           Version: 4.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: eric at youngblut.net
                CC: llvm-bugs at lists.llvm.org

Created attachment 18898
  --> https://bugs.llvm.org/attachment.cgi?id=18898&action=edit
C program for repro

ericy at mrpink:~$ /usr/bin/clang --version
clang version 4.0.0-1ubuntu1 (tags/RELEASE_400/rc1)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

ericy at mrpink:~$ /usr/bin/clang -O3 movaps_unaligned_crash.c  && ./a.out 
Segmentation fault

It does not repro with -O2.

You can see that it used the movaps instruction with an unaligned address.

(gdb) disassemble 
Dump of assembler code for function main:
   0x0000000000400490 <+0>:     sub    $0x28,%rsp
   0x0000000000400494 <+4>:     movq   $0x0,0x20(%rsp)
   0x000000000040049d <+13>:    movq   $0x0,0x18(%rsp)
   0x00000000004004a6 <+22>:    mov    0x200b7b(%rip),%rax        # 0x601028
<obj>
=> 0x00000000004004ad <+29>:    movaps 0x18(%rsp),%xmm0
   0x00000000004004b2 <+34>:    movaps %xmm0,(%rsp)
   0x00000000004004b6 <+38>:    mov    $0x601028,%edi
   0x00000000004004bb <+43>:    xor    %esi,%esi
   0x00000000004004bd <+45>:    xor    %edx,%edx
   0x00000000004004bf <+47>:    xor    %ecx,%ecx
   0x00000000004004c1 <+49>:    xor    %r8d,%r8d
   0x00000000004004c4 <+52>:    callq  *(%rax)
   0x00000000004004c6 <+54>:    xor    %eax,%eax
   0x00000000004004c8 <+56>:    add    $0x28,%rsp
   0x00000000004004cc <+60>:    retq   
End of assembler dump.
(gdb) p $rsp
$1 = (void *) 0x7fffffffdf50

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170803/2aecdc03/attachment-0001.html>


More information about the llvm-bugs mailing list