git: e63ac0eb580b - stable/14 - sys/sys: Fix __builtin_is_aligned fallback
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 15 Jul 2024 12:38:21 UTC
The branch stable/14 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=e63ac0eb580b287201eb7a8aa3644d6c249a9cce commit e63ac0eb580b287201eb7a8aa3644d6c249a9cce 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:26:34 +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 4893ae1662b8..84411e8e4b16 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -913,7 +913,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) \