diff --git a/src/core/bytecode.c b/src/core/bytecode.c index e0b25cfd..ff431974 100644 --- a/src/core/bytecode.c +++ b/src/core/bytecode.c @@ -226,6 +226,7 @@ void janet_bytecode_movopt(JanetFuncDef *def) { case JOP_LOAD_TRUE: case JOP_LOAD_FALSE: case JOP_LOAD_SELF: + break; case JOP_MAKE_ARRAY: case JOP_MAKE_BUFFER: case JOP_MAKE_STRING: @@ -233,6 +234,8 @@ void janet_bytecode_movopt(JanetFuncDef *def) { case JOP_MAKE_TABLE: case JOP_MAKE_TUPLE: case JOP_MAKE_BRACKET_TUPLE: + /* Reads from the stack, don't remove */ + janetc_regalloc_touch(&ra, DD); break; /* Read A */ diff --git a/test/suite-boot.janet b/test/suite-boot.janet index 6394e725..4ba8fe33 100644 --- a/test/suite-boot.janet +++ b/test/suite-boot.janet @@ -961,4 +961,11 @@ # (pp (disasm case-2)) # (pp (disasm case-3)) +# Regression #1330 +(defn regress-1330 [&] + (def a [1 2 3]) + (def b [;a]) + (identity a)) +(assert (= [1 2 3] (regress-1330)) "regression 1330") + (end-suite)