Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix compiler crash with
.global
initializers (#1472)
## Summary Fix the compiler crashing for initializers of `.global` variables where the expression contains locals or temporaries requiring destruction. Fixes #1470. ## Details MIR generation for `.global` init fragments is done via `mirgen.generateAssignment`, which didn't push a scope prior to translation. This caused any call to `mirgen_blocks.register` to crash the compiler, as the scope/block list was empty. A scope is now pushed prior to translating the expression, fixing the crash. In addition to fixing the crash, this slightly changes behaviour: unscoped temporaries/locals created as part of a `.global` initializer are now destroyed immediately after the initialization, instead of at the end of the module's pre-init procedure. Destruction order w.r.t. `.global` initializers is unspecified, so this change shouldn't be a problem.
- Loading branch information