public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/41850] Wong-code with optional allocatable arrays
Date: Thu, 29 Oct 2009 22:52:00 -0000	[thread overview]
Message-ID: <20091029225237.25294.qmail@sourceware.org> (raw)
In-Reply-To: <bug-41850-13404@http.gcc.gnu.org/bugzilla/>



------- Comment #2 from burnus at gcc dot gnu dot org  2009-10-29 22:52 -------
Preliminary patch. The for the second part of the patch one needs still to
update the comment.  (Currently regtesting, so far no failure.)

...

Actually, I think the block (second part) can also go away for fsym == NULL. In
all cases, one has
   tmp = (a == NULL) ? a : NULL;
which is really a noop. I fail to see how one can get anything else. One needs
such a check for for absent arguments, but that is already handled in
interface.c (or somewhere around that place) - and it is a compile-time
replacement.

Index: trans-expr.c
===================================================================
--- trans-expr.c        (Revision 153727)
+++ trans-expr.c
@@ -2943,6 +2943,12 @@ gfc_conv_procedure_call (gfc_se * se, gf
                   tmp = build_fold_indirect_ref_loc (input_location,
                                                 parmse.expr);
                   tmp = gfc_trans_dealloc_allocated (tmp);
+                 if (fsym->attr.optional
+                     && e->expr_type == EXPR_VARIABLE
+                     && e->symtree->n.sym->attr.optional)
+                   tmp = fold_build3 (COND_EXPR, void_type_node,
+                                    gfc_conv_expr_present (e->symtree->n.sym),
+                                      tmp, build_empty_stmt (input_location));
                   gfc_add_expr_to_block (&se->pre, tmp);
                 }

@@ -2954,7 +2960,7 @@ gfc_conv_procedure_call (gfc_se * se, gf
         an intrinsic subroutine, however, fsym is NULL, but we might still
         have an optional argument, so we proceed to the substitution
         just in case.  */
-      if (e && (fsym == NULL || fsym->attr.optional))
+      if (e && fsym == NULL)
        {
          /* If an optional argument is itself an optional dummy argument,
             check its presence and substitute a null if absent.  */


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |burnus at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-10-29 22:52:37
               date|                            |


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


  parent reply	other threads:[~2009-10-29 22:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-27 19:42 [Bug fortran/41850] New: " burnus at gcc dot gnu dot org
2009-10-29 21:59 ` [Bug fortran/41850] " burnus at gcc dot gnu dot org
2009-10-29 22:52 ` burnus at gcc dot gnu dot org [this message]
2009-10-29 23:09 ` burnus at gcc dot gnu dot org
2009-10-30 10:16 ` [Bug fortran/41850] Wrong-code " burnus at gcc dot gnu dot org
2009-10-30 14:33 ` burnus at gcc dot gnu dot org
2009-11-01 12:44 ` burnus at gcc dot gnu dot org
2009-11-01 14:36 ` burnus at gcc dot gnu dot org
2009-11-01 14:36 ` burnus 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=20091029225237.25294.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).