Skip to content

Fix ubsan build on freebsd regarding float. #15935

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion Zend/zend_operators.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,20 @@
#include <stddef.h>

#ifdef HAVE_IEEEFP_H
#include <ieeefp.h>
/**
* 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 <ieeefp.h>
# if __has_feature(undefined_behavior_sanitizer) && defined(__FreeBSD__) && defined(__clang__)
# pragma clang attribute pop
# endif
#endif

#include "zend_portability.h"
Expand Down
Loading