This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix off by one in group_case_labels
- From: Jeffrey A Law <law at redhat dot com>
- To: Andrew Pinski <pinskia at physics dot uc dot edu>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 19 Oct 2004 14:24:56 -0600
- Subject: Re: [PATCH] Fix off by one in group_case_labels
- Organization: Red Hat, Inc
- References: <436A3DBA-215C-11D9-B4B8-000A95D692F4@physics.uc.edu>
- Reply-to: law at redhat dot com
On Mon, 2004-10-18 at 17:20, Andrew Pinski wrote:
> This is not a regression but a bug never the less and a simple easy one
> to fix also. Basically we were not looking at all at the last case
> statement (which is not the default one) to combine with the default
> case. This patch looks at them in the same while loop as before.
> This might improve perl but I don't know.
>
> OK? Bootstrapped and tested on ppc-darwin.
>
> Thanks,
> Andrew Pinski
>
> Testcase (which I am not smart enough to get a testsuite capable for):
> int f(int i)
> {
> switch (i)
> {
> case 1:
> return 1;
> case 2: /* This was not combined with the default at all. */
> default:
> return 0;
> }
> }
>
> ChangeLog:
>
> * tree-cfg.c (group_case_labels): Look at the second to last
> case statement for combing with the default case.
Approved. Thanks.
Jeff