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 #7 from Andreas Arnez <arnez at linux dot vnet.ibm.com> ---
(In reply to David Malcolm from comment #3)

> 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.

I'm curious why this would lead to the problem seen, and whether that's working
as intended.  When looking at c_finish_loop(), I see:
              SET_EXPR_LOCATION (t, start_locus);
where t seems to be the GOTO_EXPR for the backward-goto and start_locus is the
location of the beginning of the loop.  Naively I would conclude that the
GOTO_EXPR is intended to have the location of the *beginning* of the loop.  But
neither before nor after your patch this seems to be the case?

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