Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: return of hash-assigment in list context (bug?)

by Anonymous Monk
on Jan 02, 2013 at 21:16 UTC ( #1011348=note: print w/ replies, xml ) Need Help??


in reply to return of hash-assigment in list context (bug?)

Happens with 5.8.9 and 5.12.2

With the help of perldeltas and the keywords: return, pushmark , padhv, bind, assign, pad, ex-list, rv2hv, rv2av

Maybe this fixed it perl5140delta#given return values / http://search.cpan.org/dist/perl-5.14.0/pod/perlsyn.pod#Return_value

Maybe related #77498: Assignment ignores magick when the RHS holds a glob

not Maybe related perl5138delta#sv_compile_2op() is now deprecated

I say maybe, cause I didn't check the source to see if it was involved, or I couldn't track down what changed

update: aha , if checking perldeltas doesn't yield results, free probably will :) http://perl5.git.perl.org/perl.git?a=search&h=HEAD&st=free&s=aassign

Better fix for RT #2140 (list assignment with duplicated temporaries)

#2140: assigning array slice of function call to hash slice

That looks to be it, but you wouldn't know it from the bug report


Comment on Re: return of hash-assigment in list context (bug?)
Re^2: return of hash-assigment in list context (bug?)
by Anonymous Monk on Jan 02, 2013 at 21:21 UTC
    http://perl5.git.perl.org/perl.git?a=search&h=HEAD&st=free&s=hash+assign
    2012-12-18 Dave RolskyBetter description of hash assignment bug fixes Better description of hash assignment bug fixes commit | commitdiff | tree 2012-12-18 Dave RolskyClarify hash assignment bug fix in list context Clarify hash assignment bug fix in list context commit | commitdiff | tree 2012-12-11 Father Chrysostomos[Merge] hash assignment fixes and speedup [Merge] hash assignment fixes and speedup ...to left algorithm for not magic hash assignment > * in list context hash assignment return keys aliased to RHS commit | commitdiff | tree 2012-12-11 Ruslan Zakirovrefactor aassign for array and hash assignment "while (relem <= SP)" loop commit | commitdiff | tree 2012-12-11 Ruslan Zakirovhash assign in list context should copy key as well hash assign in list context should copy key... commit | commitdiff | tree 2012-12-11 Ruslan Zakirovmake sure hash assignment is proper lvalue make sure hash assignment is proper lvalue commit | commitdiff | tree 2012-12-11 Ruslan Zakirovfix issues in hash assignment with odd elements fix issues in hash assignment with odd elements 3) hash assignment with duplicates and odd elements on commit | commitdiff | tree 2012-12-11 Ruslan Zakirovtest hash assignment with odd elements for leaks test hash assignment with odd elements for leaks ...is tied and dies on fetch then hash assignment commit | commitdiff | tree 2012-12-11 Ruslan Zakirovtest "Odd number of elements in hash assignment" test "Odd number of elements in hash assignment" commit | commitdiff | tree 2012-09-23 Father ChrysostomosStop hash assignment from leaking on croak Stop hash assignment from leaking on croak commit | commitdiff | tree 2012-05-22 Lukas Maidocument behavior of duplicate keys in hash assignment ...behavior of duplicate keys in hash assignment commit | commitdiff | tree 2010-09-11 David Mitchelllist cxt hash assign with dups gives garbage list cxt hash assign with dups gives garbage commit | commitdiff | tree
      Thx, this one looks good! =)

      2010-09-11 David Mitchell
      list cxt hash assign with dups gives garbage

      the others are too new.

      Fix for #31865: weird results from reverse( %x = reverse %h )

      Basically, anything of the form

      @a = %h = (list with some duplicate keys)

      may have left @a containing weird and/or freed values.

      There was a partial fix for this with ca65944e, but it was broken (it did one big block move on the stack at the end to remove duplicates, but duplicates weren't necessarily all in one block.)

      The new fix is a two-stage process. First, while pulling key/value pairs of the stack and assigning them to the hash, each key/val pair is written back to the stack - possibly at a lower position if there are duplicates to be skipped.

      Finally at the end if any duplicates have been detected, then in list context, a single pass is made through the stack, and for each key/val pair, the key is looked up and the val on the stack is overwritten with the new value (replacing possibly freed or other garbage values).

      Cheers Rolf

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1011348]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (6)
As of 2014-12-18 11:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (50 votes), past polls