develooper Front page | perl.perl5.porters | Postings from June 2001

[PATCH: perl@10996] avoid overflow in numeric.c:S_mulexp10() on VAX

Thread Next
From:
Peter Prymmer
Date:
June 27, 2001 19:25
Subject:
[PATCH: perl@10996] avoid overflow in numeric.c:S_mulexp10() on VAX
Message ID:
Pine.OSF.4.10.10106271922120.465082-100000@aspara.forte.com

This helped the build on the VAX for modules that needed to scan ahead
for floating point number (like $VERSION???), quite platform specific, but
the damage appear to be limited to older compilers on the VAX:

--- perl/numeric.c.orig	Tue Jun 26 06:29:24 2001
+++ perl/numeric.c	Wed Jun 27 19:18:17 2001
@@ -562,6 +562,14 @@
 	negative = 1;
 	exponent = -exponent;
     }
+#ifdef __VAX /* avoid %SYSTEM-F-FLTOVF_F sans VAXC$ESTABLISH */
+#  if defined(__DECC_VER) && __DECC_VER <= 50390006
+    /* __F_FLT_MAX_10_EXP - 5 == 33 */
+    if (!negative &&
+          (log10(value) + exponent) >= (__F_FLT_MAX_10_EXP - 5))
+        return NV_MAX;
+#  endif
+#endif
     for (bit = 1; exponent; bit <<= 1) {
 	if (exponent & bit) {
 	    exponent ^= bit;
End of Patch.

BTW the build of Time/HiRes fails with:

CC/DECC
/Include=[]/Standard=Relaxed_ANSI/Prefix=All/Obj=.obj/NoList/Define=("VERSION=""1.21""","XS_VERSION=""1.21""")/Include=([---])/Optimize
HIRES.c
        static __int64 base_adjust=0;
        ...............^
%CC-E-DECLARATION, Invalid declaration.
                At line number 110 in hires.xs.

         __int64 quad;
        .........^
%CC-E-NOSEMI, Missing ";".
                At line number 116 in hires.xs.

         __qdiv_t ans1,ans2;
        ..........^
%CC-E-NOSEMI, Missing ";".
                At line number 117 in hires.xs.

         if (base_adjust==0) { /* Need to determine epoch adjustment */
        .....^
%CC-E-UNDECLARED, In this statement, "base_adjust" is not declared.
                At line number 127 in hires.xs.

         ret=sys$gettim(&quad); /* Get VMS system time */
        .................^
%CC-E-UNDECLARED, In this statement, "quad" is not declared.
                At line number 135 in hires.xs.

                ans1=qdiv(quad,DIV_100NS_TO_SECS);
        ........^
%CC-E-UNDECLARED, In this statement, "ans1" is not declared.
                At line number 138 in hires.xs.

                ans1=qdiv(quad,DIV_100NS_TO_SECS);
        .............^
%CC-I-IMPLICITFUNC, In this statement, the identifier "qdiv" is implicitly
 declared as a function.
                At line number 138 in hires.xs.

                ans2=qdiv(ans1.rem,DIV_100NS_TO_USECS);

etcetera.

Peter Prymmer



Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About