Skip to content

Calling function containing defer during an interrupt handler function causes a panic #3225

@waj334

Description

@waj334
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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions