diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 98b10c2096ca2..f8c901b149806 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -28,7 +28,20 @@ #include #ifdef HAVE_IEEEFP_H -#include +/** + * On FreeBSD with ubsan/clang we get the following: + * `/usr/include/machine/ieeefp.h:161:17: runtime error: left shift of negative value -1` + * `SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /usr/include/machine/ieeefp.h:161:17` + * ... + * `_newcw |= (~_m << FP_MSKS_OFF) & FP_MSKS_FLD;` +**/ +# if __has_feature(undefined_behavior_sanitizer) && defined(__FreeBSD__) && defined(__clang__) +# pragma clang attribute push (__attribute__((no_sanitize("undefined"))), apply_to=function) +# endif +# include +# if __has_feature(undefined_behavior_sanitizer) && defined(__FreeBSD__) && defined(__clang__) +# pragma clang attribute pop +# endif #endif #include "zend_portability.h"