git: f028010f4eac - stable/13 - sys/sys: Fix __builtin_is_aligned fallback
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 15 Jul 2024 12:38:25 UTC
The branch stable/13 has been updated by andrew:
URL: https://cgit.FreeBSD.org/src/commit/?id=f028010f4eac429f94ba15a7490ce28d5e8c80ff
commit f028010f4eac429f94ba15a7490ce28d5e8c80ff
Author: Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2024-05-22 08:18:26 +0000
Commit: Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-07-15 12:34:29 +0000
sys/sys: Fix __builtin_is_aligned fallback
When the compiler doesn't provide __builtin_is_aligned we use
macro as a fallback. The macro was missing brackets around one
argument. This could lead to incorrect results when the argument is
more complex than a single stagement.
Fix this by adding the needed brackets.
Reviewed by: brooks, imp, jhb
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D45260
(cherry picked from commit 940155d24afb5c80ce7fde59c856c5c0d5c6dbe1)
---
sys/sys/cdefs.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
index 080fcf27dba4..df15a3c04193 100644
--- a/sys/sys/cdefs.h
+++ b/sys/sys/cdefs.h
@@ -896,7 +896,7 @@
/* Provide fallback versions for other compilers (GCC/Clang < 10): */
#if !__has_builtin(__builtin_is_aligned)
#define __builtin_is_aligned(x, align) \
- (((__uintptr_t)x & ((align) - 1)) == 0)
+ (((__uintptr_t)(x) & ((align) - 1)) == 0)
#endif
#if !__has_builtin(__builtin_align_up)
#define __builtin_align_up(x, align) \