<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Missing CFI directive after func epilogue and before ret"
   href="https://llvm.org/bugs/show_bug.cgi?id=25916">25916</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Missing CFI directive after func epilogue and before ret
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>DebugInfo
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>wmi@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=15508" name="attach_15508" title="testcase">attachment 15508</a> <a href="attachment.cgi?id=15508&action=edit" title="testcase">[details]</a></span>
testcase

Using the most recent clang (r255910)

clang  -fsanitize=address ill.cc
ASAN_OPTIONS=handle_sigill=1:fast_unwind_on_fatal=0  ./a.out

It will catch a SIGILL signal (correct behavior) and then catch SIGSEGV:
Program received signal SIGSEGV, Segmentation fault.
_Unwind_GetGR (index=16, context=0x7ffff7fe5ef0) at
../../../libgcc/unwind-dw2.c:244
244     ../../../libgcc/unwind-dw2.c: No such file or directory.
(gdb) bt
#0  _Unwind_GetGR (index=16, context=0x7ffff7fe5ef0) at
../../../libgcc/unwind-dw2.c:244
#1  _Unwind_GetPtr (index=16, context=0x7ffff7fe5ef0) at
../../../libgcc/unwind-dw2.c:255
#2  uw_update_context (context=context@entry=0x7ffff7fe5ef0,
fs=fs@entry=0x7ffff7fe5fe0) at ../../../libgcc/unwind-dw2.c:1523
#3  0x00007ffff72a3e3e in _Unwind_Backtrace (trace=0x4d14d0 <Unwind_Trace()>,
trace_argument=0x7ffff7fe61a0) at ../../../libgcc/unwind.inc:303
#4  0x00000000004d16ec in SlowUnwindStack

Assembly:
~/workarea/llvm-r255910/dbuild/bin/clang -fsanitize=address ill.cc -S
main:                                   # @main
        .cfi_startproc
# BB#0:                                 # %entry
        pushq   %rbp
.Ltmp3:
        .cfi_def_cfa_offset 16
.Ltmp4:
        .cfi_offset %rbp, -16
        movq    %rsp, %rbp
.Ltmp5:
        .cfi_def_cfa_register %rbp
        subq    $16, %rsp
        movabsq $_Z5deathv, %rax
        movl    %edi, -4(%rbp)
        movq    %rsi, -16(%rbp)
        movq    %rax, %rdi
        callq   __sanitizer_set_death_callback
        callq   __asan_handle_no_return
        xorl    %eax, %eax
        addq    $16, %rsp
        popq    %rbp         // After this instruction, cfa register should be
changed to rsp again. ".cfi_def_cfa 7, 8" should be inserted after the
instruction.
        ud2
        retq
.Lfunc_end1:
        .size   main, .Lfunc_end1-main
        .cfi_endproc

If ".cfi_def_cfa 7, 8" is added before ud2 manually, the SEGV will be gone.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>