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/51754] [OOP] ICE on valid with class arrays
Date: Sat, 21 Jan 2012 19:22:00 -0000	[thread overview]
Message-ID: <bug-51754-4-xCLsX4TuOE@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-51754-4@http.gcc.gnu.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-01-21 18:28:46 UTC ---
TODO: The ICE for the valid code (gfc_conv_descriptor_offset).

This comment is for the second issue:

(In reply to comment #0)
> If I remove the "allocatable" I instead get:
> $ gfortran -c test.F90 -o test.o
> f951: internal compiler error: Segmentation fault

Draft patch - for some reason, two error messages are printed for the line
  class(componentB), dimension(:) :: componentB

The change in gfc_default_initializer fixes the initial issue (and causes the
duplicated error message be printed in resolve.c) [Before, resolve was not
reached as the function was already called during variable declaration.] -- The
other parts are to avoid later segfault ("error recovery").

--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -3761,3 +3761,9 @@ gfc_default_initializer (gfc_typespec *ts)
-    if (comp->initializer || comp->attr.allocatable
-       || (comp->ts.type == BT_CLASS && CLASS_DATA (comp)->attr.allocatable))
-      break;
+    {
+      if (comp->ts.type == BT_CLASS && !comp->attr.class_ok)
+       return NULL;
+
+      if (comp->initializer || comp->attr.allocatable
+         || (comp->ts.type == BT_CLASS
+             &&  CLASS_DATA (comp)->attr.allocatable))
+       break;
+    }
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -2020 +2020 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool
sub_flag,
-      else if (component->ts.type == BT_CLASS
+      else if (component->ts.type == BT_CLASS && component->attr.class_ok
@@ -2188 +2188 @@ gfc_variable_attr (gfc_expr *expr, gfc_typespec *ts)
-       if (comp->ts.type == BT_CLASS)
+       if (comp->ts.type == BT_CLASS && comp->attr.class_ok)
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -4836,2 +4836,2 @@ gfc_type_compatible (gfc_typespec *ts1, gfc_typespec
*ts2)
-  bool is_class1 = (ts1->type == BT_CLASS);
-  bool is_class2 = (ts2->type == BT_CLASS);
+  bool is_class1 = (ts1->type == BT_CLASS && ts1->u.derived->attr.class_ok);
+  bool is_class2 = (ts2->type == BT_CLASS && ts2->u.derived->attr.class_ok);


  reply	other threads:[~2012-01-21 18:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-04 17:28 [Bug fortran/51754] New: " abenson at caltech dot edu
2012-01-21 19:22 ` burnus at gcc dot gnu.org [this message]
2012-01-21 20:19 ` [Bug fortran/51754] " burnus at gcc dot gnu.org
2012-01-27 23:06 ` dominiq at lps dot ens.fr
2012-01-28 10:06 ` burnus at gcc dot gnu.org
2012-01-28 12:04 ` dominiq at lps dot ens.fr
2012-01-28 12:39 ` dominiq at lps dot ens.fr
2012-01-28 14:20 ` burnus at gcc dot gnu.org
2012-01-29 15:55 ` mikael at gcc dot gnu.org
2012-01-29 16:15 ` mikael at gcc dot gnu.org
2012-01-29 19:42 ` burnus at gcc dot gnu.org
2012-02-02 23:12 ` mikael at gcc dot gnu.org
2012-02-05 10:37 ` burnus at gcc dot gnu.org
2012-02-06  4:14 ` abenson at caltech dot edu

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-51754-4-xCLsX4TuOE@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).