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)
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Bernd Schmidt <bschmidt at redhat dot com>
- Cc: Marek Polacek <polacek at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 16 Dec 2016 14:58:59 +0100
- Subject: Re: [PATCH] Fix assertions along default switch labels (PR tree-optimization/78819)
- Authentication-results: sourceware.org; auth=none
- References: <20161216114916.GK2337@redhat.com> <240fbc1d-a486-7009-f59a-fbbbdd3d53ab@redhat.com>
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?
Richard.
>
> Bernd