public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pault at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/25818] Problem with handling optional and entry master arguments
Date: Mon, 21 Aug 2006 13:36:00 -0000	[thread overview]
Message-ID: <20060821133600.24281.qmail@sourceware.org> (raw)
In-Reply-To: <bug-25818-87@http.gcc.gnu.org/bugzilla/>



------- Comment #6 from pault at gcc dot gnu dot org  2006-08-21 13:35 -------
Jakub and co.,

Does the below do it for you?  Instead of passing null, I propose to pass the
address of a longlong containing zero.  This then leaves the normal passing of
NULL to possibly represent a missing optional argument.  It regtests OK.

I am proposing to pass a reference to a zero for unused arguments so that the
hidden, residual use of them in the master_entry does not cause an ICE. 
Otherwise, it doesn't matter how the unused arguments are represented.

Paul

Index: gcc/fortran/trans-decl.c
===================================================================
*** gcc/fortran/trans-decl.c    (revision 116268)
--- gcc/fortran/trans-decl.c    (working copy)
*************** build_entry_thunks (gfc_namespace * ns)
*** 1561,1566 ****
--- 1561,1568 ----
    tree args;
    tree string_args;
    tree tmp;
+   tree zero;
+   bool zero_flag;
    locus old_loc;

    /* This should always be a toplevel function.  */
*************** build_entry_thunks (gfc_namespace * ns)
*** 1580,1585 ****
--- 1582,1590 ----

        gfc_start_block (&body);

+       zero_flag = false;
+       zero = NULL_TREE;
+
        /* Pass extra parameter identifying this entry point.  */
        tmp = build_int_cst (gfc_array_index_type, el->id);
        args = tree_cons (NULL_TREE, tmp, NULL_TREE);
*************** build_entry_thunks (gfc_namespace * ns)
*** 1616,1621 ****
--- 1621,1627 ----
          if (thunk_formal)
            {
              /* Pass the argument.  */
+             /* TODO - missing optional arguments.  */
              DECL_ARTIFICIAL (thunk_formal->sym->backend_decl) = 1;
              args = tree_cons (NULL_TREE, thunk_formal->sym->backend_decl,
                                args);
*************** build_entry_thunks (gfc_namespace * ns)
*** 1627,1634 ****
            }
          else
            {
!             /* Pass NULL for a missing argument.  */
!             args = tree_cons (NULL_TREE, null_pointer_node, args);
              if (formal->sym->ts.type == BT_CHARACTER)
                {
                  tmp = build_int_cst (gfc_charlen_type_node, 0);
--- 1633,1651 ----
            }
          else
            {
!             /* Pass the address of a long zero for any argument that
!                is not used in this thunk.  */
!             if (!zero_flag)
!               {
!                 tmp = build_int_cst (intQI_type_node, 0);
!                 zero = gfc_create_var (intQI_type_node, NULL);
!                 gfc_add_modify_expr (&body, zero, tmp);
!                 zero = fold_convert (pvoid_type_node,
!                                      build_fold_addr_expr (zero));
!                 zero_flag = true;
!               }
!             args = tree_cons (NULL_TREE, zero, args);
!
              if (formal->sym->ts.type == BT_CHARACTER)
                {
                  tmp = build_int_cst (gfc_charlen_type_node, 0);


-- 


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


  parent reply	other threads:[~2006-08-21 13:36 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-17 14:35 [Bug fortran/25818] New: " jakub at gcc dot gnu dot org
2006-01-17 16:04 ` [Bug fortran/25818] " pinskia at gcc dot gnu dot org
2006-07-27 22:38 ` taschna at uni-muenster dot de
2006-07-30 22:47 ` kargl at gcc dot gnu dot org
2006-07-31  6:32 ` taschna at uni-muenster dot de
2006-07-31  7:49 ` taschna at uni-muenster dot de
2006-08-21 13:36 ` pault at gcc dot gnu dot org [this message]
2006-09-18 15:33 ` paul dot richard dot thomas at cea dot fr
2006-09-29  0:30 ` kargl at gcc dot gnu dot org
2006-10-12 12:31 ` pault at gcc dot gnu dot org
2006-10-12 12:46 ` jakub at gcc dot gnu dot org
2006-11-30 11:58 ` pinskia at gcc dot gnu dot org
2006-11-30 14:25 ` pault at gcc dot gnu dot org
2006-11-30 15:52 ` pault at gcc dot gnu dot org
2006-11-30 15:53 ` pault at gcc dot gnu dot org
2006-12-01 20:24 ` elizabeth dot l dot yip at boeing dot com
2006-12-02 17:56 ` paulthomas2 at wanadoo dot fr
2006-12-07  1:37 ` elizabeth dot l dot yip at boeing dot com
2006-12-07 17:34 ` paulthomas2 at wanadoo dot fr
2006-12-09 21:42 ` pault at gcc dot gnu dot org
2006-12-22  2:20 ` patchapp at dberlin dot org
2006-12-22 20:49 ` pault at gcc dot gnu dot org
2007-01-03 21:27 ` [Bug fortran/25818] [4.2 and 4.1 only] " pault at gcc dot gnu dot org
2007-01-03 21:30 ` [Bug fortran/25818] [4.1 " pault at gcc dot gnu dot org
2007-01-10 19:06 ` pinskia 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=20060821133600.24281.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).