develooper Front page | perl.perl5.porters | Postings from February 2013

Re: [perl #116569] Re: 5.17.7 breaks rules of assignment

Thread Previous | Thread Next
From:
sisyphus1
Date:
February 5, 2013 06:28
Subject:
Re: [perl #116569] Re: 5.17.7 breaks rules of assignment
Message ID:
3B29FD6DE3934B6AB69950BB5BABC38B@OwnerPC311012


-----Original Message----- 
From: Jesse Luehrs
Sent: Wednesday, January 30, 2013 3:01 AM
To: Leon Timmermans
Cc: sisyphus1@optusnet.com.au ; perlbug-followup@perl.org
Subject: Re: [perl #116569] Re: 5.17.7 breaks rules of assignment

> Yes - I think the answer to the underlying question here is that the
> typemap for char* in core needs to be updated to check for SvTHINKFIRST.

Seems to me that it's not solely the char* typemap that's the issue here.

I think the following Inline::C demo avoids the char* typemap, yet still 
displays the same behaviour.
(At least, removing the char* typemapping from lib/ExtUtils/typemap doesn't 
make any dsifference.)

#########################
use strict;
use warnings;

#use Inline C => Config =>
#    BUILD_NOISY => 1;

use Inline C => <<'EOC';

void foo (SV * x) {
     char *new = "new";
     char *str = SvPV_nolen(x);
     sprintf(str, "%s", "new");
}

EOC

my $orig = "orig";
my $copy = $orig;

foo($copy);
print "\$orig = $orig\n\$copy = $copy\n";
#########################

On 5.16, this script outputs:

$orig = orig
$copy = new

On 5.17.8 it outputs:

$orig = new
$copy = new

Cheers,
Rob


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About