public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "manu 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 19:56:00 -0000	[thread overview]
Message-ID: <bug-67192-4-UsemqxXqXa@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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org

--- Comment #8 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Andreas Arnez from comment #7)
> 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?

No, it is the goto that corresponds to the loop exit:

      /* If we have an exit condition, then we build an IF with gotos either
         out of the loop, or to the top of it.  If there's no exit condition,
         then we just build a jump back to the top.  */
      exit = build_and_jump (&LABEL_EXPR_LABEL (top));

however, that exit does not have a valid location, thus it is added at add_stmt
a few lines below:

  if (CAN_HAVE_LOCATION_P (t) && code != LABEL_EXPR)
    {
      if (!EXPR_HAS_LOCATION (t))
        SET_EXPR_LOCATION (t, input_location);
    }

It is surprising that c_parser_peek_token changes input_location and this
doesn't mess up everything else. I wonder what is the benefit of having
input_location at all if we need to keep saving and restoring it all the time.

Does GCC work at all if input_location is saved and restored in
c_parser_peek_token? I guess not, it seems too much still relies in
input_location being magically right.
>From gcc-bugs-return-495125-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Aug 18 19:56:58 2015
Return-Path: <gcc-bugs-return-495125-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 119616 invoked by alias); 18 Aug 2015 19:56:58 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 119572 invoked by uid 55); 18 Aug 2015 19:56:54 -0000
From: "fxcoudert at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libfortran/66936] io/unix.c gratuitously uses S_IRWXG and S_IRWXO on the basis that umask() is available
Date: Tue, 18 Aug 2015 19:56:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libfortran
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: fxcoudert at gcc dot gnu.org
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Resolution: FIXED
X-Bugzilla-Priority: P5
X-Bugzilla-Assigned-To: fxcoudert at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-66936-4-WBIQ1xmV6g@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-66936-4@http.gcc.gnu.org/bugzilla/>
References: <bug-66936-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-08/txt/msg01267.txt.bz2
Content-length: 462

https://gcc.gnu.org/bugzilla/show_bug.cgi?idf936

--- Comment #19 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
Author: fxcoudert
Date: Tue Aug 18 19:56:20 2015
New Revision: 226988

URL: https://gcc.gnu.org/viewcvs?rev"6988&root=gcc&view=rev
Log:
        PR libfortran/66936
        * io/unix.c (__MINGW32__): Undefine HAVE_UMASK.

Modified:
    branches/gcc-5-branch/libgfortran/ChangeLog
    branches/gcc-5-branch/libgfortran/io/unix.c


  parent reply	other threads:[~2015-08-18 19:56 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
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 [this message]
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-UsemqxXqXa@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).