]> Repositorios git - scryer-prolog.git/commitdiff
fix panic caused by jmp offset off by one error (#1429)
authorMark Thom <[email protected]>
Sun, 17 Apr 2022 18:19:48 +0000 (12:19 -0600)
committerMark Thom <[email protected]>
Sun, 17 Apr 2022 18:22:34 +0000 (12:22 -0600)
src/codegen.rs

index 5baa3bef4cec81c3d62e39aa14b5130b76ec0b05..c0d4bd0263b40ac00e6b3476909a1c154a87ee2c 100644 (file)
@@ -1076,7 +1076,11 @@ impl<'b, TermMarker: Allocator> CodeGenerator<'b, TermMarker> {
                 code_offsets.index_term(arg, index, &mut clause_index_info, self.atom_tbl);
             }
 
-            if !(clauses.len() == 1 && self.settings.is_extensible) {
+            if !(code_offsets.no_indices() && clauses.len() == 1 && self.settings.is_extensible) {
+                // the peculiar condition of this block, when false,
+                // anticipates code.pop_front() being called about a
+                // dozen lines below.
+                debug_assert_eq!(code.len(), 1);
                 self.increment_jmp_by_locs_by(code.len());
             }