in reply to Perl segfaults: Why?

I suspect it's tell (or something it calls) that's faulting, not the addition. ( cdarke has since shown this to be true. ) This would be the result of receiving a number for argument instead of a file handle.

There should be a validation check that catches this. I don't have access to 5.10.1 at this very moment to check if it's been fixed there. Could someone check?

Replies are listed 'Best First'.
Re^2: Perl segfaults: Why?
by BrowserUk (Patriarch) on Sep 15, 2009 at 17:05 UTC
    Could someone check?

    Seems to be:

    open $fh, '<', $0;; print scalar <$fh>;; #! perl -slw print tell( $fh );; 14 print tell( $fh + 1 );; tell() on unopened filehandle at (eval 10) line 1. -1 print $];; 5.010001

    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.
Re^2: Perl segfaults: Why?
by FunkyMonk (Bishop) on Sep 15, 2009 at 19:18 UTC
    Segfaulting here with 5.10.0 and 5.10.1 but not on 5.8.9. All tested with BrowserUK's script.
    $ cat y.pl #!/usr/bin/perl open $fh, '<', $0;; print scalar <$fh>;; print tell( $fh );; print tell( $fh + 1 );; $ perl y.pl # system perl: 5.10.0 #!/usr/bin/perl Segmentation fault $ perl5.10.0 y.pl #!/usr/bin/perl Segmentation fault $ perl5.10.1 y.pl #!/usr/bin/perl Segmentation fault $ perl5.8.9 y.pl #!/usr/bin/perl 16-1
      After digging some more, I think this is a compiler problem, not a Perl problem.
        These are the gcc versions from my previous tests:

        $ perl -V:gccversion # segfaults gccversion='4.3.4'; $ perl5.8.9 -V:gccversion # OK gccversion='4.3.3'; $ perl5.10.0 -V:gccversion # segfaults gccversion='4.3.4'; $ perl5.10.1 -V:gccversion # segfaults gccversion='4.3.4';

        I don't have access to gcc-4.3.3 any more, so here's the only test I can try:

        $ ./perl -Ilib -V:gccversion gccversion='4.3.4'; $ ./perl y.pl #!/usr/bin/perl 16-1

        5.8.9 still works :-(

        Yes it seems you're right since I don't get any crash with ActivePerl 5.10.0.1004 & perl 5.8.8 on linux