Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion B::CC uses same names for lexical variables and temporary values

Received: by 10.223.104.82 with SMTP id n18mr384426fao.20.1282048370206;
        Tue, 17 Aug 2010 05:32:50 -0700 (PDT)
X-BeenThere: perl-compiler@googlegroups.com
Received: by 10.223.26.6 with SMTP id b6ls1234798fac.1.p; Tue, 17 Aug 2010
 05:32:49 -0700 (PDT)
Received: by 10.223.119.130 with SMTP id z2mr377378faq.28.1282048369742;
        Tue, 17 Aug 2010 05:32:49 -0700 (PDT)
Received: by 10.223.119.130 with SMTP id z2mr377377faq.28.1282048369721;
        Tue, 17 Aug 2010 05:32:49 -0700 (PDT)
Return-Path: <reini.ur...@gmail.com>
Received: from mail-fx0-f47.google.com (mail-fx0-f47.google.com [209.85.161.47])
        by gmr-mx.google.com with ESMTP id b5si2036890fab.10.2010.08.17.05.32.48;
        Tue, 17 Aug 2010 05:32:48 -0700 (PDT)
Received-SPF: pass (google.com: domain of reini.ur...@gmail.com designates 209.85.161.47 as permitted sender) client-ip=209.85.161.47;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of reini.ur...@gmail.com designates 209.85.161.47 as permitted sender) smtp.mail=reini.ur...@gmail.com; dkim=pass (test mode) header...@gmail.com
Received: by fxm6 with SMTP id 6so4361782fxm.34
        for <perl-compiler@googlegroups.com>; Tue, 17 Aug 2010 05:32:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:mime-version:received:sender:received
         :in-reply-to:references:date:x-google-sender-auth:message-id:subject
         :from:to:content-type:content-transfer-encoding;
        bh=/kt+1o11r4kqD8CiAtfDcpVz6xvionsbjASuvcwrTvE=;
        b=iRGXGONy0EPtIalHDhXqXc7/ssDJ/xnrJc5jIfUnajuqo4G7UMnyv0icx3X4VM4Wu6
         FsgnHr+idjrwC8XLT4ZatUOzIx+TvvVFyAKxF9yKCMJ55eIivz4FdfV/irfQcnMZs+Dl
         sxNxEh2NqmE0OKPV8rxw0VffKErGANmOukNHA=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=mime-version:sender:in-reply-to:references:date
         :x-google-sender-auth:message-id:subject:from:to:content-type
         :content-transfer-encoding;
        b=Bn+R6eR7dM7MrNFvbOVcNc72Fxi19FYIPLHLoDx6M2HaCrti1iVtHHISsoKoC4+nG0
         htA+pQ9qZkVsvFjZ9xC0ir/JNu/K5EOGkK8388tYRC+oZDVky1kZzv2zfHiSRZX7wFjj
         DGBJAx0LIeu/Ttjw+uJphLWpIAiH9ITMcaf98=
MIME-Version: 1.0
Received: by 10.239.181.211 with SMTP id n19mr285651hbg.102.1282048368499;
 Tue, 17 Aug 2010 05:32:48 -0700 (PDT)
Sender: reini.ur...@gmail.com
Received: by 10.239.131.12 with HTTP; Tue, 17 Aug 2010 05:32:48 -0700 (PDT)
In-Reply-To: <4C6A797C.2050...@gmx.de>
References: <4C69931B.3010...@gmx.de>
	<AANLkTimoFGgtjTt6meRrfpQ76PWxP5VaPzg=ZUxvp...@mail.gmail.com>
	<4C6A797C.2050...@gmx.de>
Date: Tue, 17 Aug 2010 14:32:48 +0200
Message-ID: <AANLkTi=TLG2vDjcrKKOXM+Ju46KYpn11kqfK+pgnu...@mail.gmail.com>
Subject: Re: [perl-compiler] B::CC uses same names for lexical variables and
 temporary values
From: Reini Urban <rur...@x-ray.at>
To: perl-compiler@googlegroups.com
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

