-------------8<---------- Start Bug Report ------------8<----------
1. Problem Description:

MP_CODE_ATTRS() doesn't work under perl 5.10.0.

I discovered this when trying to use a PerlOutputFilterHandler and upgraded
from 5.8.8 to 5.10.0. Under 5.10.0, sometimes the filter would run, sometimes
not. When the filter would not run, MP_TRACE messages showed that mod_perl
thought it was not a perl filter handler. I tracked this problem down to the
fact that the filter h->attrs were getting corrupted sometime after the filter
was loaded, but before the request was run. The culprit appears to be in
modperl_mgv.c, line 276:

handler->attrs = (U32)MP_CODE_ATTRS(cv);

I added MP_TRACE() lines before and after this call.

When running under perl 5.8.8, the MP_TRACE()'s output:

modperl_mgv_resolve: pre MP_CODE_ATTRS attrs: 0
modperl_mgv_resolve: post MP_CODE_ATTRS attrs: 0

However, when running under perl 5.10.0, the MP_TRACE()'s look like this:

modperl_mgv_resolve: pre MP_CODE_ATTRS attrs: 0
modperl_mgv_resolve: post MP_CODE_ATTRS attrs: 9905fb8

The actual value returned by MP_CODE_ATTRS() varies.

Looking at mod_perl.h, where MP_CODE_ATTRS() is defined:

/* betting on Perl*Handlers not using CvXSUBANY
* mod_perl reuses this field for handler attributes
*/
#define MP_CODE_ATTRS(cv) (CvXSUBANY((CV*)cv).any_i32)

Apparently this is not a safe assumption for perl 5.10.0...

2. Used Components and their Configuration:

*** mod_perl version 2.000003

*** using /home/mschout/build/lib/perl5/site_perl/arch/Apache2/BuildConfig.pm

*** Makefile.PL options:
MP_APR_LIB => aprext
MP_APXS => /home/mschout/core/src/mod_perl/../../build/bin/apxs
MP_COMPAT_1X => 1
MP_GENERATE_XS => 1
MP_LIBNAME => mod_perl
MP_TRACE => 1
MP_USE_DSO => 1


*** The httpd binary was not found


*** (apr|apu)-config linking info

-L/home/mschout/core/src/apache/../../build/lib -laprutil-1 -lpq -lexpat·
-L/home/mschout/core/src/apache/../../build/lib -lapr-1 -luuid -lrt -lcrypt -lpthread -ldl·



*** /home/mschout/core/src/perl/../../build/bin/perl -V
Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
Platform:
osname=linux, osvers=2.4.21-53.elsmp, archname=i686-linux
uname='linux testbed 2.4.21-53.elsmp #1 smp mon dec 3 13:34:41 est 2007 i686 i686 i386 gnulinux '
config_args='-Dprefix=/home/mschout/core/src/../build -Dprivlib=/home/mschout/core/src/../build/lib/perl5 -Darchlib=/home/mschout/core/src/../build/lib/perl5/arch -Dsitelib=/home/mschout/core/src/../build/lib/perl5/site_perl -Dsitearch=/home/mschout/core/src/../build/lib/perl5/site_perl/arch -Dman3dir=/home/mschout/core/src/../build/man/man3 -Ui_db -de'
hint=previous, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=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 -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
optimize='-O2',
cppflags='-fno-strict-aliasing -pipe -I/usr/local/include -I/usr/include/gdbm -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm'
ccversion='', gccversion='3.2.3 20030502 (Red Hat Linux 3.2.3-59)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
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 -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='-Wl,-E'
cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib'


Characteristics of this binary (from libperl):·
Compile-time options: PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP
USE_LARGE_FILES USE_PERLIO
Built under linux
Compiled at Dec 19 2007 12:10:30
%ENV:
PERL5LIB="/home/mschout/build/lib/perl5/arch:/home/mschout/build/lib/perl5:/home/mschout/build/lib/perl5/site_perl/arch:/home/mschout/build/lib/perl5/site_perl"
PERL_LWP_USE_HTTP_10="1"
@INC:
/home/mschout/build/lib/perl5/arch
/home/mschout/build/lib/perl5
/home/mschout/build/lib/perl5/site_perl/arch
/home/mschout/build/lib/perl5/site_perl