in reply to SvTRUE(ERRSV) crsahes in Perl 5.10

You can use inline::C to provide test/demo scripts that we can all run (if Inline::C is installed).
The following runs fine for me on both perl-5.8.9 and perl-5.10. Do you still get the crash ?
use warnings; use Inline C => Config => BUILD_NOISY => 1; use Inline C => <<'EOC'; void call_Subtract(int a , int b) { dSP; int count; ENTER; SAVETMPS; PUSHMARK(SP); XPUSHs(sv_2mortal(newSViv(a))); XPUSHs(sv_2mortal(newSViv(b))); PUTBACK; printf("PL_errgv2 = %p\n", PL_errgv); //count = call_pv("Subtract", G_EVAL|G_SCALAR); count = call_pv("Subtract", G_SCALAR); SPAGAIN; printf("PL_errgv3 = %p\n", PL_errgv); /* Check the eval first */ if (SvTRUE(ERRSV)) /* crashes here */ { STRLEN n_a; printf ("Uh oh - %s\n", SvPV(ERRSV, n_a)); POPs; } else { if (count != 1) croak("call_Subtract: wanted 1 value from 'Subtract', g +ot %d\n", count); printf ("%d - %d = %d\n", a, b, POPi); } PUTBACK; FREETMPS; LEAVE; } EOC call_Subtract(25, 12); sub Subtract { my $ret = $_[0] - $_[1]; return $ret; }
It ouptuts, for me:
PL_errgv2 = 002E3F20 PL_errgv3 = 002E3F20 25 - 12 = 13
Cheers,
Rob

Replies are listed 'Best First'.
Re^2: SvTRUE(ERRSV) crsahes in Perl 5.10
by Anonymous Monk on Nov 16, 2010 at 09:54 UTC
    Hi , Thanks for the replies
    Just like to mention , i am using VC8 (VC2005) compiler then it crashes
    --------------------------- perl10.exe - Application Error --------------------------- The exception unknown software exception (0xc0000005) occurred in the application at location 0x00401064. Click on OK to terminate the program Click on CANCEL to debug the program --------------------------- OK Cancel ---------------------------
    But this works fine for VC6 compiler.
    And it crashes at the if (SvTRUE(ERRSV)) line.
    Please help
    Best Regards Manoj
      Google produces lots (probably far too many) of hits for '0xc0000005'.

      My best guess is that afoken's post is closest to the mark.

      That is, you've come up against some sort of wtf - probably a handle allocated by msvcr80.dll is passed to msvcrt.dll, and msvcrt.dll doesn't know what to do with this handle (... nor should it).

      Cheers,
      Rob
        Google produces lots (probably far too many) of hits for '0xc0000005'.

        That just means "Access violation". It's the standard exception raised when an attempt is made to access non-existent memory.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.