Stream: cranelift

Topic: Cryptic error when implementing control flow


view this post on Zulip Cregg (May 02 2024 at 21:06):

I was trying to implement if expressions in my simple programming language and am encountering an error that seems cryptic to me. I tried writing the code myself and when I encountered this error I tried using the exact code from the jit demo for if expression but the exact same issue persisted. Here's the error "called Result::unwrap() on an Err value: Compilation(Verifier(VerifierErrors([VerifierError { location: block0, context: None, message: "cfg lacked the following successor(s) [block1, block2]" }, VerifierError { location: block1, cont
ext: None, message: "cfg lacked the following successor(s) [block1, block2, block3]" }, VerifierError { location: block2, context: None, message: "cfg lacked the following successor(s) [block1, block2, block3]" }, VerifierError { location
: block3, context: None, message: "cfg lacked the following successor(s) [block1, block2, block3]" }])))". Can anyone provide an explanation or at least point me in the right direction to solve this issue? I'm happy to provide any more information that would be helpful.

view this post on Zulip bjorn3 (May 03 2024 at 10:07):

The cfg passed to the verifier is incorrect. Are you reusing a Context between multiple functions? If so make sure to .clear() it between compiling a function to machine code and creating clif ir for the next function.

view this post on Zulip bjorn3 (May 03 2024 at 10:08):

Otherwise, can you show your code?


Last updated: Nov 22 2024 at 16:03 UTC