Merge pull request #3273 from no382001/issue2914

fix panic in current_prolog_flag/2 when arguments are the same variable
This commit is contained in:
Mark Thom
2026-04-04 13:06:11 -06:00
committed by GitHub
3 changed files with 12 additions and 4 deletions

View File

@@ -9233,10 +9233,9 @@ impl Machine {
#[inline(always)] #[inline(always)]
pub(crate) fn is_sto_enabled(&mut self) { pub(crate) fn is_sto_enabled(&mut self) {
self.machine_st.unify_atom( let a1 = self.deref_register(1);
self.machine_st.occurs_check.flag_value(), self.machine_st
self.machine_st.registers[1], .unify_atom(self.machine_st.occurs_check.flag_value(), a1);
);
} }
#[inline(always)] #[inline(always)]

2
tests-pl/issue2914.pl Normal file
View File

@@ -0,0 +1,2 @@
:- initialization(main).
main :- ( current_prolog_flag(X, X) -> write(true) ; write(false) ).

View File

@@ -20,6 +20,13 @@ fn issue2588_load_html() {
load_module_test("tests-pl/issue2588.pl", "[element(html,[],[element(head,[],[element(title,[],[[H,e,l,l,o,!]])]),element(body,[],[])])]"); load_module_test("tests-pl/issue2588.pl", "[element(html,[],[element(head,[],[element(title,[],[[H,e,l,l,o,!]])]),element(body,[],[])])]");
} }
// issue #2914
#[test]
#[cfg_attr(miri, ignore = "unsupported operation when isolation is enabled")]
fn issue2914_current_prolog_flag_shared_var() {
load_module_test("tests-pl/issue2914.pl", "false");
}
#[test] #[test]
#[cfg_attr(miri, ignore = "unsupported operation when isolation is enabled")] #[cfg_attr(miri, ignore = "unsupported operation when isolation is enabled")]
fn issue3256_load_xml_returns_list() { fn issue3256_load_xml_returns_list() {