delorie.com/archives/browse.cgi | search |
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-workers-bounces using -f |
X-Recipient: | djgpp-workers AT delorie DOT com |
Message-ID: | <48198F50.9050604@iki.fi> |
Date: | Thu, 01 May 2008 12:37:20 +0300 |
From: | Andris Pavenis <andris DOT pavenis AT iki DOT fi> |
User-Agent: | Thunderbird 2.0.0.12 (X11/20080226) |
MIME-Version: | 1.0 |
To: | djgpp-workers AT delorie DOT com |
Subject: | gcc-4.3.0 strict aliasing warnings from ieeefp.h |
Reply-To: | djgpp-workers AT delorie DOT com |
This is a multi-part message in MIME format. --------------050100010509040205030103 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit I'm getting warnings about dereferencing type punned pointer when building libm with gcc-4.3.0. Attached patch fixes the problem Andris --------------050100010509040205030103 Content-Type: text/x-patch; name="ieeefp.h.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ieeefp.h.diff" Index: ieeefp.h =================================================================== RCS file: /cvs/djgpp/djgpp/include/ieeefp.h,v retrieving revision 1.2 diff -u -r1.2 ieeefp.h --- ieeefp.h 11 Dec 2007 07:27:40 -0000 1.2 +++ ieeefp.h 1 May 2008 09:30:39 -0000 @@ -72,14 +72,20 @@ #define __IEEE_DBL_NAN_EXP 0x7ff #define __IEEE_FLT_NAN_EXP 0xff +inline long __dj_float_content_as_long(float x) +{ + union { long long_val; float float_val; } tmp; + tmp.float_val = x; + return tmp.long_val; +} -#define isnanf(x) (((*(long *)(void *)&(x) & 0x7f800000L)==0x7f800000L) && \ - ((*(long *)(void *)&(x) & 0x007fffffL)!=0000000000L)) +#define isnanf(x) (((__dj_float_content_as_long(x) & 0x7f800000L)==0x7f800000L) && \ + ((__dj_float_content_as_long(x) & 0x007fffffL)!=0000000000L)) -#define isinff(x) (((*(long *)(void *)&(x) & 0x7f800000L)==0x7f800000L) && \ - ((*(long *)(void *)&(x) & 0x007fffffL)==0000000000L)) +#define isinff(x) (((__dj_float_content_as_long(x) & 0x7f800000L)==0x7f800000L) && \ + ((__dj_float_content_as_long(x) & 0x007fffffL)==0000000000L)) -#define finitef(x) (((*(long *)(void *)&(x) & 0x7f800000L)!=0x7f800000L)) +#define finitef(x) (((__dj_float_content_as_long(x) & 0x7f800000L)!=0x7f800000L)) #ifdef __cplusplus } --------------050100010509040205030103--
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |