Running bootstrap-ubsan on x86_64 shows many instances of:
../../gcc/gcc/rtlanal.c:4881:48: runtime error: shift exponent 4294967295 is too large for 64-bit type 'long unsigned int'
I see that too.
Please see bug 66853, it appears to duplicate this one.
With a small reproducer included.
*** Bug 66853 has been marked as a duplicate of this bug. ***
For your convenience I repeat here the reproducer:
/* from gcc file fixopts.c */
/* must be compiled with -O2 */
/*gcc-5.1.0/gcc/rtlanal.c:4911:48: runtime error: shift exponent
4294967295 is too large for 64-bit type 'long unsigned int'*/
/*on source line "return nonzero & ((unsigned HOST_WIDE_INT) 1 <<
(bitwidth - 1))"*/
/* because unsigned int bitwidth is zero and bitwitdth-1 is 4294967295
on my x86-64 */
/* I did double check with:
* bitwidth = GET_MODE_PRECISION (mode);
/* the bug appears compiling fixopts.c crc32.c md5.c and many Fedora
21 kernel files*/
/* 66853 duplicato di 64327 */
int strcmp(const char *s1, const char *s2);
int fixinc_mode; /* must be outside main for bug to appear */
int main (void)
const char *pz;
if (strcmp (pz, "true") ) fixinc_mode = 0;
In 5.2.0 too.
I "fixed" this one by substituting rtlanal.c:4907
if (bitwidth > HOST_BITS_PER_WIDE_INT )
if (bitwidth > HOST_BITS_PER_WIDE_INT || !bitwidth)
On 6.1.0 I applied the same patch I suggested on comment 6,
this time at line 5187,
and the runtime error disappeared.
Can't reproduce on trunk any longer. Vittorie can you please re-test?
Sorry for the delay in answering but I was traveling.
I cannot reproduce on version 7, while it reproduces on 6.4.0.
Ok, so let's close it when GCC-6 will be closed.