Stream: cranelift

Topic: Understanding variable visibility within blocks


view this post on Zulip Joseph Johnston (Apr 16 2025 at 15:34):

Must all variables accessed within a block be declared in that block or passed as arguments to the block, or are variables declared in dominating blocks also directly accessible? (Reading codegen/src/verifier/mod.rs I think it's the latter, but ChatGPT insists on the former)

view this post on Zulip bjorn3 (Apr 16 2025 at 15:38):

or are variables declared in dominating blocks also directly accessible?

Yes. And I believe if there is no dominating block we even currently generate an iconst 0 as definition, not that I think that is all that great of an idea.

view this post on Zulip Chris Fallin (Apr 16 2025 at 17:19):

but ChatGPT insists on the former

Repeating what I've had to unfortunately say elsewhere at an increasing frequency: PLEASE do not rely on AI tools to answer questions about Cranelift. As demonstrated here, and elsewhere, they often/usually hallucinate completely incorrect details and mislead, creating more work for us in the long run. Compiler work as a field requires careful precision and is profoundly unsuited for any assistance from any sort of AI that exists at the moment. Please assume the tools will make up incorrect information and grossly mislead you (because they will -- their entire purpose is to produce text that "sounds right" with no further grounding) and avoid them entirely when working with Cranelift.


Last updated: Dec 06 2025 at 07:03 UTC