https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108695

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I am 99% sure there is aliasing violations in this code too:
#if _MSC_VER
#define GETU32(p) SWAP(*((u32 *)(p)))
#define PUTU32(ct, st)                                                  \
        {                                                               \
                *((u32 *)(ct)) = SWAP((st));                            \
        }
#else   /* _MSC_VER */
# if __BYTE_ORDER == __BIG_ENDIAN
#define GETU32(p) *((u32*)(p))
#define PUTU32(ct, st) *((u32*)(ct)) = (st)
#else   /* BIG_ENDIAN */
#if 0 //def HAVE_LINUX_SWAB_H
#define GETU32(p) __swab32(*((u32*)(p)))
#define PUTU32(ct, st) *((u32*)(ct)) = __swab32((st))
#else   /* __GNUC__ */
#include <netinet/in.h>
#define GETU32(p) ntohl(*((u32*)(p)))
#define PUTU32(ct, st) *((u32*)(ct)) = htonl((st))
#endif  /* __GNUC__ */
#endif  /* BIG_ENDIAN */
#endif  /*_MSC_VER */

#if 0
#define GETU32(pt) (((u32)(pt)[0] << 24) ^ ((u32)(pt)[1] << 16) ^ ((u32)(pt)[2]
<< 8) ^ ((u32)(pt)[3]))
#define PUTU32(ct, st)                                                  \
        {                                                               \
                (ct)[0] = (u8)((st) >> 24);                             \
                (ct)[1] = (u8)((st) >> 16);                             \
                (ct)[2] = (u8)((st) >> 8);                              \
                (ct)[3] = (u8)(st);                                     \
        }
#endif

A few other places too ...

Reply via email to