From e67aeab17662a70a2316911b8ee5b43fdf6f7241 Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Fri, 8 Jun 2001 14:15:32 +0000 Subject: [PATCH] Be inspired more by Hugo-- introduce HAS_MODFL_POW32_BUG. p4raw-id: //depot/perl@10479 --- Configure | 8 ++++++-- Porting/Glossary | 7 +++++++ Porting/config.sh | 9 +++++---- Porting/config_H | 10 +++++++++- config_h.SH | 8 ++++++++ configure.com | 1 + epoc/config.sh | 1 + pp.c | 18 ++++++++++++++++++ uconfig.h | 22 +++++++++++++++------- uconfig.sh | 12 ++++++------ vos/config.alpha.def | 1 + vos/config.ga.def | 1 + win32/config.bc | 1 + win32/config.gc | 1 + win32/config.vc | 1 + 15 files changed, 81 insertions(+), 20 deletions(-) diff --git a/Configure b/Configure index df35742..7ba331a 100755 --- a/Configure +++ b/Configure @@ -20,7 +20,7 @@ # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $ # -# Generated on Fri Jun 8 02:03:31 EET DST 2001 [metaconfig 3.0 PL70] +# Generated on Fri Jun 8 18:06:31 EET DST 2001 [metaconfig 3.0 PL70] # (with additional metaconfig patches by perlbug@perl.org) cat >c1$$ <&4 "Your modfl() is broken for large values." - d_modfl="$undef" + d_modfl_pow32_bug="$define" case "$foo" in glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()." ;; @@ -16444,6 +16447,7 @@ d_mkstemps='$d_mkstemps' d_mktime='$d_mktime' d_mmap='$d_mmap' d_modfl='$d_modfl' +d_modfl_pow32_bug='$d_modfl_pow32_bug' d_mprotect='$d_mprotect' d_msg='$d_msg' d_msg_ctrunc='$d_msg_ctrunc' diff --git a/Porting/Glossary b/Porting/Glossary index aef6a26..6995d08 100644 --- a/Porting/Glossary +++ b/Porting/Glossary @@ -1005,6 +1005,13 @@ d_modfl (d_modfl.U): This variable conditionally defines the HAS_MODFL symbol, which indicates to the C program that the modfl() routine is available. +d_modfl_pow32_bug (d_modfl.U): + This variable conditionally defines the HAS_MODFL_POW32_BUG symbol, + which indicates that modfl() is broken for long doubles >= pow(2, 32). + For example from 4294967303.150000 one would get 4294967302.000000 + and 1.150000. The bug has been seen in certain versions of glibc, + release 2.2.2 is known to be okay. + d_mprotect (d_mprotect.U): This variable conditionally defines HAS_MPROTECT if mprotect() is available to modify the access protection of a memory mapped file. diff --git a/Porting/config.sh b/Porting/config.sh index 51ec9c3..f225a7b 100644 --- a/Porting/config.sh +++ b/Porting/config.sh @@ -8,7 +8,7 @@ # Package name : perl5 # Source directory : . -# Configuration time: Fri Jun 8 04:49:05 EET DST 2001 +# Configuration time: Fri Jun 8 18:08:58 EET DST 2001 # Configured by : jhi # Target system : osf1 alpha.hut.fi v4.0 878 alpha @@ -63,7 +63,7 @@ ccsymbols='__alpha=1 __LANGUAGE_C__=1 __osf__=1 __unix__=1 _LONGLONG=1 _SYSTYPE_ ccversion='V5.6-082' cf_by='jhi' cf_email='yourname@yourhost.yourplace.com' -cf_time='Fri Jun 8 04:49:05 EET DST 2001' +cf_time='Fri Jun 8 18:08:58 EET DST 2001' charsize='1' chgrp='' chmod='' @@ -243,6 +243,7 @@ d_mkstemps='undef' d_mktime='define' d_mmap='define' d_modfl='undef' +d_modfl_pow32_bug='undef' d_mprotect='define' d_msg='define' d_msg_ctrunc='define' @@ -669,7 +670,7 @@ patchlevel='7' path_sep=':' perl5='/u/vieraat/vieraat/jhi/Perl/bin/perl' perl='' -perl_patchlevel='10438' +perl_patchlevel='10475' perladmin='yourname@yourhost.yourplace.com' perllibs='-lm -liconv -lutil -lpthread -lexc' perlpath='/opt/perl/bin/perl' @@ -864,7 +865,7 @@ PERL_SUBVERSION=1 PERL_API_REVISION=5 PERL_API_VERSION=5 PERL_API_SUBVERSION=0 -PERL_PATCHLEVEL=10438 +PERL_PATCHLEVEL=10475 PERL_CONFIG_SH=true # Variables propagated from previous config.sh file. pp_sys_cflags='ccflags="$ccflags -DNO_EFF_ONLY_OK"' diff --git a/Porting/config_H b/Porting/config_H index ede0f5b..fa60e91 100644 --- a/Porting/config_H +++ b/Porting/config_H @@ -17,7 +17,7 @@ /* * Package name : perl5 * Source directory : . - * Configuration time: Fri Jun 8 04:49:05 EET DST 2001 + * Configuration time: Fri Jun 8 18:08:58 EET DST 2001 * Configured by : jhi * Target system : osf1 alpha.hut.fi v4.0 878 alpha */ @@ -1780,7 +1780,15 @@ * available to split a long double x into a fractional part f and * an integer part i such that |f| < 1.0 and (f + i) = x. */ +/* HAS_MODFL_POW32_BUG: + * This symbol, if defined, indicates that the modfl routine is + * broken for long doubles >= pow(2, 32). + * For example from 4294967303.150000 one would get 4294967302.000000 + * and 1.150000. The bug has been seen in certain versions of glibc, + * release 2.2.2 is known to be okay. + */ /*#define HAS_MODFL / **/ +/*#define HAS_MODFL_POW32_BUG / **/ /* HAS_MPROTECT: * This symbol, if defined, indicates that the mprotect system call is diff --git a/config_h.SH b/config_h.SH index b8a2481..b3a8c7e 100644 --- a/config_h.SH +++ b/config_h.SH @@ -1800,7 +1800,15 @@ sed <$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un * available to split a long double x into a fractional part f and * an integer part i such that |f| < 1.0 and (f + i) = x. */ +/* HAS_MODFL_POW32_BUG: + * This symbol, if defined, indicates that the modfl routine is + * broken for long doubles >= pow(2, 32). + * For example from 4294967303.150000 one would get 4294967302.000000 + * and 1.150000. The bug has been seen in certain versions of glibc, + * release 2.2.2 is known to be okay. + */ #$d_modfl HAS_MODFL /**/ +#$d_modfl_pow32_bug HAS_MODFL_POW32_BUG /**/ /* HAS_MPROTECT: * This symbol, if defined, indicates that the mprotect system call is diff --git a/configure.com b/configure.com index aae059e..b18a1ca 100644 --- a/configure.com +++ b/configure.com @@ -5124,6 +5124,7 @@ $ WC "d_mkstemps='" + d_mkstemps + "'" $ WC "d_mktime='" + d_mktime + "'" $ WC "d_mmap='undef'" $ WC "d_modfl='" + d_modfl + "'" +$ WC "d_modfl_pow32_bug = "undef"' $ WC "d_mprotect='undef'" $ WC "d_msg='undef'" $ WC "d_msg_ctrunc='undef'" diff --git a/epoc/config.sh b/epoc/config.sh index b2e3fe6..e9a5cd6 100644 --- a/epoc/config.sh +++ b/epoc/config.sh @@ -232,6 +232,7 @@ d_mkfifo='undef' d_mktime='define' d_mmap='undef' d_modfl='undef' +d_modfl_pow32_bug='undef' d_mprotect='undef' d_msg='undef' d_msg_ctrunc='undef' diff --git a/pp.c b/pp.c index a8b3e55..ebdf3fd 100644 --- a/pp.c +++ b/pp.c @@ -2598,7 +2598,16 @@ PP(pp_int) SETu(U_V(value)); } else { #if defined(HAS_MODFL) || defined(LONG_DOUBLE_EQUALS_DOUBLE) +# ifdef HAS_MODFL_POW32_BUG +/* some versions of glibc split (i + d) into (i-1, d+1) for 2^32 <= i < 2^64 */ + { + NV offset = Perl_modf(value, &value); + (void)Perl_modf(offset, &offset); + value += offset; + } +# else (void)Perl_modf(value, &value); +# endif #else double tmp = (double)value; (void)Perl_modf(tmp, &tmp); @@ -2612,7 +2621,16 @@ PP(pp_int) SETi(I_V(value)); } else { #if defined(HAS_MODFL) || defined(LONG_DOUBLE_EQUALS_DOUBLE) +# ifdef HAS_MODFL_POW32_BUG +/* some versions of glibc split (i + d) into (i-1, d+1) for 2^32 <= i < 2^64 */ + { + NV offset = Perl_modf(-value, &value); + (void)Perl_modf(offset, &offset); + value += offset; + } +# else (void)Perl_modf(-value, &value); +# endif value = -value; #else double tmp = (double)value; diff --git a/uconfig.h b/uconfig.h index 0c788f1..7084a28 100644 --- a/uconfig.h +++ b/uconfig.h @@ -980,9 +980,9 @@ * This symbol contains the value of sizeof(short) so that the C * preprocessor can make decisions based on it. */ -#define INTSIZE 1 /**/ +#define INTSIZE 4 /**/ #define LONGSIZE 4 /**/ -#define SHORTSIZE 1 /**/ +#define SHORTSIZE 2 /**/ /* MULTIARCH: * This symbol, if defined, signifies that the build @@ -1703,7 +1703,7 @@ */ /*#define HAS_LONG_DOUBLE / **/ #ifdef HAS_LONG_DOUBLE -#define LONG_DOUBLESIZE 1 /**/ +#define LONG_DOUBLESIZE 8 /**/ #endif /* HAS_LONG_LONG: @@ -1716,7 +1716,7 @@ */ /*#define HAS_LONG_LONG / **/ #ifdef HAS_LONG_LONG -#define LONGLONGSIZE 1 /**/ +#define LONGLONGSIZE 8 /**/ #endif /* HAS_LSEEK_PROTO: @@ -1776,7 +1776,15 @@ * available to split a long double x into a fractional part f and * an integer part i such that |f| < 1.0 and (f + i) = x. */ +/* HAS_MODFL_POW32_BUG: + * This symbol, if defined, indicates that the modfl routine is + * broken for long doubles >= pow(2, 32). + * For example from 4294967303.150000 one would get 4294967302.000000 + * and 1.150000. The bug has been seen in certain versions of glibc, + * release 2.2.2 is known to be okay. + */ /*#define HAS_MODFL / **/ +/*#define HAS_MODFL_POW32_BUG / **/ /* HAS_MPROTECT: * This symbol, if defined, indicates that the mprotect system call is @@ -2685,8 +2693,8 @@ * This symbol holds the number of bytes used by the Off_t. */ #define Off_t int /* type */ -#define LSEEKSIZE 1 /* size */ -#define Off_t_size 1 /* size */ +#define LSEEKSIZE 4 /* size */ +#define Off_t_size 4 /* size */ /* Free_t: * This variable contains the return type of free(). It is usually @@ -3075,7 +3083,7 @@ /* Size_t_size: * This symbol holds the size of a Size_t in bytes. */ -#define Size_t_size 1 /* */ +#define Size_t_size 4 /* */ /* Size_t: * This symbol holds the type used to declare length parameters diff --git a/uconfig.sh b/uconfig.sh index a6765d4..5fdadea 100755 --- a/uconfig.sh +++ b/uconfig.sh @@ -174,6 +174,7 @@ d_mkstemps='undef' d_mktime='undef' d_mmap='undef' d_modfl='undef' +d_modfl_pow32_bug='undef' d_mprotect='undef' d_msg='undef' d_msg_ctrunc='undef' @@ -460,15 +461,14 @@ inc_version_list_init='NULL' installstyle='lib/perl5' installusrbinperl='undef' intsize='4' -intsize=1 ivdformat='"ld"' ivsize='4' ivtype='long' lib_ext='.a' -longdblsize=1 -longlongsize=1 +longdblsize=8 +longlongsize=8 longsize='4' -lseeksize=1 +lseeksize=4 lseektype=int malloctype='int*' malloctype='void *' @@ -526,12 +526,12 @@ seedfunc='srand' selectminbits='32' selecttype=int shmattype='void *' -shortsize=1 +shortsize=2 sig_name_init='0' sig_num_init='0' sig_size='1' signal_t=int -sizesize=1 +sizesize=4 sizetype=int socksizetype='int' ssizetype=int diff --git a/vos/config.alpha.def b/vos/config.alpha.def index e532eac..18be779 100644 --- a/vos/config.alpha.def +++ b/vos/config.alpha.def @@ -157,6 +157,7 @@ $d_mkstemps='undef' $d_mktime='define' $d_mmap='undef' $d_modfl='undef' +$d_modfl_pow32_bug='undef' $d_mprotect='undef' $d_msg='undef' $d_msg_ctrunc='undef' diff --git a/vos/config.ga.def b/vos/config.ga.def index 56410e2..823bdb0 100644 --- a/vos/config.ga.def +++ b/vos/config.ga.def @@ -157,6 +157,7 @@ $d_mkstemps='undef' $d_mktime='define' $d_mmap='define' $d_modfl='undef' +$d_modfl_pow32_bug='undef' $d_mprotect='undef' $d_msg='undef' $d_msg_ctrunc='undef' diff --git a/win32/config.bc b/win32/config.bc index b8ee924..ee160fd 100644 --- a/win32/config.bc +++ b/win32/config.bc @@ -227,6 +227,7 @@ d_mkstemps='undef' d_mktime='define' d_mmap='undef' d_modfl='undef' +d_modfl_pow32_bug='undef' d_mprotect='undef' d_msg='undef' d_msg_ctrunc='undef' diff --git a/win32/config.gc b/win32/config.gc index 61438a0..8adbe23 100644 --- a/win32/config.gc +++ b/win32/config.gc @@ -227,6 +227,7 @@ d_mkstemps='undef' d_mktime='define' d_mmap='undef' d_modfl='undef' +d_modfl_pow32_bug='undef' d_mprotect='undef' d_msg='undef' d_msg_ctrunc='undef' diff --git a/win32/config.vc b/win32/config.vc index a7e5a1c..5a7b20d 100644 --- a/win32/config.vc +++ b/win32/config.vc @@ -227,6 +227,7 @@ d_mkstemps='undef' d_mktime='define' d_mmap='undef' d_modfl='undef' +d_modfl_pow32_bug='undef' d_mprotect='undef' d_msg='undef' d_msg_ctrunc='undef' -- 2.7.4