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/30660] [4.2 and 4.1 only] Allocatable components of a derived type "require" the SAVE attribute.
Date: Sat, 17 Feb 2007 22:42:00 -0000	[thread overview]
Message-ID: <20070217224244.23459.qmail@sourceware.org> (raw)
In-Reply-To: <bug-30660-109@http.gcc.gnu.org/bugzilla/>



------- Comment #8 from pault at gcc dot gnu dot org  2007-02-17 22:42 -------
This works and regtests OK:

Index: gcc/fortran/resolve.c
===================================================================
*** gcc/fortran/resolve.c       (revision 121864)
--- gcc/fortran/resolve.c       (working copy)
*************** resolve_fl_var_and_proc (gfc_symbol *sym
*** 5529,5534 ****
--- 5529,5549 ----
  }


+ static gfc_component *
+ has_default_initializer (gfc_symbol *der)
+ {
+   gfc_component *c;
+   for (c = der->components; c; c = c->next)
+     if ((c->ts.type != BT_DERIVED && c->initializer)
+         || (c->ts.type == BT_DERIVED
+               && !c->pointer
+               && has_default_initializer (c->ts.derived)))
+       break;
+ 
+   return c;
+ }
+ 
+ 
  /* Resolve symbols with flavor variable.  */

  static try
*************** resolve_fl_variable (gfc_symbol *sym, in
*** 5676,5684 ****
       components.  */
    c = NULL;
    if (sym->ts.type == BT_DERIVED && !(sym->value || flag))
!     for (c = sym->ts.derived->components; c; c = c->next)
!       if (c->initializer)
!       break;

    /* 4th constraint in section 11.3:  "If an object of a type for which
       component-initialization is specified (R429) appears in the
--- 5691,5697 ----
       components.  */
    c = NULL;
    if (sym->ts.type == BT_DERIVED && !(sym->value || flag))
!     c = has_default_initializer (sym->ts.derived);

    /* 4th constraint in section 11.3:  "If an object of a type for which
       component-initialization is specified (R429) appears in the


I need to think about it - it looks a bit clumsy to me and I need also to think
through compliance with the standard.

Paul


-- 


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


  parent reply	other threads:[~2007-02-17 22:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-31 21:34 [Bug fortran/30660] New: " toon at moene dot indiv dot nluug dot nl
2007-01-31 21:38 ` [Bug fortran/30660] " toon at moene dot indiv dot nluug dot nl
2007-02-02 13:14 ` pault at gcc dot gnu dot org
2007-02-02 16:15 ` pault at gcc dot gnu dot org
2007-02-03 12:46 ` fxcoudert at gcc dot gnu dot org
2007-02-03 13:39 ` pault at gcc dot gnu dot org
2007-02-04 13:17 ` [Bug fortran/30660] [4.2 and 4.1 only] " toon at moene dot indiv dot nluug dot nl
2007-02-05  9:37 ` paulthomas2 at wanadoo dot fr
2007-02-11  9:57 ` pault at gcc dot gnu dot org
2007-02-17 22:42 ` pault at gcc dot gnu dot org [this message]
2007-02-19 21:02 ` mmitchel at gcc dot gnu dot org
2007-02-22 22:10 ` patchapp at dberlin dot org
2007-02-23 16:35 ` burnus at gcc dot gnu dot org
2007-03-01  9:44 ` [Bug fortran/30660] [4.2 " burnus at gcc dot gnu dot org
2007-03-01  9:45 ` [Bug fortran/30660] " 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=20070217224244.23459.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).