[llvm-bugs] [Bug 35056] [ms] Broken codegen around SEH and __declspec(naked) inline asm

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 24 05:11:32 PDT 2017


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

Nico Weber <nicolasweber at gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

--- Comment #2 from Nico Weber <nicolasweber at gmx.de> ---
Yes, works like so:

C:\src\chrome\src>type foo.cc
#include <windows.h>

__declspec(naked)
bool SafeTerminateProcess(HANDLE process, UINT exit_code) {
  __asm {
    push ebp
    mov ebp, esp
    push [ebp+12]
    push [ebp+8]
    call TerminateProcess
    test eax, eax
    setne al
    mov esp, ebp
    pop ebp
    ret
  }
}

void g() {
  volatile int*  p = 0;
  *p = 4;
}

int main() {
  __try {
    g();
  } __except(1) {
    TerminateProcess(GetCurrentProcess(), 1);
  }
}



That's not it.

-- 
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/20171024/51e083fe/attachment.html>


More information about the llvm-bugs mailing list