From f0b4ae8e7a8086fa815dde802c7772fac7dd9037 Mon Sep 17 00:00:00 2001
From: Cheng Shao <terrorjack@type.dance>
Date: Tue, 28 May 2024 18:52:16 +0000
Subject: [PATCH] rts: fix checkClosure error message

This patch fixes an error message in checkClosure() when the closure
has already been evacuated. The previous logic was meant to print the
evacuated closure's type in the error message, but it was completely
wrong, given info was not really an info table, but a tagged pointer
that points to the closure's new address.

(cherry picked from commit 0d3bc2fa3a9a8c342ec34bb9d32e493655a4ec69)
---
 rts/sm/Sanity.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/rts/sm/Sanity.c b/rts/sm/Sanity.c
index 33cd47965cc..7ad902c2c9b 100644
--- a/rts/sm/Sanity.c
+++ b/rts/sm/Sanity.c
@@ -357,7 +357,8 @@ checkClosure( const StgClosure* p )
     info = ACQUIRE_LOAD(&p->header.info);
 
     if (IS_FORWARDING_PTR(info)) {
-        barf("checkClosure: found EVACUATED closure %d", info->type);
+        ASSERT(LOOKS_LIKE_CLOSURE_PTR(info));
+        barf("checkClosure: found EVACUATED closure %u", GET_INFO((StgClosure*)UN_FORWARDING_PTR(info))->type);
     }
 
 #if defined(PROFILING)
-- 
GitLab