diff --git a/library/common.h b/library/common.h index e502b5de13..3925a79ce5 100644 --- a/library/common.h +++ b/library/common.h @@ -73,11 +73,12 @@ extern void (*mbedtls_test_hook_test_fail)( const char * test, int line, const c * * This list is incomplete. */ -#if defined(__i386__) || defined(__amd64__) || defined( __x86_64__) \ +#if (defined(__i386__) || defined(__amd64__) || defined( __x86_64__) \ || defined(__ARM_FEATURE_UNALIGNED) \ || defined(__aarch64__) \ || defined(__ARM_ARCH_8__) || defined(__ARM_ARCH_8A__) || defined(__ARM_ARCH_8M__) \ - || defined(__ARM_ARCH_7A__) + || defined(__ARM_ARCH_7A__)) \ + && (!(defined(__has_feature) && __has_feature(undefined_behavior_sanitizer))) #define MBEDTLS_ALLOW_UNALIGNED_ACCESS #endif