public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/55501] [F03] ICE using MERGE in constant expr
Date: Wed, 28 Nov 2012 10:49:00 -0000	[thread overview]
Message-ID: <bug-55501-4-EFT04zH9jk@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-55501-4@http.gcc.gnu.org/bugzilla/>


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

--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-11-28 10:48:58 UTC ---
(In reply to comment #2)
>   type(MPI_Datatype) :: MPI_INTEGER = merge(MPI_Datatype(4), MPI_Datatype(8),
> .false.)

The problem is related to having array PARAMETERs. For normal parameters,
simply their value is stored in the .mod file and always inserted when used.

For array parameters, a static array in read-only memory is created, which can
then be accessed at run time. That avoids replicating the information several
times. In addition, the expression is also stored in the .mod file.

Especially if constructors are involved, the current compile-time
simplification doesn't work that well. Additionally, the question is also
whether it always makes sense to expand constructors if one wants to simplify
code.

In any case, there is room for improvement. See also PR 44856 and PR 51260.

* * *

In gfc_simplify_merge, the compiler gives up when the type is not an
EXPR_CONSTANT:

3976      if (tsource->expr_type != EXPR_CONSTANT
3977          || fsource->expr_type != EXPR_CONSTANT
3978          || mask->expr_type != EXPR_CONSTANT)
3979        return NULL;


For the test case of this PR, one has an EXPR_STRUCTURE. Maybe replacing the
check by calls to gfc_is_constant_expr() is sufficient.


  parent reply	other threads:[~2012-11-28 10:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-28  0:27 [Bug fortran/55501] New: " longb at cray dot com
2012-11-28  0:37 ` [Bug fortran/55501] " longb at cray dot com
2012-11-28  9:16 ` [Bug fortran/55501] [F03] " janus at gcc dot gnu.org
2012-11-28  9:40 ` janus at gcc dot gnu.org
2012-11-28 10:11 ` janus at gcc dot gnu.org
2012-11-28 10:36 ` janus at gcc dot gnu.org
2012-11-28 10:49 ` burnus at gcc dot gnu.org [this message]
2012-11-28 10:50 ` janus at gcc dot gnu.org
2012-11-28 10:55 ` burnus at gcc dot gnu.org
2012-11-28 11:04 ` burnus at gcc dot gnu.org
2012-11-28 12:17 ` janus at gcc dot gnu.org
2012-11-28 12:22 ` janus at gcc dot gnu.org
2012-11-28 14:54 ` burnus at gcc dot gnu.org
2013-09-26  4:43 ` longb at cray dot 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-55501-4-EFT04zH9jk@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).