]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/55983 (ICE in find_typebound_proc_uop, at fortran/class.c:2711)
authorJanus Weil <janus@gcc.gnu.org>
Wed, 16 Jan 2013 19:52:10 +0000 (20:52 +0100)
committerJanus Weil <janus@gcc.gnu.org>
Wed, 16 Jan 2013 19:52:10 +0000 (20:52 +0100)
2013-01-16  Janus Weil  <janus@gcc.gnu.org>

PR fortran/55983
* class.c (find_typebound_proc_uop): Check for f2k_derived instead of
asserting it.

2013-01-16  Janus Weil  <janus@gcc.gnu.org>

PR fortran/55983
* gfortran.dg/class_55.f90: New.

From-SVN: r195251

gcc/fortran/ChangeLog
gcc/fortran/class.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/class_55.f90 [new file with mode: 0644]

index fc39b414959801a3a1d3ba8cead905e5d841e9aa..6477c4849b8a693462d41feb7f46ac13a803de0e 100644 (file)
@@ -1,3 +1,9 @@
+2013-01-16  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/55983
+       * class.c (find_typebound_proc_uop): Check for f2k_derived instead of
+       asserting it.
+
 2013-01-16  Jakub Jelinek  <jakub@redhat.com>
            Tobias Burnus  <burnus@net-b.de>
 
index 3bb326cf0fb1ec8e8f422a7ad198582b7e542a03..9ef30f6d3318abd197b77f41df4911ec81dcfa96 100644 (file)
@@ -2707,15 +2707,17 @@ find_typebound_proc_uop (gfc_symbol* derived, gfc_try* t,
   gfc_symtree* res;
   gfc_symtree* root;
 
-  /* Set correct symbol-root.  */
-  gcc_assert (derived->f2k_derived);
-  root = (uop ? derived->f2k_derived->tb_uop_root
-             : derived->f2k_derived->tb_sym_root);
-
   /* Set default to failure.  */
   if (t)
     *t = FAILURE;
 
+  if (derived->f2k_derived)
+    /* Set correct symbol-root.  */
+    root = (uop ? derived->f2k_derived->tb_uop_root
+               : derived->f2k_derived->tb_sym_root);
+  else
+    return NULL;
+
   /* Try to find it in the current type's namespace.  */
   res = gfc_find_symtree (root, name);
   if (res && res->n.tb && !res->n.tb->error)
index c6473f2cbcffcdb41281f249a02a05746a96b72d..7572696951e7bf3983811047db7a20da90ed04dd 100644 (file)
@@ -1,3 +1,8 @@
+2013-01-16  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/55983
+       * gfortran.dg/class_55.f90: New.
+
 2013-01-16  Janis Johnson  <janisjo@codesourcery.com>
 
        PR testsuite/55994
diff --git a/gcc/testsuite/gfortran.dg/class_55.f90 b/gcc/testsuite/gfortran.dg/class_55.f90
new file mode 100644 (file)
index 0000000..b47989f
--- /dev/null
@@ -0,0 +1,12 @@
+! { dg-do compile }
+!
+! PR 55983: [4.7/4.8 Regression] ICE in find_typebound_proc_uop, at fortran/class.c:2711
+!
+! Contributed by Sylwester Arabas <slayoo@staszic.waw.pl>
+
+  type :: mpdata_t
+    class(bcd_t), pointer :: bcx, bcy   ! { dg-error "is a type that has not been declared" }
+  end type
+  type(mpdata_t) :: this
+  call this%bcx%fill_halos()            ! { dg-error "is being used before it is defined" }
+end