From ef2d312d3309ac1c38d04eea6f4d58872505013a Mon Sep 17 00:00:00 2001 From: Tom Horsley Date: Wed, 30 Jul 1997 13:24:15 +1200 Subject: [PATCH] work around compiler bug on CX/UX (perl5.004_01) This patch provides a work-around for a compiler bug on CX/UX systems (which shows up as a failure in the 'w' format of pack). The CXUX_BROKEN_CONSTANT_CONVERT ifdef flag is added to the hints/cxux.sh compiler and pp.c is modified to avoid a compile time constant conversion which fails based on that ifdef. While I was in the hints file, I also added the magical -Qtarget=M88110compat compiler option which makes it build code that will run on both 88110 and 88100 CX/UX machines interchangably. This patch was generated from a brand new copy of perl5.004_01, so I'm confident there are no extraneous changes that slipped in. I even built and tested and it passed all tests. (I decided to go with option #3 in my previous mail about how to do the patch). If its too late for 5.004_02, I wouldn't worry - it isn't very critical. p5p-msgid: 9707301934.AA18594@amber.ssd.hcsc.com --- hints/cxux.sh | 16 +++++++++------- pp.c | 15 +++++++++++++++ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/hints/cxux.sh b/hints/cxux.sh index 42bfe5d..e3ac086 100644 --- a/hints/cxux.sh +++ b/hints/cxux.sh @@ -61,16 +61,18 @@ libswanted=`echo ' '$libswanted' ' | sed -e 's/ malloc / /'` # glibpth="/usr/sde/elf/usr/lib $glibpth" -# Need to use Concurrent cc for most of these options to be meaningful (if you -# want to get this to work with gcc, you're on your own :-). Passing +# Need to use Concurrent cc for most of these options to be meaningful (if +# you want to get this to work with gcc, you're on your own :-). Passing # -Bexport to the linker when linking perl is important because it leaves # the interpreter internal symbols visible to the shared libs that will be -# loaded on demand (and will try to reference those symbols). The -u -# option to drag 'sigaction' into the perl main program is to make sure -# it gets defined for the posix shared library (for some reason sigaction -# is static, rather than being defined in libc.so.1). +# loaded on demand (and will try to reference those symbols). The -u option +# to drag 'sigaction' into the perl main program is to make sure it gets +# defined for the posix shared library (for some reason sigaction is static, +# rather than being defined in libc.so.1). The 88110compat option makes sure +# the code will run on both 88100 and 88110 machines. The define is added to +# trigger a work around for a compiler bug which shows up in pp.c. # -cc='/bin/cc -Xa' +cc='/bin/cc -Xa -Qtarget=M88110compat -DCXUX_BROKEN_CONSTANT_CONVERT' cccdlflags='-Zelf -Zpic' ccdlflags='-Zelf -Zlink=dynamic -Wl,-Bexport -u sigaction' lddlflags='-Zlink=so' diff --git a/pp.c b/pp.c index d791c4b..a0b337a 100644 --- a/pp.c +++ b/pp.c @@ -16,6 +16,17 @@ #include "perl.h" /* + * The compiler on Concurrent CX/UX systems has a subtle bug which only + * seems to show up when compiling pp.c - it generates the wrong double + * precision constant value for (double)UV_MAX when used inline in the body + * of the code below, so this makes a static variable up front (which the + * compiler seems to get correct) and uses it in place of UV_MAX below. + */ +#ifdef CXUX_BROKEN_CONSTANT_CONVERT +static double UV_MAX_cxux = ((double)UV_MAX); +#endif + +/* * Types used in bitwise operations. * * Normally we'd just use IV and UV. However, some hardware and @@ -3714,8 +3725,12 @@ PP(pp_pack) #ifdef BW_BITS adouble <= BW_MASK #else +#ifdef CXUX_BROKEN_CONSTANT_CONVERT + adouble <= UV_MAX_cxux +#else adouble <= UV_MAX #endif +#endif ) { char buf[1 + sizeof(UV)]; -- 2.7.4