Global `let` with non-constant initializer crashes in lowering
Author: zygoloidCreated Jun 17, 2026Updated Sep 15, 2026
Labelsinactivetoolchain
Description of the bug:
If a global let has an initializer that is non-constant, type-checking accepts but lowering crashes.
What did you do, or what's a simple way to reproduce the bug?
fn F() -> i32;
let a: i32 = F();
fn G() -> i32 { return a; }
What did you expect to happen?
Either this should work (like a global var would), or we should get an error from check that a global let must have a constant initializer.
What actually happened?
We get a CHECK-failure:
CHECK failure at toolchain/lower/function_context.cpp:190: const_id.is_concrete(): Missing value: inst7E000042 {kind: Converted, arg0: inst7E000040, arg1: inst7E000041, type: type(inst7E00002A)} in specific<none> has non-concrete value runtime
Any other information, logs, or outputs that you want to share?
The problem is that we generate a name_ref pointing directly to the value of the let, which is in an unrelated instruction block (the file block) and hence not visible.
Source: carbon-language/carbon-lang