public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dmalcolm at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug debug/67192] Backward-goto in loop can get wrong line number
Date: Tue, 18 Aug 2015 15:52:00 -0000	[thread overview]
Message-ID: <bug-67192-4-MiHh7YiIBZ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-67192-4@http.gcc.gnu.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.


  parent reply	other threads:[~2015-08-18 15:52 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-12 14:56 [Bug debug/67192] New: " arnez at linux dot vnet.ibm.com
2015-08-17 15:30 ` [Bug debug/67192] " arnez at linux dot vnet.ibm.com
2015-08-18 15:23 ` dmalcolm at gcc dot gnu.org
2015-08-18 15:52 ` dmalcolm at gcc dot gnu.org [this message]
2015-08-18 16:05 ` dmalcolm at gcc dot gnu.org
2015-08-18 16:11 ` dmalcolm at gcc dot gnu.org
2015-08-18 16:23 ` dmalcolm at gcc dot gnu.org
2015-08-18 17:16 ` arnez at linux dot vnet.ibm.com
2015-08-18 19:56 ` manu at gcc dot gnu.org
2015-08-18 20:07 ` ppalka at gcc dot gnu.org
2015-09-11 18:17 ` arnez at linux dot vnet.ibm.com
2015-09-23  1:31 ` ppalka at gcc dot gnu.org
2015-09-23  7:02 ` manu at gcc dot gnu.org
2015-10-08 16:40 ` [Bug debug/67192] [6 Regression] " manu at gcc dot gnu.org
2015-10-09 10:49 ` arnez at linux dot vnet.ibm.com
2015-10-09 10:58 ` manu at gcc dot gnu.org
2015-10-09 11:11 ` manu at gcc dot gnu.org
2015-10-12 14:32 ` arnez at linux dot vnet.ibm.com
2015-10-23 15:32 ` arnez at linux dot vnet.ibm.com

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=bug-67192-4-MiHh7YiIBZ@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).