2010/8/17 Heinz Knutzen <heinz.knut...@gmx.de>:
> I would propose this patch, which fixes issue 35.
>
> --- /usr/local/lib/perl/5.10.1/B/CC.pm =A0 =A02010-07-23 23:55:39.0000000=
00
> +0200
> +++ B/CC.pm =A0 =A02010-08-17 13:32:08.000000000 +0200
> @@ -604,7 +604,7 @@
> =A0 =A0 my $namesv =3D $namelist[$ix];
> =A0 =A0 my $type =A0 =3D T_UNKNOWN;
> =A0 =A0 my $flags =A0=3D 0;
> - =A0 =A0my $name =A0 =3D "tmp$ix";
> + =A0 =A0my $name =A0 =3D "tmp";
> =A0 =A0 my $class =A0=3D class($namesv);
> =A0 =A0 if ( !defined($namesv) || $class eq "SPECIAL" ) {
> =A0 =A0 =A0 # temporaries have &PL_sv_undef instead of a PVNV for a name
> @@ -628,8 +628,9 @@
> =A0 =A0 =A0 =A0 $flags |=3D REGISTER if $3;
> =A0 =A0 =A0 }
> =A0 =A0 }
> + =A0 =A0$name =3D "${ix}_$name";
> =A0 =A0 $pad[$ix] =3D
> - =A0 =A0 =A0B::Stackobj::Padsv->new( $type, $flags, $ix, "i_$name", "d_$=
name" );
> + =A0 =A0 =A0B::Stackobj::Padsv->new( $type, $flags, $ix, "i$name", "d$na=
me" );

This does not smell right since the new names should
start with i_ or d_ for consistency.

--- lib/B/CC.pm (revision 521)
+++ lib/B/CC.pm (working copy)
@@ -605,7 +605,7 @@
     my $namesv =3D $namelist[$ix];
     my $type   =3D T_UNKNOWN;
     my $flags  =3D 0;
-    my $name   =3D "tmp$ix";
+    my $name   =3D "tmp";
     my $class  =3D class($namesv);
     if ( !defined($namesv) || $class eq "SPECIAL" ) {
       # temporaries have &PL_sv_undef instead of a PVNV for a name
@@ -629,6 +629,7 @@
         $flags |=3D REGISTER if $3;
       }
     }
+    $name =3D "$name$ix";
     $pad[$ix] =3D
       B::Stackobj::Padsv->new( $type, $flags, $ix, "i_$name", "d_$name" );

d_tmp5 sounds better than d5_tmp

> There seems to be some non-determinism in B::CC.
> When applying this patch, the offending variables "x" and "tmp5" aren't
> declared any longer in the resulting C code.

I get d_x2 and d_tmp5 which looks good to me, without the changed test.

> I had to change the test programs slightly to get them back.
>
> fail2.pl
> =3D=3D=3D=3D=3D
> sub test {
> =A0 =A0{ my $x =3D 1; my $y =3D $x + 1;}
> =A0 =A0my $x =3D 2;
> =A0 =A0if ($x !=3D 3) { 4; }
> }
> =3D=3D=3D=3D=3D
>
> fail3.pl
> =3D=3D=3D=3D=3D
> sub test {
> =A0 =A0my $tmp5 =3D 1;
> =A0 =A0my $x =3D $tmp5 + 1;
> =A0 =A0if ($x !=3D 3) { 4; }
> }
> =3D=3D=3D=3D=3D
>>
>> As a sidenote:
>> Do you think it is possible to add googlecode issues for future bugs
>> by yourself?
>>
>
> For joining this mailing list I needed a google account already.
> I will add future issues to googlecode myself.

Great! Thanks.
I didn't know that you need a google account for joining the mailing
list at all.
This sounds like a blocker for future contributors.

>> If you have a google account I'll happily add you as "Project
>> contributor". (to add and resolve issues)

> What does it mean to resolve issues as contributor?
> Will I be able to change the code?

If you come up with more good patches I'll give you svn write access also.
contributer has issue permissions, not svn I believe.
> --
> Heinz Knutzen
--=20
Reini Urban