This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch: missing `break' in gcc.c
- To: tromey at cygnus dot com
- Subject: Re: Patch: missing `break' in gcc.c
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Tue, 28 Mar 2000 08:53:21 -0700
- cc: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Reply-To: law at cygnus dot com
In message <87og80p78s.fsf@cygnus.com>you write:
> I believe there is a missing `break' in handle_braces() in gcc.c.
> Without this patch, `i' will always be `n_switches' after the loop
> finishes. I think this will result in an incorrect call to
> give_switch().
>
> I found this by inspection. I don't have a test case.
More correctly, if the name ends with a '*' as in {x*:...}, then 'i' will
have the value n_switches when we get into this code:
/* If it is as desired (present for %{s...}, absent for %{!s...})
then substitute either the switch or the specified
conditional text. */
if (present != negate)
{
if (elide_switch)
{
switches[i].live_cond = SWITCH_IGNORE;
switches[i].validated = 1;
}
else if (*p == '}')
{
give_switch (i, 0, include_blanks);
}
Presumably both assignment into switches[i] and the call to give_switch
would be bogus when i == n_switches.
This code is, well, disgusting. The control/data flow certainly isn't as
clean as it ought to be. Someone should probably look into trying to
clean that mess up.
Anyway...
> 2000-03-27 Tom Tromey <tromey@cygnus.com>
>
> * gcc.c (handle_braces): In {x*...} case, break out of loop if
> switch is found.
This is fine. Please install this patch.
THanks,
jeff