On 5/15/19 1:21 PM, Richard Biener wrote:
> On Wed, May 15, 2019 at 12:21 PM Martin Liška <mli...@suse.cz> wrote:
>>
>> Hi.
>>
>> The patch is about handling of overflow in 
>> jump_table_cluster::can_be_handled.
>> I calculate 100 * range and compare it to range. If it's smaller, then
>> overflow happens.
>>
>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>>
>> Ready to be installed?
> 
> Looks good, but can the RHS overflow as well? 

That should be fine as maximal value of the PARAM is 1<32. And if I'm correct
HOST_WIDE_INT should have 64-bits?

Martin

> I suppose changing
> the compute/compare to uint64_t would fix the overflow but downstream
> the issue would re-appear?
> 
> Richard.
> 
>> Thanks,
>> Martin
>>
>> gcc/ChangeLog:
>>
>> 2019-05-15  Martin Liska  <mli...@suse.cz>
>>
>>         PR middle-end/90478
>>         * tree-switch-conversion.c (jump_table_cluster::can_be_handled):
>>         Check for overflow.
>>
>> gcc/testsuite/ChangeLog:
>>
>> 2019-05-15  Martin Liska  <mli...@suse.cz>
>>
>>         PR middle-end/90478
>>         * gcc.dg/tree-ssa/pr90478-2.c: New test.
>>         * gcc.dg/tree-ssa/pr90478.c: New test.
>> ---
>>  gcc/testsuite/gcc.dg/tree-ssa/pr90478-2.c | 17 +++++++++++++++++
>>  gcc/testsuite/gcc.dg/tree-ssa/pr90478.c   | 18 ++++++++++++++++++
>>  gcc/tree-switch-conversion.c              |  6 +++++-
>>  3 files changed, 40 insertions(+), 1 deletion(-)
>>  create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr90478-2.c
>>  create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr90478.c
>>
>>

Reply via email to