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/36403] [4.4 Regression] Some fortran tests using eoshift fail on SH
Date: Sun, 27 Jul 2008 13:52:00 -0000	[thread overview]
Message-ID: <20080727135205.19938.qmail@sourceware.org> (raw)
In-Reply-To: <bug-36403-5208@http.gcc.gnu.org/bugzilla/>



------- Comment #3 from burnus at gcc dot gnu dot org  2008-07-27 13:52 -------
> Isn't this maybe a general problem about optional string arguments?
> Or is this really a eoshift-specific problem? I'm just thinking about a 
> general solution for this kind of problem if it isn't.

I think this might be a more general problem, but it is not trivially solvable.
For external procedures, if the interface is available (as required for
optional arguments), the length is also present if the actual argument is
missing.

For intrinsic functions there exists also a formal argument list, but for
EOSHIFT's ARRAY/BOUNDARY argument it is ts.type == BT_REAL. (EOSHIFT allows
numeric types [real, integer, complex] and the character types.) And as the
actual argument is NULL, its type can also not be used to know that the string
length has to be passed.

I therefore think FX's solution of adding a gfc_conv_intrinsic_eoshift is OK.
The alternative would be to add a specific function with BT_CHARACTER type to
the generic function "EOSHIFT". I'm not sure how to do this best.

For fixing it using gfc_conv_intrinsic_eoshift:

a) Check other intrinsic functions, which take an optional argument which is of
character type.

b) At least for the test case, the following if matches in trans-intrinsics.c's
fc_conv_intrinsic_function:

  if (expr->rank > 0 && !expr->inline_noncopying_intrinsic)
    {
      lib = gfc_is_intrinsic_libcall (expr);
      if (lib != 0)
        {
          if (lib == 1)
            se->ignore_optional = 1;
          gfc_conv_intrinsic_funcall (se, expr);
          return;
        }
    }

Thus adding a "case GFC_ISYM_EOSHIFT:" in the switch block does not make sense.
(I think boundary needs to be an array and thus the if above always matches.)

c) I think the function should be called conv_intrinsic_eoshift w/o gfc_ as it
is not exported.

In conv_intrinsic_eoshift I think one can add as first line:

   if (expr->value.function.actual->expr->ts.type != BT_CHARACTER)
     {
        gfc_conv_intrinsic_funcall (se, expr);
        return;
     }

Or one covers both cases in that function. (One can check the actual argument
type here because the first argument, ARRAY, must be present and BOUNDARY has
the same type as ARRAY.)


-- 


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


  parent reply	other threads:[~2008-07-27 13:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-31 23:41 [Bug fortran/36403] New: " kkojima at gcc dot gnu dot org
2008-06-02 11:30 ` [Bug fortran/36403] " fxcoudert at gcc dot gnu dot org
2008-06-11 11:13 ` jsm28 at gcc dot gnu dot org
2008-06-15 15:14 ` fxcoudert at gcc dot gnu dot org
2008-07-18 16:51 ` rguenth at gcc dot gnu dot org
2008-07-24 17:04 ` domob at gcc dot gnu dot org
2008-07-27 13:52 ` burnus at gcc dot gnu dot org [this message]
2008-07-28 18:42 ` domob at gcc dot gnu dot org
2008-07-28 18:42 ` domob at gcc dot gnu dot org
2008-07-28 20:04 ` burnus at gcc dot gnu dot org
2008-07-29  9:13 ` domob at gcc dot gnu dot org
2008-07-29  9:18 ` domob 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=20080727135205.19938.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).