Commit 75a2ab87 authored by simonmar's avatar simonmar
Browse files

[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.
parent 9d0e52d1
/* ---------------------------------------------------------------------------- /* ----------------------------------------------------------------------------
* $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 * (c) The GHC Team, 1998-2001
* *
...@@ -369,13 +369,14 @@ rts_getFunPtr (HaskellObj p) ...@@ -369,13 +369,14 @@ rts_getFunPtr (HaskellObj p)
HsBool HsBool
rts_getBool (HaskellObj p) rts_getBool (HaskellObj p)
{ {
if (p == True_closure) { StgInfoTable *info;
return 1;
} else if (p == False_closure) { info = get_itbl((StgClosure *)p);
return 0; if (info->srt_bitmap == 0) { // srt_bitmap is the constructor tag
} else { return 0;
barf("rts_getBool: not a Bool"); } else {
} return 1;
}
} }
/* ---------------------------------------------------------------------------- /* ----------------------------------------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment