2009-09-05 Paul Thomas <pault@gcc.gnu.org>
authorpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 5 Sep 2009 14:20:51 +0000 (14:20 +0000)
committerpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 5 Sep 2009 14:20:51 +0000 (14:20 +0000)
PR fortran/41258
* primary.c (gfc_match_varspec): Do not look for typebound
procedures unless the derived type has a f2k_derived namespace.

2009-09-05  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/41258
* gfortran.dg/typebound_proc_12.f90 : New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151451 138bc75d-0d04-0410-961f-82ee72b054a4

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

index aeae283..c392d9d 100644 (file)
@@ -1,3 +1,9 @@
+2009-09-05  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/41258
+       * primary.c (gfc_match_varspec): Do not look for typebound
+       procedures unless the derived type has a f2k_derived namespace.
+
 2009-09-03  Diego Novillo  <dnovillo@google.com>
 
        * f95-lang.c (lang_hooks): Remove const qualifier.
index 267819c..f25de23 100644 (file)
@@ -1783,7 +1783,11 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag,
       if (m != MATCH_YES)
        return MATCH_ERROR;
 
-      tbp = gfc_find_typebound_proc (sym, &t, name, false, &gfc_current_locus);
+      if (sym->f2k_derived)
+       tbp = gfc_find_typebound_proc (sym, &t, name, false, &gfc_current_locus);
+      else
+       tbp = NULL;
+
       if (tbp)
        {
          gfc_symbol* tbp_sym;
index 57ddbac..cd46171 100644 (file)
@@ -1,3 +1,8 @@
+2009-09-05  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/41258
+       * gfortran.dg/typebound_proc_12.f90 : New test.
+
 2009-09-04  Alexandre Oliva  <aoliva@redhat.com>
 
        PR debug/41225
diff --git a/gcc/testsuite/gfortran.dg/typebound_proc_12.f90 b/gcc/testsuite/gfortran.dg/typebound_proc_12.f90
new file mode 100644 (file)
index 0000000..4612d49
--- /dev/null
@@ -0,0 +1,12 @@
+! { dg-do compile }
+! Test the fix for PR41258, where an ICE was caused by a search
+! for a typebound procedure to resolve d%c%e
+!
+! Contributed by Joost VandeVondele <jv244@cam.ac.uk>
+!
+  TYPE a
+    TYPE(b), DIMENSION(:), POINTER :: c  ! { dg-error "type that has not been declared" }
+  END TYPE
+  TYPE(a), POINTER :: d
+  CALL X(d%c%e)         ! { dg-error "before it is defined" }
+end