From: Joerg Sonnenberger Date: Sat, 29 Apr 2017 16:54:29 +0000 (+0200) Subject: Don't check unaligned access in ubsan for GCC. X-Git-Tag: v3.3.2~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b9a3b070d3bb7731e2aad8a448e6e7f3938dcdf3;p=thirdparty%2Flibarchive.git Don't check unaligned access in ubsan for GCC. --- diff --git a/libarchive/xxhash.c b/libarchive/xxhash.c index 6f5ba52fa..70750bae0 100644 --- a/libarchive/xxhash.c +++ b/libarchive/xxhash.c @@ -141,13 +141,19 @@ typedef struct _U32_S { U32 v; } _PACKED U32_S; # pragma pack(pop) #endif -#define A32(x) (((const U32_S *)(x))->v) - /**************************************** ** Compiler-specific Functions and Macros *****************************************/ -#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) +#define GCC_VERSION ((__GNUC__-0) * 100 + (__GNUC_MINOR__ - 0)) + +#if GCC_VERSION >= 409 +__attribute__((__no_sanitize_undefined__)) +#endif +static inline U32 A32(const void * x) +{ + return (((const U32_S *)(x))->v); +} /* Note : although _rotl exists for minGW (GCC under windows), performance seems poor */ #if defined(_MSC_VER)