This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix off by one in group_case_labels


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.

Attachment: temp.diff.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]