summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2010-06-10 14:34:51 +0200
committerAndy Wingo <wingo@pobox.com>2010-06-10 14:34:51 +0200
commit2462fad237296ee97d7b66f2854c35bb133ccaf2 (patch)
tree135ddcb411c48df9b07e62038f834cbbbca74112
parent899a17a78389880e041c4ac5a54c099b4a8adc17 (diff)
downloadguile-2462fad237296ee97d7b66f2854c35bb133ccaf2.tar.gz
avoid type-punning errors in guile_ieee_init on OSF
* libguile/numbers.c (guile_ieee_init): Avoid type-punning errors on OSF. Thanks to Jay Krell for the report.
-rw-r--r--libguile/numbers.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/libguile/numbers.c b/libguile/numbers.c
index 919087669..bd806260a 100644
--- a/libguile/numbers.c
+++ b/libguile/numbers.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
*
* Portions Copyright 1990, 1991, 1992, 1993 by AT&T Bell Laboratories
* and Bellcore. See scm_divide.
@@ -620,7 +620,14 @@ guile_ieee_init (void)
#elif HAVE_DINFINITY
/* OSF */
extern unsigned int DINFINITY[2];
- guile_Inf = (*((double *) (DINFINITY)));
+ union
+ {
+ double d;
+ int i[2];
+ } alias;
+ alias.i[0] = DINFINITY[0];
+ alias.i[1] = DINFINITY[1];
+ guile_Inf = alias.d;
#else
double tmp = 1e+10;
guile_Inf = tmp;
@@ -651,7 +658,14 @@ guile_ieee_init (void)
{
/* OSF */
extern unsigned int DQNAN[2];
- guile_NaN = (*((double *)(DQNAN)));
+ union
+ {
+ double d;
+ int i[2];
+ } alias;
+ alias.i[0] = DQNAN[0];
+ alias.i[1] = DQNAN[1];
+ guile_NaN = alias.d;
}
#else
guile_NaN = guile_Inf / guile_Inf;