Calling function containing defer during an interrupt handler function causes a panic
Author: waj334Created Oct 10, 2022Updated Oct 1, 2026
Labelsenhancement
var globalTestCrash testCrash
type testCrash struct {
}
func (t testCrash) test() {
defer t.test2()
}
func (t testCrash) test2() {
}
func irqHandler(irq machine.Pin) {
println("******************************************** ISR")
globalTestCrash.test()
}Above I have a basic interrupt handler set up that will panic once test() is called:
******************************************** ISR
panic: runtime error: nil pointer dereference>tinygo version
tinygo version 0.25.0 windows/amd64 (using go version go1.19 and LLVM version 14.0.0)Source: tinygo-org/tinygo