public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "janus at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/42484] ICE with -fopenmp
Date: Sun, 27 Dec 2009 13:05:00 -0000	[thread overview]
Message-ID: <20091227130543.23315.qmail@sourceware.org> (raw)
In-Reply-To: <bug-42484-16146@http.gcc.gnu.org/bugzilla/>



------- Comment #8 from janus at gcc dot gnu dot org  2009-12-27 13:05 -------
The reason for the failure of comment #0 and #4 is that these cases run into
the following optimization in gimplify_cond_expr (gimplify.c):

  if (TREE_OPERAND (expr, 1) != NULL
      && TREE_CODE (TREE_OPERAND (expr, 1)) == GOTO_EXPR
      && TREE_CODE (GOTO_DESTINATION (TREE_OPERAND (expr, 1))) == LABEL_DECL
      && (DECL_CONTEXT (GOTO_DESTINATION (TREE_OPERAND (expr, 1)))
          == current_function_decl)
      /* For -O0 avoid this optimization if the COND_EXPR and GOTO_EXPR
         have different locations, otherwise we end up with incorrect
         location information on the branches.  */
      && (optimize
          || !EXPR_HAS_LOCATION (expr)
          || !EXPR_HAS_LOCATION (TREE_OPERAND (expr, 1))
          || EXPR_LOCATION (expr) == EXPR_LOCATION (TREE_OPERAND (expr, 1))))
    {
      label_true = GOTO_DESTINATION (TREE_OPERAND (expr, 1));
      have_then_clause_p = true;
    }

Note that one only runs into this, if the locations of the IF condition and the
THEN clause are the same, which is the case for the simple IF in Fortran, but
not for IF...THEN...END IF statements. In C, the locations always seem to be
different, also for the simple one-lined case.

So, I guess the solution is to apply different locations to the simple IF
statement in Fortran.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42484


  parent reply	other threads:[~2009-12-27 13:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-23 22:00 [Bug middle-end/42484] New: " janus at gcc dot gnu dot org
2009-12-24 13:54 ` [Bug middle-end/42484] " janus at gcc dot gnu dot org
2009-12-25 20:37 ` [Bug fortran/42484] " janus at gcc dot gnu dot org
2009-12-26 20:11 ` janus at gcc dot gnu dot org
2009-12-26 22:31 ` janus at gcc dot gnu dot org
2009-12-26 22:47 ` janus at gcc dot gnu dot org
2009-12-27 11:38 ` janus at gcc dot gnu dot org
2009-12-27 12:54 ` janus at gcc dot gnu dot org
2009-12-27 13:05 ` janus at gcc dot gnu dot org [this message]
2009-12-27 15:57 ` janus at gcc dot gnu dot org
2009-12-28 21:41 ` janus at gcc dot gnu dot org

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=20091227130543.23315.qmail@sourceware.org \
    --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).