[PATCH] sys/cdefs.h: Protect parameters to __builtin_is_aligned()
Paul Cercueil <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <[email protected]> |
The macro was not protecting properly its first parameter, which caused it to silently return an invalid value when passing a composed parameter, ie. __builtin_is_aligned(src | dst | len, 32); Signed-off-by: Paul Cercueil <[email protected]> --- newlib/libc/include/sys/cdefs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/newlib/libc/include/sys/cdefs.h b/newlib/libc/include/sys/cdefs.h index d13a92a79..20b3553dc 100644 --- a/newlib/libc/include/sys/cdefs.h +++ b/newlib/libc/include/sys/cdefs.h @@ -736,7 +736,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) \ -- 2.47.2