From 75a2ab872a1af9a4c61691d9ae24dae3bd764719 Mon Sep 17 00:00:00 2001 From: simonmar Date: Wed, 1 Oct 2003 09:08:10 +0000 Subject: [PATCH] [project @ 2003-10-01 09:08:10 by simonmar] rts_getBool: we should check the constructor tag instead of comparing directly against False_closure and True_closure, since we might be using the dynamically-linked versions of these. This may or may not be the cause of bug [ 792761 ] rts_getBool: not a Bool. --- ghc/rts/RtsAPI.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/ghc/rts/RtsAPI.c b/ghc/rts/RtsAPI.c index 651a497..32a7a32 100644 --- a/ghc/rts/RtsAPI.c +++ b/ghc/rts/RtsAPI.c @@ -1,5 +1,5 @@ /* ---------------------------------------------------------------------------- - * $Id: RtsAPI.c,v 1.46 2003/09/21 22:20:56 wolfgang Exp $ + * $Id: RtsAPI.c,v 1.47 2003/10/01 09:08:10 simonmar Exp $ * * (c) The GHC Team, 1998-2001 * @@ -369,13 +369,14 @@ rts_getFunPtr (HaskellObj p) HsBool rts_getBool (HaskellObj p) { - if (p == True_closure) { - return 1; - } else if (p == False_closure) { - return 0; - } else { - barf("rts_getBool: not a Bool"); - } + StgInfoTable *info; + + info = get_itbl((StgClosure *)p); + if (info->srt_bitmap == 0) { // srt_bitmap is the constructor tag + return 0; + } else { + return 1; + } } /* ---------------------------------------------------------------------------- -- 1.7.10.4