[Bug debug/67192] Backward-goto in loop can get wrong line number
dmalcolm at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Aug 18 15:52:00 GMT 2015
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.
More information about the Gcc-bugs
mailing list