From: Bernd Schmidt <bschmidt@redhat.com>
To: Andreas Arnez <arnez@linux.vnet.ibm.com>,
Joseph Myers <joseph@codesourcery.com>,
Richard Henderson <rth@redhat.com>
Cc: gcc-patches@gcc.gnu.org, "David Malcolm" <dmalcolm@redhat.com>,
"Manuel López-Ibáñez" <lopezibanez@gmail.com>,
"Patrick Palka" <patrick@parcs.ath.cx>,
"Andreas Krebbel" <krebbel@linux.vnet.ibm.com>
Subject: Re: [PR debug/67192] Fix C loops' back-jump location
Date: Tue, 13 Oct 2015 12:37:00 -0000 [thread overview]
Message-ID: <561CFB09.5030903@redhat.com> (raw)
In-Reply-To: <m3si5gji8n.fsf@oc1027705133.ibm.com>
On 10/12/2015 04:04 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().
One could argue that peek_token should not have an effect on
input_location, and in fact cpp_peek_token seems to take steps that this
does not happen, but it looks like c_parser_peek_token does not use that
mechanism. Still,
>
> gcc/testsuite/ChangeLog:
>
> PR debug/67192
> * gcc.dg/guality/pr67192.c: New test.
>
> 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.
This fix looks simple enough. Ok. (Might want to add noclone to the
testcase attributes).
Bernd
next prev parent reply other threads:[~2015-10-13 12:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-12 14:04 Andreas Arnez
2015-10-13 12:37 ` Bernd Schmidt [this message]
2015-10-23 9:10 ` Andreas Arnez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=561CFB09.5030903@redhat.com \
--to=bschmidt@redhat.com \
--cc=arnez@linux.vnet.ibm.com \
--cc=dmalcolm@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=joseph@codesourcery.com \
--cc=krebbel@linux.vnet.ibm.com \
--cc=lopezibanez@gmail.com \
--cc=patrick@parcs.ath.cx \
--cc=rth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).