This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix assertions along default switch labels (PR tree-optimization/78819)
On Fri, Dec 16, 2016 at 3:16 PM, Marek Polacek <polacek@redhat.com> wrote:
> On Fri, Dec 16, 2016 at 02:58:59PM +0100, Richard Biener wrote:
>> On Fri, Dec 16, 2016 at 2:03 PM, Bernd Schmidt <bschmidt@redhat.com> wrote:
>> > On 12/16/2016 12:49 PM, Marek Polacek wrote:
>> >
>> >> But as this testcase shows, this breaks when the default label shares a
>> >> label
>> >> with another case. On this testcase, when we reach the switch, we know
>> >> that
>> >> argc is either 1, 2, or 3. So by the time we reach vrp2, the IR will have
>> >> been optimized to
>> >>
>> >> switch (argc) {
>> >> default:
>> >> case 3:
>> >> // argc will be considered 1 despite the case 3
>> >> break;
>> >> case 2:
>> >> ...
>> >> }
>> >
>> >
>> > Shouldn't we just remove the "case 3:" from the switch in this case? Would
>> > that fix things?
>>
>> We probably should indeed. But can we rely on this?
>
> I think we should do both -- apply my fix + investigated why we kept case 3
> around. I'm willing to look into this.
Agreed. (my original approval still holds)
Richard.
> Marek