Issue 176421
Summary [WinEH] Incorrect block label reference in unwind table
Labels backend:AArch64, miscompilation, platform:windows
Assignees
Reporter nikic
    ```llvm
target triple = "aarch64-pc-windows-msvc"

declare void @func()

define void @test(ptr %p) personality ptr @__CxxFrameHandler3 {
  %v0 = load i32, ptr %p
  %v1 = load i32, ptr %p
  %xor = xor i32 %v0, %v1
  %cmp = icmp eq i32 %xor, 0
  br i1 %cmp, label %exit, label %bb

bb:
  invoke void @func()
 to label %unreachable unwind label %unwind

unreachable:
 unreachable

unwind:
  %cp = cleanuppad within none []
  store volatile i32 0, ptr %p
  cleanupret from %cp unwind to caller

exit:
  ret void
}

declare i32 @__CxxFrameHandler3(...)
```
Produces something like this:
```
$stateUnwindMap$test:
	.word	-1 // ToState
	.word	"?dtor$-1@?0?test@4HA"@IMGREL   // Action
```
Note the `?dtor$-1` referring to an unnumbered MBB. This ultimately causes linker errors.

Only observed on AArch64 Windows.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to