nayakgi / perl-compiler

Automatically exported from code.google.com/p/perl-compiler
Other
0 stars 0 forks source link

Check reference assignment isn't affected by the SV type (bug #38439) #282

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

> perlcc -r -e 'use vars qw($glook $smek $foof); $glook = 3; $smek = 4; $foof = 
"halt and cool down"; my $rv = \*smek; *glook = $rv; my $pv = ""; $pv = \*smek; 
*foof = $pv; print "ok\n";'
a.out: hv.c:2644: S_unshare_hek_or_pvn: Assertion `he->shared_he_he.hent_hek == 
hek' failed.

What is the expected output? What do you see instead?

 > perl -e 'use vars qw($glook $smek $foof); $glook = 3; $smek = 4; $foof = "halt and cool down"; my $rv = \*smek; *glook = $rv; my $pv = ""; $pv = \*smek; *foof = $pv; print "ok\n";'
ok

Please use labels and text to provide additional information.

Original issue reported on code.google.com by nicolas....@gmail.com on 24 Jan 2014 at 1:20

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
not repro with blead, but fails with 5.14 debugging

Original comment by reini.urban on 27 Jan 2014 at 8:49

GoogleCodeExporter commented 9 years ago
(lldb) p hek->hek_key
(char const[1]) $20 = "/usr/local/lib/perl5/5.14.4/vars.pm"
(lldb) bt
* thread #1: tid = 0x7ff7f9, 0x0000000100187014 
libperl.dylib`S_unshare_hek_or_pvn(hek=0x0000000100607e18, 
str=0x0000000000000000, len=0, hash=0) + 68 at hv.c:2644, queue = 
'com.apple.main-thread, stop reason = breakpoint 1.1
    frame #0: 0x0000000100187014 libperl.dylib`S_unshare_hek_or_pvn(hek=0x0000000100607e18, str=0x0000000000000000, len=0, hash=0) + 68 at hv.c:2644
    frame #1: 0x0000000100186fce libperl.dylib`Perl_unshare_hek(hek=0x0000000100607e18) + 86 at hv.c:2616
    frame #2: 0x000000010006bbfc libperl.dylib`Perl_gp_free(gv=0x000000010082bcb8) + 994 at gv.c:1745
    frame #3: 0x00000001001ea14c libperl.dylib`S_glob_assign_glob(dstr=0x000000010082bcb8, sstr=0x000000010082b5c8, dtype=9) + 34654 at sv.c:3737
    frame #4: 0x00000001001f5a80 libperl.dylib`Perl_sv_setsv_flags(dstr=0x000000010082bcb8, sstr=0x000000010082b5c8, flags=1538) + 15785 at sv.c:4149
    frame #5: 0x000000010019475a libperl.dylib`Perl_pp_sassign + 6858 at pp_hot.c:200
    frame #6: 0x000000010013326b libperl.dylib`Perl_runops_debug + 384 at dump.c:2266
    frame #7: 0x0000000100045042 libperl.dylib`S_run_body(oldscope=1) + 1409 at perl.c:2366

Original comment by reini.urban on 27 Jan 2014 at 11:27

GoogleCodeExporter commented 9 years ago
Not repro on linux, but mac and cygwin. 5.19.9 without DEBUGGING is also fine.

The problem is one single GvFILE_HEK for *foof being cleared on 
glob_assign_glob, 
and I don't want to disable file hek's for all gv's for this rare case.
Maybe I'll come up with a better detection later.

Original comment by reini.urban on 28 Jan 2014 at 5:01