[patch] PR tree-optimization/96818 - cast label range to type of switch operand

2020-08-31 Thread Aldy Hernandez via Gcc-patches
01 From: Aldy Hernandez Date: Fri, 28 Aug 2020 18:44:58 +0200 Subject: [PATCH] PR tree-optimization/96818 - cast label range to type of switch operand PR tree-optimization/96818 * tree-vrp.c (find_case_label_range): Cast label range to type of switch operand. --- gcc/testsuite/g++.dg/p

Re: [patch] PR tree-optimization/96818 - cast label range to type of switch operand

2020-08-31 Thread Richard Biener via Gcc-patches
On Mon, Aug 31, 2020 at 10:20 AM Aldy Hernandez wrote: > > As discussed in the PR, the type of a switch operand may be different > than the type of the individual cases. This is causing us to attempt to > intersect incompatible ranges. > > This inconsistent IL seems wrong to me, but it also seems

Re: [patch] PR tree-optimization/96818 - cast label range to type of switch operand

2020-08-31 Thread Jakub Jelinek via Gcc-patches
On Mon, Aug 31, 2020 at 10:33:20AM +0200, Richard Biener wrote: > In any case type mismatches here are of course unfortunate > and both more verification and documentation would be > nice. verify_gimple_switch only verifies all case labels > have the same type, the type of the switch argument is >

Re: [patch] PR tree-optimization/96818 - cast label range to type of switch operand

2020-08-31 Thread Richard Biener via Gcc-patches
On Mon, Aug 31, 2020 at 10:39 AM Jakub Jelinek wrote: > > On Mon, Aug 31, 2020 at 10:33:20AM +0200, Richard Biener wrote: > > In any case type mismatches here are of course unfortunate > > and both more verification and documentation would be > > nice. verify_gimple_switch only verifies all case

Re: [patch] PR tree-optimization/96818 - cast label range to type of switch operand

2020-08-31 Thread Aldy Hernandez via Gcc-patches
On 8/31/20 10:33 AM, Richard Biener wrote: On Mon, Aug 31, 2020 at 10:20 AM Aldy Hernandez wrote: As discussed in the PR, the type of a switch operand may be different than the type of the individual cases. This is causing us to attempt to intersect incompatible ranges. This inconsistent

Re: [patch] PR tree-optimization/96818 - cast label range to type of switch operand

2020-08-31 Thread Richard Biener via Gcc-patches
On Mon, Aug 31, 2020 at 11:10 AM Aldy Hernandez wrote: > > > > On 8/31/20 10:33 AM, Richard Biener wrote: > > On Mon, Aug 31, 2020 at 10:20 AM Aldy Hernandez wrote: > >> > >> As discussed in the PR, the type of a switch operand may be different > >> than the type of the individual cases. This is

Re: [patch] PR tree-optimization/96818 - cast label range to type of switch operand

2020-08-31 Thread Jason Merrill via Gcc-patches
On 8/31/20 5:10 AM, Aldy Hernandez wrote: On 8/31/20 10:33 AM, Richard Biener wrote: On Mon, Aug 31, 2020 at 10:20 AM Aldy Hernandez wrote: As discussed in the PR, the type of a switch operand may be different than the type of the individual cases.  This is causing us to attempt to intersect

Re: [patch] PR tree-optimization/96818 - cast label range to type of switch operand

2020-09-03 Thread Aldy Hernandez via Gcc-patches
On 8/31/20 2:55 PM, Richard Biener wrote: On Mon, Aug 31, 2020 at 11:10 AM Aldy Hernandez wrote: On 8/31/20 10:33 AM, Richard Biener wrote: On Mon, Aug 31, 2020 at 10:20 AM Aldy Hernandez wrote: As discussed in the PR, the type of a switch operand may be different than the type of the

Re: [patch] PR tree-optimization/96818 - cast label range to type of switch operand

2020-09-03 Thread Richard Biener via Gcc-patches
On Thu, Sep 3, 2020 at 9:21 AM Aldy Hernandez wrote: > > > > On 8/31/20 2:55 PM, Richard Biener wrote: > > On Mon, Aug 31, 2020 at 11:10 AM Aldy Hernandez wrote: > >> > >> > >> > >> On 8/31/20 10:33 AM, Richard Biener wrote: > >>> On Mon, Aug 31, 2020 at 10:20 AM Aldy Hernandez wrote: > > >

Re: [patch] PR tree-optimization/96818 - cast label range to type of switch operand

2020-09-03 Thread Andrew MacLeod via Gcc-patches
On 9/3/20 3:43 AM, Richard Biener wrote: On Thu, Sep 3, 2020 at 9:21 AM Aldy Hernandez wrote: On 8/31/20 2:55 PM, Richard Biener wrote: On Mon, Aug 31, 2020 at 11:10 AM Aldy Hernandez wrote: On 8/31/20 10:33 AM, Richard Biener wrote: On Mon, Aug 31, 2020 at 10:20 AM Aldy Hernandez wrot

Re: [patch] PR tree-optimization/96818 - cast label range to type of switch operand

2020-09-03 Thread Richard Biener via Gcc-patches
On September 3, 2020 5:39:18 PM GMT+02:00, Andrew MacLeod wrote: >On 9/3/20 3:43 AM, Richard Biener wrote: >> On Thu, Sep 3, 2020 at 9:21 AM Aldy Hernandez >wrote: >>> >>> >>> On 8/31/20 2:55 PM, Richard Biener wrote: On Mon, Aug 31, 2020 at 11:10 AM Aldy Hernandez >wrote: > >

Re: [patch] PR tree-optimization/96818 - cast label range to type of switch operand

2020-09-04 Thread Aldy Hernandez via Gcc-patches
template class GTY((user)) int_range : public irange { so people can use int_range x; and get the max range by default? Indeed, I had forgotten about default template arguments, the only problem is int_range x; is valid in c++17, but previous to that we have to do int_range<> x; Its a bit