[Bug 265181] Clang doesn't properly report the C++ error when float is used as an argument in bit-wise operators (only on armv6 some error is reported instead of reporting it on all architectures)
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 13 Jul 2022 05:06:10 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265181
--- Comment #6 from Mark Millard <marklmi26-fbsd@yahoo.com> ---
(In reply to Yuri Victorovich from comment #4)
clang is not what supplied bswap_32 :
/usr/include/infiniband/byteswap.h
provides:
#define bswap_32 bswap32
(I switch to /usr/src/ style paths starting here.)
/usr/13_0R-src/sys/sys/endian.h
provides:
#define bswap32(x) __bswap32(x)
You are welcome to go explore the range
architecture specific definitions in:
(The space then tab sequence in the []'s below likely will not make
it through the copy/paste sequence.)
# grep -r "define[ ]*\<__bswap32\>" /usr/13_0R-src/sys/ | more
/usr/13_0R-src/sys/arm64/include/endian.h:#define __bswap32(x) \
/usr/13_0R-src/sys/arm64/include/endian.h:#define __bswap32(x)
__bswap32_var(x)
/usr/13_0R-src/sys/arm/include/endian.h:#define __bswap32(x) \
/usr/13_0R-src/sys/arm/include/endian.h:#define __bswap32(x)
__bswap32_var(x)
/usr/13_0R-src/sys/x86/include/endian.h:#define __bswap32(x)
__builtin_bswap32(x)
/usr/13_0R-src/sys/riscv/include/endian.h:#define __bswap32(x) \
/usr/13_0R-src/sys/riscv/include/endian.h:#define __bswap32(x)
__bswap32_var(x)
/usr/13_0R-src/sys/mips/include/endian.h:#define __bswap32(x)
((__uint32_t)(__is_constant((x)) ? \
/usr/13_0R-src/sys/powerpc/include/endian.h:#define __bswap32(x)
(__is_constant(x) ? __bswap32_const(x) : \
But even with just that much of a grep, note the x86 using:
__builtin_bswap32(x)
which is not going to have any binary operators involved at all.
Such is not clang's problem for why that is different.
I'll note that FreeBSD's arm/include/endian.h definitions
are far from uniform for type handling:
static __inline __uint32_t
__bswap32_var(__uint32_t v)
{
__uint32_t t1;
__asm __volatile("eor %1, %0, %0, ror #16\n"
"bic %1, %1, #0x00ff0000\n"
"mov %0, %0, ror #8\n"
"eor %0, %0, %1, lsr #8\n"
: "+r" (v), "=r" (t1));
return (v);
}
. . .
#ifdef __OPTIMIZE__
#define __bswap32_constant(x) \
((((x) & 0xff000000U) >> 24) | \
(((x) & 0x00ff0000U) >> 8) | \
(((x) & 0x0000ff00U) << 8) | \
(((x) & 0x000000ffU) << 24))
. . .
#define __bswap32(x) \
((__uint32_t)(__builtin_constant_p(x) ? \
__bswap32_constant(x) : \
__bswap32_var(x)))
#else
#define __bswap16(x) __bswap16_var(x)
#define __bswap32(x) __bswap32_var(x)
#endif /* __OPTIMIZE__ */
__bswap32_var will not produce such binary operator
related messages. But, for __OPTIMIZE__, __bswap32_constant
usage will. So the __bswap32(x) usage will vary based
on constant expressions vs. non-constant expressions.
Again: Not clang++'s problem since it is not clang's set of
definitions. clang++ is doing what it is told to by the
language standard and code it was supplied.
--
You are receiving this mail because:
You are the assignee for the bug.