The following problem was encountered while trying to build Perl 5.x on a
CRAY SV1 system; "miniperl aborts with a "Error exit" during Perl make."
cc -o miniperl \
miniperlmain.o opmini.o libperl.a -lnsl -lmalloc -lc -lcrypt
./miniperl -w -Ilib -MExporter -e '<?>' || make minitest
sh: 66414 Error exit(coredump)
The Error exit is caused by a jump in Perl_filter_read() to a "invalid"
read_e_script() function address.
The problem arises when the following statement in Perl_filter_add() is used
to insert the 'pre-processing' function read_e_script() into the current source
input stream.
IoDIRP(datasv) = (DIR*)funcp; /* stash funcp into spare field */
The statement involves a cast form pointer-to-function to pointer-to-object
which subsequently causes the function address value to be converted to a word
(object) address. Probably not a problem on byte-addressable machines but this
casting results in the parcel bits being "lost" (shifted off) from the function
address. When the following statement is used in Perl_filter_read(() to "fetch"
the pre-processing function address
funcp = (filter_t)IoDIRP(datasv);
the cast from pointer-to-object to pointer-to-function results in the word
address being "restored" to a parcel address but the parcel bits will now
be zero. Consequently, the parcel address of 10531d for read_e_script() gets
transformed to 10351a. So now the (*funcp) call in Perl_read_filter()
return (*funcp)(idx, buf_sv, maxlen);
ends up jumping to a address which is 3 parcels shy of the read_e_script() entry
point in Perl_my_unexec() causing the third parcel of a A-register load (value
00002) to be executed as a ERR instruction.
The problem is evident from a "filter_debug" trace
Use of uninitialized value.
filter_add func 4567 ().
Use of uninitialized value.
filter_read 0: via function 4564 ()
Error exit (core dumped)
which shows filter_read using the incorrect function address. The low-order
two bits of the function address is the parcel address.
The problem occurred when building Perl versions 5.004_05 and 5.6_0.
./myconfig output:
Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
Platform:
osname=unicos, osvers=10.0.0.7, archname=CRAY_SV1-unicos
uname='sn9617 wind 10.0.0.7 roo.0 cray sv1 '
config_args=''
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
useperlio=undef d_sfio=undef uselargefiles=define
use64bitint=define use64bitall=define uselongdouble=undef usesocks=undef
Compiler:
cc='cc', optimize='-O1', gccversion=
cppflags=''
ccflags =''
stdchar='unsigned char', d_stdstdio=define, usevfork=false
intsize=8, longsize=8, ptrsize=8, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='int', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, usemymalloc=n, prototype=define
Linker and Libraries:
ld='ld', ldflags =''
libpth=/lib /usr/lib
libs=-lnsl -lmalloc -lc -lcrypt
libc=/lib/libc.a, so=none, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_none.xs, dlext=none, d_dlsymun=undef, ccdlflags=''
cccdlflags='', lddlflags=''
Please contact me if you need additional information.
Regards,
Gordon Miller
+--------------------------------------------------------+
Gordon J. Miller | email: gjm@cray.com |
Cray Inc. | phone: 651-683-5707 |
Software Product Support | FAX: 651-683-5307 |
+--------------------------------------------------------+Cray Inc. | phone: 651-683-5707 |
Software Product Support | FAX: 651-683-5307 |
In the path of our happiness shall we find the
learning for which we have chosen this lifetime.
- Richard Bach "Illusions"
If God had meant man to fly,
He would have given him more money.