[clang] Unreachable when -fwinx64-eh-unwindv2 is used on function with __finally block
Open
backend:X86
clang-cl
platform:windows
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Steps to reproduce:
1) Create source file a.c
```
int bar();
void do_finalize();
int foo() {
__try {
while(1) {
if (bar() == 42)
break;
}
} __finally {
do_finalize();
}
return 42;
}
```
2. Compile with clang
```
clang-cl.exe -cc1 -triple x86_64-pc-windows-msvc19.50.35730 -emit-obj -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -fwinx64-eh-unwindv2 -cfguard -fms-extensions -o a.obj -x c a.c
```
Unreachable is fired in `X86WinEHUnwindV2::runOnMachineFunction`, because it's expecting `frame SEH_PushReg` to be in prolog, not in finally block
Contributor guide
Assessment
This issue has not been assessed yet.