Mail Archives: djgpp-workers/2008/07/16/13:20:46
This is a multi-part message in MIME format.
--------------020406020505050405090709
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Patch fixes some strict aliasing warnings from GCC-4.3.1.
Does it look OK?
Andris
--------------020406020505050405090709
Content-Type: text/plain;
name="aliasing-warn.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="aliasing-warn.diff"
Index: include/ieeefp.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/ieeefp.h,v
retrieving revision 1.2
diff -p -r1.2 ieeefp.h
*** include/ieeefp.h 11 Dec 2007 07:27:40 -0000 1.2
--- include/ieeefp.h 16 Jul 2008 17:12:28 -0000
*************** extern "C" {
*** 7,12 ****
--- 7,13 ----
#endif
#include <sys/cdefs.h>
+ #include <sys/djtypes.h>
/* #include <machine/ieeefp.h> */
#include <machine/endian.h>
*************** int _EXFUN(finitef, (float));
*** 72,85 ****
#define __IEEE_DBL_NAN_EXP 0x7ff
#define __IEEE_FLT_NAN_EXP 0xff
! #define isnanf(x) (((*(long *)(void *)&(x) & 0x7f800000L)==0x7f800000L) && \
! ((*(long *)(void *)&(x) & 0x007fffffL)!=0000000000L))
! #define isinff(x) (((*(long *)(void *)&(x) & 0x7f800000L)==0x7f800000L) && \
! ((*(long *)(void *)&(x) & 0x007fffffL)==0000000000L))
!
! #define finitef(x) (((*(long *)(void *)&(x) & 0x7f800000L)!=0x7f800000L))
#ifdef __cplusplus
}
--- 73,85 ----
#define __IEEE_DBL_NAN_EXP 0x7ff
#define __IEEE_FLT_NAN_EXP 0xff
+ #define isnanf(x) (((*(__dj_long_a *)&(x) & 0x7f800000L)==0x7f800000L) && \
+ ((*(__dj_long_a *)&(x) & 0x007fffffL)!=0000000000L))
! #define isinff(x) (((*(__dj_long_a *)&(x) & 0x7f800000L)==0x7f800000L) && \
! ((*(__dj_long_a *)&(x) & 0x007fffffL)==0000000000L))
! #define finitef(x) (((*(__dj_long_a *)&(x) & 0x7f800000L)!=0x7f800000L))
#ifdef __cplusplus
}
Index: include/sys/djtypes.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/sys/djtypes.h,v
retrieving revision 1.13
diff -p -r1.13 djtypes.h
*** include/sys/djtypes.h 11 Dec 2007 07:48:42 -0000 1.13
--- include/sys/djtypes.h 16 Jul 2008 17:12:28 -0000
***************
*** 36,39 ****
--- 36,47 ----
#define __DJ_wint_t typedef int wint_t;
+ /* Define internal type to be used for avoiding strict
+ aliasing warnings */
+ #if (__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ > 3))
+ typedef long __attribute__((__may_alias__)) __dj_long_a;
+ #else
+ typedef long __dj_long_a;
+ #endif
+
#endif
Index: src/libemu/src/emu387.cc
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libemu/src/emu387.cc,v
retrieving revision 1.17
diff -p -r1.17 emu387.cc
*** src/libemu/src/emu387.cc 11 Jun 2008 14:24:53 -0000 1.17
--- src/libemu/src/emu387.cc 16 Jul 2008 17:12:31 -0000
*************** static void fsqrt()
*** 2363,2374 ****
st().exp++;
}
int exp = (st().exp - EXP_BIAS - 1)/2 - 64;
! while (!(((long *)(void *)&result)[1] & 0x80000000))
{
/* GCC between 2.8 and EGCS 1.1.1 optimizes this loop
all wrong; the asm works around it. */
asm volatile("" : : : "memory");
! left = (left << 2) + (((unsigned *)(void *)&val)[1] >> 30);
djshld(&val);
djshld(&val);
if (left >= side*2 + 1)
--- 2363,2374 ----
st().exp++;
}
int exp = (st().exp - EXP_BIAS - 1)/2 - 64;
! while (!(((__dj_long_a *)&result)[1] & 0x80000000))
{
/* GCC between 2.8 and EGCS 1.1.1 optimizes this loop
all wrong; the asm works around it. */
asm volatile("" : : : "memory");
! left = (left << 2) + (((__dj_long_a *)&val)[1] >> 30);
djshld(&val);
djshld(&val);
if (left >= side*2 + 1)
--------------020406020505050405090709--
- Raw text -