This is the mail archive of the gcc-bugs@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]

[Bug debug/67192] Backward-goto in loop can get wrong line number


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67192

--- Comment #3 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Created attachment 36203
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36203&action=edit
Patch

The issue seems to be in here in c_parser_for_statement:

  warn_for_misleading_indentation (for_loc, body_loc,
                                   c_parser_peek_token (parser)->location,
                                   c_parser_peek_token (parser)->type,
                                   "for");

where the calls to c_parser_peek_token can lead to input_location being
changed.

The attached patch (barely tested) restores the previous location for the
"goto" by saving and restoring input_location.


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