module test_repro;
macro void trigger_crash(int x) {
int[4] $masks = {};
// ANY of these compound assignments to a compile-time array element
// will trigger the compiler crash (assert: resolve_status == RESOLVE_DONE)
// (the compiler misses validation for 'EXPR_COMPOUND_ASSIGN' nodes ?)
// $masks[1] += x; // Variant 1: Compound addition
// $masks[1] |= x; // Variant 2: Compound bitwise OR
// $masks[1] -= x; // Variant 3: Compound subtraction
// $masks[1] *= x; // Variant 4: Compound multiplication
$masks[1] <<= x; // Variant 5: Compound left shift
}
fn void main() {
trigger_crash(42);
}
⚠️ The compiler encountered an unexpected error: "Violated assert: expr->resolve_status == RESOLVE_DONE".
- Function: expr_is_const_initializer(...)
- Source file: /home/mb/scripts/c3c/src/compiler/compiler_internal.h:4718