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]

Re: Patch: missing `break' in gcc.c



  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


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