incorrect control-flow when indirect call raises with `--panics:on`
saem opened this issue · comments
Specification
Indirect calls with procedural values that don't have an explicit exception specification are treated as not raising an exception, when --panics:on
, resulting in improper control-flow.
Example
# build with `--panics:on`
type Proc = proc () {.nimcall.}
proc test(x: Proc) =
try:
x()
except CatchableError:
echo "caught"
test(proc() =
raise CatchableError.newException("")
)
Actual Output
Error: unhandled exception: [CatchableError]
Expected Output
caught
Additional Information
- reduced from this insideout branch's test
- with the following workaround, the aforementioned insideout test succeeded
Once we learn a bit more edit this issue so it's a bit easier to understand/search for later.
From disruptek
I looked at the codegen earlier and it feels like a mir bug wherein a goto is missing in the simple case. you still need to have a call in there though.
I've reduced the bug, updated the issue accordingly, and am now working on a fix.
@disruptek can you confirm the latest nimskull fixes this for you?
74 works, thanks.