fix function_casts_as_integer warning

Comparing addresses of function pointers is brittle.

Functions may be duplicated resulting in function pointers to the same function to compare !=.
Functions may be merged/de-duplicated resulting in function pointers to different function to compare ==.

The later shouldn't be relevant here as the function differ in behavior, but mentioning it for completeness.
This commit is contained in:
Skgland
2025-11-27 20:07:13 +01:00
committed by Bennet Bleßmann
parent f570e566f8
commit 797a8f8611
6 changed files with 107 additions and 55 deletions

View File

@@ -1104,7 +1104,7 @@ impl MachineState {
}
_ => {
push_cell!(self, heap_loc_as_cell!(h), return);
(self.bind_fn)(self, Ref::heap_cell(h), value);
self.occurs_check.bind(self, Ref::heap_cell(h), value);
}
);
}
@@ -1152,7 +1152,7 @@ impl MachineState {
push_cell!(self, heap_loc_as_cell!(h), return);
let addr = self.store(self[r]);
(self.bind_fn)(self, Ref::heap_cell(h), addr);
self.occurs_check.bind(self, Ref::heap_cell(h), addr);
// the former code of this match arm was:
@@ -1235,7 +1235,7 @@ impl MachineState {
let h = self.heap.cell_len();
push_cell!(self, heap_loc_as_cell!(h), return);
(self.bind_fn)(self, Ref::heap_cell(h), addr);
self.occurs_check.bind(self, Ref::heap_cell(h), addr);
self.registers[arg] = heap_loc_as_cell!(h);
}
@@ -1281,7 +1281,7 @@ impl MachineState {
if stored_v.is_stack_var() {
let h = self.heap.cell_len();
push_cell!(self, heap_loc_as_cell!(h), return);
(self.bind_fn)(self, Ref::heap_cell(h), stored_v);
self.occurs_check.bind(self, Ref::heap_cell(h), stored_v);
} else {
push_cell!(self, stored_v, return);
}