This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug debug/67192] Backward-goto in loop can get wrong line number
- From: "dmalcolm at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 18 Aug 2015 15:52:24 +0000
- Subject: [Bug debug/67192] Backward-goto in loop can get wrong line number
- Auto-submitted: auto-generated
- References: <bug-67192-4 at http dot gcc dot gnu dot org/bugzilla/>
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.