On Wed, Nov 16, 2005 at 10:42:05AM +0000, Nicholas Clark wrote:
> On Wed, Nov 16, 2005 at 10:23:10AM +0000, Steve Hay wrote:

> > Found it.  Change 26108 is the culprit.  Looks like that may not have 
> > the correct fix after all.  Nicholas?

Well, it is *a* correct fix for one bug. But there seems to be another

socketpair.t does issue warnings under valgrind on Linux. It's the exit from

  $SIG{INT} = sub {exit(0)};

in the forked child. The "fork" is only done on Windows for IMPLICIT_SYS,
which at least explains why that's the only option issuing forth smoke.

I can cut the problem down to:

#!./perl -w

BEGIN {
    chdir 't' if -d 't';
    @INC = '../lib';

    my $child = fork;
    die "Fork failed" unless defined $child;
    if ($child) {
      $SIG{INT} = sub {exit(0)};
      my $must_finish_by = time + 3600;
      my $remaining;
      while (($remaining = $must_finish_by - time) > 0) {
        sleep $remaining;
      }
      exit 1;
    }
}

# This is the child
exit 0;

[need to hit control C on Unix to issue the SIGINT to trigger the exit(0)]

Errors are:
(S.pl:14)       sleep
(S.pl:14)       nextstate
(S.pl:10)       const(IV(0))
(S.pl:10)       exit
==12036== Conditional jump or move depends on uninitialised value(s)
==12036==    at 0x81095CD: Perl_pop_scope (scope.c:94)
==12036==    by 0x806854F: Perl_call_list (perl.c:5135)
==12036==    by 0x809B86B: Perl_newATTRSUB (op.c:4554)
==12036==    by 0x808DEFE: Perl_yyparse (perly.y:326)
==12036==    by 0x8062EDA: S_parse_body (perl.c:2164)
==12036==    by 0x8061F31: perl_parse (perl.c:1555)
==12036==    by 0x805E9C3: main (perlmain.c:101)
==12036==
==12036== ---- Attach to debugger ? --- [Return/N/n/Y/y/C/c] ---- n
==12036== 
==12036== Conditional jump or move depends on uninitialised value(s)
==12036==    at 0x810B24B: Perl_leave_scope (scope.c:630)
==12036==    by 0x81095D9: Perl_pop_scope (scope.c:94)
==12036==    by 0x806854F: Perl_call_list (perl.c:5135)
==12036==    by 0x809B86B: Perl_newATTRSUB (op.c:4554)
==12036==    by 0x808DEFE: Perl_yyparse (perly.y:326)
==12036==    by 0x8062EDA: S_parse_body (perl.c:2164)
==12036==    by 0x8061F31: perl_parse (perl.c:1555)
==12036==    by 0x805E9C3: main (perlmain.c:101)
==12036== 
==12036== ---- Attach to debugger ? --- [Return/N/n/Y/y/C/c] ---- y
starting debugger
==12036== starting debugger with cmd: gdb /proc/12128/fd/822 12128

...

630         if (base < -1)

Given that the definition

#define LEAVE_SCOPE(old) if (PL_savestack_ix > old) leave_scope(old)

it means that the first error in:

void
Perl_pop_scope(pTHX)
{
    const I32 oldsave = PL_scopestack[--PL_scopestack_ix];
    LEAVE_SCOPE(oldsave);
}

is that the value read from PL_scopestack was never initialised.
(as distinct from the memory not being allocated)

But I feel stuck again.

Nicholas Clark

Reply via email to