fix(library/compiler/ir_interpreter): fix UB sequencing found by GCC
This commit is contained in:
parent
75e5f5bfd8
commit
a083cab532
1 changed files with 4 additions and 1 deletions
|
|
@ -473,7 +473,10 @@ class interpreter {
|
|||
check_system("interpreter");
|
||||
break;
|
||||
}
|
||||
var(fn_body_vdecl_var(b)) = eval_expr(fn_body_vdecl_expr(b), fn_body_vdecl_type(b));
|
||||
value v = eval_expr(fn_body_vdecl_expr(b), fn_body_vdecl_type(b));
|
||||
// NOTE: `var` must be called *after* `eval_expr` because the stack may get resized and invalidate
|
||||
// the pointer
|
||||
var(fn_body_vdecl_var(b)) = v;
|
||||
DEBUG_CODE(lean_trace(name({"interpreter", "step"}),
|
||||
tout() << std::string(m_call_stack.size(), ' ') << "=> x_";
|
||||
tout() << fn_body_vdecl_var(b).get_small_value() << " = ";
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue