File 0633-erts-Add-check-if-all-of-match-spec-stack-is-popped-.patch of Package erlang

From 32c1365fd37c109fd7cea991be12ba6fa7f1b238 Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Thu, 12 Aug 2021 16:33:34 +0200
Subject: [PATCH 3/6] erts: Add check if all of match spec stack is popped at
 end

---
 erts/emulator/beam/erl_db_util.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/erts/emulator/beam/erl_db_util.c b/erts/emulator/beam/erl_db_util.c
index 5c1530304b..7744c98612 100644
--- a/erts/emulator/beam/erl_db_util.c
+++ b/erts/emulator/beam/erl_db_util.c
@@ -2029,6 +2029,9 @@ Eterm db_prog_match(Process *c_p,
     BIF_RETTYPE (*bif)(BIF_ALIST);
     Eterm bif_args[3];
     int fail_label;
+#ifdef DEBUG
+    Eterm *orig_esp;
+#endif
 #ifdef DMC_DEBUG
     Uint *heap_fence;
     Uint *stack_fence;
@@ -2082,6 +2085,7 @@ restart:
         esdp->current_process = psp;
 
 #ifdef DEBUG
+    orig_esp = esp;
     ASSERT(variables == mpsp->u.variables);
     for (i=0; i<prog->num_bindings; i++) {
 	variables[i].term = THE_NON_VALUE;
@@ -2767,6 +2771,7 @@ fail:
     }
     ret = THE_NON_VALUE;
 success:
+    ASSERT(ret == THE_NON_VALUE || esp == orig_esp);
 
 #ifdef DMC_DEBUG
     if (*heap_fence != FENCE_PATTERN) {
-- 
2.31.1

openSUSE Build Service is sponsored by