[comp.lang.perl] Perl-Users Digest #524, "unsigned long ints/mips/floats + FIX"

eichin@athena.mit.edu (Mark W. Eichin) (12/18/90)

I submitted this to perl-users for the MIPS and RT, but looks like it
applies to the Apollo too:

With my patch:
$ ./perl -e 'printf "%8x\n",unpack("N",pack("N",0x8000000f));'
8000000f

Without the patch (straight pl41):
$ perl -e 'printf "%8x\n",unpack("N",pack("N",0x8000000f));'
Floating exception
$ tb
Process        7341 (parent 3885, group 7341)
Time           90/12/17.16:45(EST)
Program        /usr/local/bin/perl
Status         00120025: floating point operand error (OS/fault handler)
In routine     "/usr/local/bin/perl" offset 88294
Called from    "/usr/local/bin/perl" offset 94664

It turns out that those addresses are in do_pack, in the case 'N',
line 580. Using aulong for along takes care of it (the U_L doesn't end
up being necessary, but that's "luck" ie it's defined as a simple
case, I think...)
						_Mark_

eichin@athena.mit.edu (Mark W. Eichin) (12/19/90)

(Yeah, I'm still banging on this one, but at least it is "relevant to
the Perl language"...) It turns out that the NeXT machine also needs
the "#ifdef mips" case in util.c:castulong() to function correctly.
This appears to be a bug in "fixunsdfsi" but I don't know 68K
assembler well enough to tell... however, setting castneg=undef and
duplicating the #ifdef mips clause as #ifdef NeXT produces a perl
which passes all normal tests *and* handles DES properly. (This isn't
just an example of bizarre perl code: I reduced the bug to
	% perl -e 'printf "%lu\n",0x80000000;'
	2147483647
which is clearly and obviously wrong. I think the castneg try.c test
has to be made *much* stronger, or else it should simply check #ifdef
vax and only pass that case :-) At very least, it needs to check some
real values near 1<<31 for conversions. It should also really
*compute* some of them; one of the compilers I tried had *different
behavior* depending on whether the float to long conversion was
"constant folded" (ie done in the compiler) or done at runtime...)
				_Mark_ <eichin@athena.mit.edu>
ps. Has anyone worked on more extensive Perl tests, comparable to SVVD
or maybe trip.tex? 
------ "Perl is APL on LSD" -- Seth Finkelstein -----