Bug in Boolean.pmc

0 views
Skip to first unread message

John Lenz

unread,
May 6, 2005, 12:17:08 PM5/6/05
to perl6-i...@perl.org
Hi, the following test fails because boolean.pmc actually registers the
global True as a false boolean, and no boolean for False. It is fixed with
the patch below.

John


find_global P0, "True"
find_global P1, "False"

if P0, L1
print "Error, True is not true"
L1:
unless P1, L2
print "Error, False is not false"
L2:
end


Index: classes/boolean.pmc
===================================================================
--- classes/boolean.pmc (revision 7992)
+++ classes/boolean.pmc (working copy)
@@ -42,11 +42,15 @@
if (pass) {
PMC *t;
STRING *s;
+
t = pmc_new(INTERP, enum_class_Boolean);
PMC_int_val(t) = 1;
s = CONST_STRING(INTERP, "True");
Parrot_store_global(INTERP, NULL, s, t);
+
t = pmc_new(INTERP, enum_class_Boolean);
+ PMC_int_val(t) = 0;
+ s = CONST_STRING(INTERP, "False");
Parrot_store_global(INTERP, NULL, s, t);
}
}

Leopold Toetsch

unread,
May 6, 2005, 12:51:13 PM5/6/05
to John Lenz, perl6-i...@perl.org
John Lenz <le...@cs.wisc.edu> wrote:
> Hi, the following test fails because boolean.pmc actually registers the
> global True as a false boolean, and no boolean for False. It is fixed with
> the patch below.

Thanks, applied (modulo the init for false, which is 0 already).

> John

leo

Juergen Boemmels

unread,
May 10, 2005, 12:55:21 AM5/10/05
to perl6-i...@perl.org
On Friday 06 May 2005 18:17, John Lenz wrote:
> Hi, the following test fails because boolean.pmc actually registers the
> global True as a false boolean, and no boolean for False. It is fixed with
> the patch below.
>
> John
>
>
> find_global P0, "True"
> find_global P1, "False"
>
> if P0, L1
> print "Error, True is not true"
> L1:
> unless P1, L2
> print "Error, False is not false"
> L2:
> end

I just committed a slightly modified version of this BugReprodutionRecipe as
test in t/pmc/boolean.t

juergen

Reply all
Reply to author
Forward
0 new messages