chromatic a écrit :
On Tuesday 08 July 2008 02:36:37 François PERRAD via RT wrote:

This bug starts with r28354 (cache string).
The cache don't handle empty string.

Now, in Pipp (PHP), an empty string is used to stringify boolean False.
// languages/pipp/src/pmc/phpboolean.pmc
    STRING* get_string() {
        if (PMC_int_val(SELF))
            return const_string(INTERP, "1");
        else
            return const_string(INTERP, "");
    }

Instead of an empty string, I obtain another cached string like "MD2",
"PhpUndef", ...

I can't reproduce that with this test case:

        .loadlib 'php_group'

        .sub 'main' :main
        .local pmc true, false

            true  = new 'PhpBoolean'
            false = new 'PhpBoolean'
            true  = 1
            false = 0
            $S0   = true
            say $S0
            $S0   = false
            say $S0
        .end


On windows, r29191, with this test, I obtain :

D:\fperrad\Parrot\trunk\languages\pipp>parrot bool.pir
1
Php

D:\fperrad\Parrot\trunk\languages\pipp>

and with a Lua PMC test

D:\fperrad\Parrot\trunk\languages\lua>perl -I../../lib t/pmc/string.t
1..13
ok 1 - check inheritance
ok 2 - check interface
ok 3 - check name
ok 4 - check get_bool
ok 5 - check logical_not
ok 6 - check embedded zero
ok 7 - check HLL
ok 8 - check HLL (autoboxing)
ok 9 - check HLL & .const
not ok 10 - .const & empty string
#   Failed test '.const & empty string'
#   at t/pmc/string.t line 196.
#          got: '¤
# 1
# '
#     expected: '
# 1
# '
ok 11 - check tostring
ok 12 - check tonumber
ok 13 - check tobase
# Looks like you failed 1 test of 13.

I shaw the same behavior on Xubuntu 8.04 (r29194).
But I notice that this issue is random (disappear or re-appear after an update & re-compilation).

And when I revert all modifications in src/string.c since r28354, all is OK.

François.


Do you have PIR which demonstrates it?

-- c






Reply via email to