I am tracking down a bug in perl, B, B::Utils, or B::Generate. The following code leaves B::Utils::walkallops_simple (and all the other plain-perl subs in B::Utils) with their cop_warnings pointer set to an invalid value. If someone else out there gets a different result from the first print (so something other than 0c), or if the file/line being reported changes, or if it doesn't die - please let me know.

The long string of hex numbers is the hex encoding of the in-memory opcode so that will change since your pointer addresses will be different and such. Don't just compare that long number and report that it is different for you because that is normal and to be expected. If it doesn't die or dies differently or dies elsewhere, or if $w is not 0x0c then let me know. (also try commenting return if $w eq "00"; if it doesn't die. That just keeps a lot of nonsense of stuff that is supposed to work from printing input)

# does *NOT* die when this is not imported - importing # and using this is what triggers the COP->cop_warnings to be bad. use B::Utils qw'walkallops_simple'; use B::Generate; $\ = "\n"; $| = 1; print "$_ " . $_->VERSION for qw( B B::Utils B::Generate ); B::Utils::walkallops_simple( \ &cb ); sub cb { my $op = shift; my $addr = $$op; return unless $op=~/COP/; my $w = unpack('H*', unpack "P", pack 'L', $addr + 48); return if $w eq "00"; print $w; print unpack 'H*', unpack 'P56', pack 'L', $addr; print $op->file . ":" . $op->line; print $op->warnings; # SEGFAULT HERE }
B 1.02 B::Utils 0.04 B::Generate 1.06 0c 28031d0848031d08b0ef0b0800000000ae008411010200000000000054d61508f42016 +086b010000000000001e0100000c00000000000000 /home/josh/perl5.8.3/lib/site_perl/5.8.3/B/Utils.pm:286 Segmentation fault

Summary of my perl5 (revision 5.0 version 8 subversion 3) configuratio +n: Platform: osname=linux, osvers=2.6.3, archname=i686-linux uname='linux lik.grenekatz.org 2.6.3 #5 sun feb 29 22:24:31 local +time zone must be set--see zic manu i686 amd athlon(tm) xp 2500+ auth +enticamd gnulinux ' config_args='-Dmksymlinks -Dprefix=/home/josh/perl5.8.3 -de' hint=previous, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultipl +icity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FIL +E_OFFSET_BITS=64', optimize='-O3', cppflags='-fno-strict-aliasing -fno-strict-aliasing -D_LARGEFILE_S +OURCE -D_FILE_OFFSET_BITS=64' ccversion='', gccversion='3.3.2 20031218 (Gentoo Linux 3.3.2-r5, p +ropolice-3.3-7)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +2 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', + lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc libc=/lib/libc-2.3.2.so, so=so, useshrplib=false, libperl=libperl. +a gnulibc_version='2.3.2' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynami +c' cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: USE_LARGE_FILES Built under linux Compiled at Mar 1 2004 14:04:37 @INC: /home/josh/perl5.8.3/lib/5.8.3/i686-linux /home/josh/perl5.8.3/lib/5.8.3 /home/josh/perl5.8.3/lib/site_perl/5.8.3/i686-linux /home/josh/perl5.8.3/lib/site_perl/5.8.3 /home/josh/perl5.8.3/lib/site_perl .

Steve_p - changed pre tags to code tags to get long lines to wrap as suggested
flux8 - same fix but for SOPW view


In reply to Sounding a segfault in B, B::Utils, or B::Generate - testers requested by diotalevi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.