]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/56575 (An invalid OO code causes ICE)
authorPaul Thomas <pault@gcc.gnu.org>
Wed, 13 Mar 2013 06:36:02 +0000 (06:36 +0000)
committerPaul Thomas <pault@gcc.gnu.org>
Wed, 13 Mar 2013 06:36:02 +0000 (06:36 +0000)
2013-03-13  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/56575
* expr.c (gfc_default_initializer): Check that a class declared
type has any components.
* resolve.c (resolve_fl_derived0): On failing the test for C437
set the type to BT_UNKNOWN to prevent repeat error messages.

2013-03-13  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/56575
* gfortran.dg/class_56.f90: New test.

From-SVN: r196628

gcc/fortran/ChangeLog
gcc/fortran/expr.c
gcc/fortran/resolve.c
gcc/testsuite/ChangeLog

index 728c8e93e1ea6d2122d2d894f5de4fe2937aadd1..6cf6aa6ca44d0b5c0a2ff48c74db8ab584898322 100644 (file)
@@ -1,3 +1,11 @@
+2013-03-13  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/56575
+       * expr.c (gfc_default_initializer): Check that a class declared
+       type has any components.
+       * resolve.c (resolve_fl_derived0): On failing the test for C437
+       set the type to BT_UNKNOWN to prevent repeat error messages.
+
 2013-03-10  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/55362
index 8fa542e807926943e240f18f0211ff15876000bc..5fa937e8546192e5aed6d925eb02934e5ec5c0e4 100644 (file)
@@ -3704,7 +3704,8 @@ gfc_default_initializer (gfc_typespec *ts)
      types (otherwise we could use gfc_has_default_initializer()).  */
   for (comp = ts->u.derived->components; comp; comp = comp->next)
     if (comp->initializer || comp->attr.allocatable
-       || (comp->ts.type == BT_CLASS && CLASS_DATA (comp)->attr.allocatable))
+       || (comp->ts.type == BT_CLASS && CLASS_DATA (comp)
+           && CLASS_DATA (comp)->attr.allocatable))
       break;
 
   if (!comp)
index ae6e8cedbb937b2c94c143eff82af6fb6cc63f9c..9ba9455aff9028b5e6364e315064b66b24a83277 100644 (file)
@@ -11759,6 +11759,8 @@ resolve_fl_derived0 (gfc_symbol *sym)
        {
          gfc_error ("Component '%s' with CLASS at %L must be allocatable "
                     "or pointer", c->name, &c->loc);
+         /* Prevent a recurrence of the error.  */
+         c->ts.type = BT_UNKNOWN;
          return FAILURE;
        }
 
index 1bda4549af1d5ab7d41a5d3102439a508b1cc26f..401c1ed54a63666253841c62fb6617926b030621 100644 (file)
@@ -1,3 +1,8 @@
+2013-03-13  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/56575
+       * gfortran.dg/class_56.f90: New test.
+
 2013-03-10  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/55362