[m-rev.] diff: fix an incorrect check

Julien Fischer jfischer at opturion.com
Tue Nov 3 00:15:52 AEDT 2026


Fix an incorrect check.

runtime/mercury_memory.c
   The sanity check for the stack margin size is incorrect because
   the multiplication that should convert the quantity in words to
   bytes is on the wrong side.

Julien.

diff --git a/runtime/mercury_memory.c b/runtime/mercury_memory.c
index 93136ca68..978910776 100644
--- a/runtime/mercury_memory.c
+++ b/runtime/mercury_memory.c
@@ -228,7 +228,7 @@ MR_init_memory(void)
     }
 #endif

-    if (MR_stack_margin_size_words >= (sizeof(MR_Word) * MR_detstack_size)) {
+    if ((MR_stack_margin_size_words * sizeof(MR_Word)) >= MR_detstack_size) {
         MR_fatal_error("MR_init_memory: stack margin size far too big");
     }


More information about the reviews mailing list