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/58331] [OOP] Bogus rank checking with explicit-/assumed-size arrays and CLASS
Date: Sun, 08 Sep 2013 16:46:00 -0000	[thread overview]
Message-ID: <bug-58331-4-StYfX77fno@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-58331-4@http.gcc.gnu.org/bugzilla/>

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Actually, the patch is sufficient as one then runs into a tree checking error:

class_array_20.f90:21:0: error: non-trivial conversion at assignment
  struct array1_unknown
  struct array2_integer(kind=4)

if one looks at the dump, one sees that the actual argument still sends the
array descriptor - but it shouldn't:
      parm.7.dim[0].lbound = 1;
      ...
      parm.7.data = (void *) &b[0];
      class.6._data = parm.7;
      mysub (&class.6, &C.1946);

Thus, the test case also doesn't work for rank == 1, if one checks the value.


TODO
* Sends in _data the array data, not the descriptor
* Add a test case for the coindexed part of the patch below.
* Augment the test case in comment 0 with a value check



Updated patch:
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -2135 +2135,5 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
-      || (actual->rank != 0 && !(is_elemental || formal->attr.dimension))
+      || (actual->rank != 0
+          && !(is_elemental
+           || (formal->ts.type != BT_CLASS && formal->attr.dimension)
+           || (formal->ts.type == BT_CLASS
+           && CLASS_DATA (formal)->attr.dimension)))
@@ -2142 +2146,4 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
-      || (actual->rank == 0 && formal->attr.dimension
+      || (actual->rank == 0
+      && (formal->attr.dimension
+          || (formal->ts.type == BT_CLASS
+                  && CLASS_DATA (formal)->attr.dimension))
@@ -2150 +2157,4 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
-  else if (actual->rank != 0 && (is_elemental || formal->attr.dimension))
+  else if (actual->rank != 0
+       && (is_elemental || formal->attr.dimension
+           || (formal->ts.type == BT_CLASS
+           && CLASS_DATA (formal)->attr.dimension)))


  parent reply	other threads:[~2013-09-08 16:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-06  6:00 [Bug fortran/58331] New: " burnus at gcc dot gnu.org
2013-09-06 21:35 ` [Bug fortran/58331] " burnus at gcc dot gnu.org
2013-09-08 16:46 ` burnus at gcc dot gnu.org [this message]
2014-03-22 15:02 ` dominiq at lps dot ens.fr
2023-03-06 21:43 ` anlauf at gcc dot gnu.org
2023-03-06 22:13 ` anlauf at gcc dot gnu.org
2023-03-07  9:14 ` burnus at gcc dot gnu.org
2023-03-09 19:44 ` anlauf at gcc dot gnu.org
2023-03-14 19:39 ` anlauf at gcc dot gnu.org
2023-03-15  8:58 ` burnus at gcc dot gnu.org
2023-03-15 19:22 ` cvs-commit at gcc dot gnu.org
2023-03-15 20:03 ` anlauf at gcc dot gnu.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=bug-58331-4-StYfX77fno@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).