Ron Blaschke wrote:
> Leopold Toetsch wrote:
>> Ron Blaschke <[EMAIL PROTECTED]> wrote:

>>> t\pmc\bigint.t            1   256    22    1   4.55%  22

>> What's up with that one?

> Maybe my fault.  The program segfaults at C<free(s);> in
> C<get_string>.  Memory gets allocated by a non-debug version of GMP,
> and deallocated by a debug Parrot.  I'll check what happens with a
> debug GMP...

Alright, here's how far I've got.  I currently can't make any sense of
it, maybe I'm getting too tired.

The problem seems to be caused by the C<free(s);> in
F<bigint.pmc/get_string>.  Well, not the actual cause, but that's
where we fail.

    STRING* get_string() {
        char *s = bigint_get_string(INTERP, SELF, 10);
        STRING *ps = string_from_cstring(INTERP, s, 0);
        free(s);
        return ps;
    }

Here's the top of the call stack.
    
        [EMAIL PROTECTED]()
        [EMAIL PROTECTED]()  + 0x28       
        [EMAIL PROTECTED]()  + 0x113  
        [EMAIL PROTECTED]()  + 0x97        
        [EMAIL PROTECTED]()  + 0x23d19    
        [EMAIL PROTECTED]()  + 0x16470  
        msvcr71.dll!7d003179()
        parrot.exe!Parrot_BigInt_get_string(...)  Line 545 + 0xa     C

Out of curiosity, I've removed the C<free>, and tests pass just fine.
C<free> back in again, link against debug GMP - pass.
Link against release GMP again - fail.

Now here's something really funny.  Here's the test run that fails.

    Parrot>parrot -b --gc-debug t\pmc\bigint_22.pir
    Parrot>echo %ERRORLEVEL%
    -1073741819

And here's one that passes, from the very same command prompt.

    Parrot>parrot -b --gc-debug t\pmc\bigint_22.pir
    31415926535897932384626433832795028841971693993751
    05820974944592307816406286208998628034825342117067
    [snip]
    35982534904287554687311595628638823537875937519577
    81857780532171226806613001927876611195909216420198
    Parrot>echo %ERRORLEVEL%
    0

The difference, you ask?  Another command prompt, that says
C<perl -e "while (1) {}">.  Once the CPU is busy, the expected result
shows up. ;-)

The bigint.t test suite still fails, though, in both cases, with the
same error message.

    Parrot>perl t\harness t\pmc\bigint.t
    t\pmc\bigint....NOK 22#
    got: 'Can't spawn ".\parrot.exe  "Parrot\t\pmc\bigint_22.pir"":
    Bad file descriptor at lib/Parrot/Test.pm line 230.

Ron


Reply via email to