[PATCH v3 1/2] [PR debug/67192] Fix C loops' back-jump location

Andreas Krebbel krebbel@linux.vnet.ibm.com
Mon Nov 9 15:36:00 GMT 2015

On 11/04/2015 05:17 PM, Andreas Arnez wrote:
> Since r223098 ("Implement -Wmisleading-indentation") the backward-jump
> generated for a C while- or for-loop can get the wrong line number.
> This is because the check for misleading indentation peeks ahead one
> token, advancing input_location to after the loop, and then
> c_finish_loop() creates the back-jump and calls add_stmt(), which
> assigns input_location to the statement by default.
> This patch swaps the check for misleading indentation with the finishing
> of the loop, such that input_location still has the right value at the
> time of any invocations of add_stmt().  Note that this does not fully
> cover all cases where the back-jump gets the wrong location.
> gcc/c/ChangeLog:
> 	PR debug/67192
> 	* c-parser.c (c_parser_while_statement): Finish the loop before
> 	parsing ahead for misleading indentation.
> 	(c_parser_for_statement): Likewise.
> gcc/testsuite/ChangeLog:
> 	PR debug/67192
> 	* gcc.dg/guality/pr67192.c: New test.

Applied. Thanks!


More information about the Gcc-patches mailing list