$NetBSD: patch-ad,v 1.9 2001/09/05 17:13:41 jlam Exp $ --- pp.c.orig Sat Apr 7 23:09:16 2001 +++ pp.c Sat Sep 1 03:57:59 2001 @@ -1900,6 +1900,28 @@ } } +/* + * There are strange code-generation bugs caused on sparc64 by gcc-2.95.2. + * These need to be revisited when a newer toolchain becomes available. + */ +#if defined(__sparc64__) && defined(__GNUC__) +#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 96) +#undef SPARC64_WORKAROUND +#define SPARC64_WORKAROUND 1 +#endif +#endif + +#if defined(SPARC64_WORKAROUND) +double +sparc64_workaround_modf(double theVal, double *theIntRes) +{ + double res, ret; + ret = modf(theVal, &res); + *theIntRes = res; + return ret; +} +#endif + PP(pp_int) { dSP; dTARGET; @@ -1913,6 +1935,9 @@ } else { if (value >= 0.0) { +#if defined(SPARC64_WORKAROUND) + (void)sparc64_workaround_modf(value, &value); +#else #if defined(HAS_MODFL) || defined(LONG_DOUBLE_EQUALS_DOUBLE) (void)Perl_modf(value, &value); #else @@ -1920,6 +1945,7 @@ (void)Perl_modf(tmp, &tmp); value = (NV)tmp; #endif +#endif /* SPARC64_WORKAROUND */ } else { #if defined(HAS_MODFL) || defined(LONG_DOUBLE_EQUALS_DOUBLE)