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
*
......@@ -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;
}
}
/* ----------------------------------------------------------------------------
......
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