public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "sfilippone at uniroma2 dot it" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/43969] [OOP] ALLOCATED() with polymorphic variables
Date: Sat, 15 May 2010 11:33:00 -0000	[thread overview]
Message-ID: <20100515113318.1198.qmail@sourceware.org> (raw)
In-Reply-To: <bug-43969-9410@http.gcc.gnu.org/bugzilla/>



------- Comment #5 from sfilippone at uniroma2 dot it  2010-05-15 11:33 -------
(In reply to comment #4)
> Turns out that fixing this one is completely trivial, once you actually have a
> look at it :)
> 
> The ALLOCATED intrinsic was just not adjusted to handle CLASS variables yet.
> The patch is as simple as this:
> 
> Index: gcc/fortran/trans-intrinsic.c
> ===================================================================
> --- gcc/fortran/trans-intrinsic.c       (revision 159389)
> +++ gcc/fortran/trans-intrinsic.c       (working copy)
> @@ -4529,6 +4529,8 @@ gfc_conv_allocated (gfc_se *se, gfc_expr *expr)
>      {
>        /* Allocatable scalar.  */
>        arg1se.want_pointer = 1;
> +      if (arg1->expr->ts.type == BT_CLASS)
> +       gfc_add_component_ref (arg1->expr, "$data");
>        gfc_conv_expr (&arg1se, arg1->expr);
>        tmp = arg1se.expr;
>      }
> 
> Thanks for the bug report, Salvatore.
> 
While we are at it, shouldn't the error message on ALLOCATE be  changed to
reflect the fact that not only arrays but also scalars might be allocatables? 
(see #2)
Salvatore 


-- 


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


  parent reply	other threads:[~2010-05-15 11:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-03 10:11 [Bug fortran/43969] New: [OOP] CLASS(foo), ALLOCATABLE component bad initialization sfilippone at uniroma2 dot it
2010-05-03 10:12 ` [Bug fortran/43969] " sfilippone at uniroma2 dot it
2010-05-03 10:37 ` sfilippone at uniroma2 dot it
2010-05-15 10:25 ` janus at gcc dot gnu dot org
2010-05-15 10:47 ` [Bug fortran/43969] [OOP] ALLOCATABLE with polymorphic variables janus at gcc dot gnu dot org
2010-05-15 11:33 ` sfilippone at uniroma2 dot it [this message]
2010-05-15 13:53 ` [Bug fortran/43969] [OOP] ALLOCATED() " janus at gcc dot gnu dot org
2010-05-15 14:18 ` [Bug fortran/43969] [OOP] ALLOCATED() with polymorphic arrays janus at gcc dot gnu dot org
2010-06-17 22:38 ` janus 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=20100515113318.1198.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).