On 9/25/20 3:52 PM, Jakub Jelinek wrote:
On Fri, Sep 25, 2020 at 11:13:06AM +0200, Martin Liška wrote:
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -1268,6 +1268,15 @@ jump_table_cluster::can_be_handled (const vec<cluster *>
&clusters,
if (range == 0)
return false;
+ unsigned HOST_WIDE_INT lhs = 100 * range;
+ if (lhs < range)
+ return false;
If this test is meant to detect when 100 * range has overflowed,
then I think it is insufficient.
Perhaps do
if (range > HOST_WIDE_INT_M1U / 100)
return false;
unsigned HOST_WIDE_INT lhs = 100 * range;
instead?
Yes, I'll add the check.
Thanks,
Martin
Jakub