The elf/tst-cpu-features-supports (and other tests that check for
CPU features) triggers the following issue with ubsan:
UBSAN: Undefined behaviour in ../sysdeps/x86/sys/platform/x86.h:59:42 left shift of 1 by 31 cannot be represented in type 'int'
The active_array is unsigned, so use an unsigned constant as well.
unsigned int __bit = __reg & (8 * sizeof (unsigned int) - 1);
__reg /= 8 * sizeof (unsigned int);
- return __ptr->cpuid_array[__reg] & (1 << __bit);
+ return __ptr->cpuid_array[__reg] & (1U << __bit);
}
static __inline__ bool
unsigned int __bit = __reg & (8 * sizeof (unsigned int) - 1);
__reg /= 8 * sizeof (unsigned int);
- return __ptr->active_array[__reg] & (1 << __bit);
+ return __ptr->active_array[__reg] & (1U << __bit);
}
/* CPU_FEATURE_PRESENT evaluates to true if CPU supports the feature. */