Commit 50c96067 by Aaron Sawdey

Fix UBSAN error, shifting 64 bit value by 64.

2020-03-13  Aaron Sawdey  <acsawdey@linux.ibm.com>

	PR target/92379
	* config/rs6000/rs6000.c (num_insns_constant_multi) Don't shift a
	64-bit value by 64 bits (UB).
parent 5c048755
2020-03-13 Aaron Sawdey <acsawdey@linux.ibm.com>
PR target/92379
* config/rs6000/rs6000.c (num_insns_constant_multi) Don't shift a
64-bit value by 64 bits (UB).
2020-03-13 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/92303
......
......@@ -5612,7 +5612,10 @@ num_insns_constant_multi (HOST_WIDE_INT value, machine_mode mode)
&& rs6000_is_valid_and_mask (GEN_INT (low), DImode))
insns = 2;
total += insns;
value >>= BITS_PER_WORD;
/* If BITS_PER_WORD is the number of bits in HOST_WIDE_INT, doing
it all at once would be UB. */
value >>= (BITS_PER_WORD - 1);
value >>= 1;
}
return total;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment