[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 16:11:00 GMT 2015


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

--- Comment #5 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(In reply to David Malcolm from comment #3)
> Created attachment 36203 [details]
> 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.

The given patch was on top of r223098
(e5f01cbafce70120afe8f73df099dcc2796adcd7), but doesn't apply to trunk; r226477
(9255be07ea1ac0e2f2991aa11cfc892474add3b2) changed the internal API for this,
so the save/restore of input_location would need updating for this.


More information about the Gcc-bugs mailing list