]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/44584 (Invalid memory access with gfortran.dg/typebound_proc_15.f03)
authorJanus Weil <janus@gcc.gnu.org>
Tue, 3 Aug 2010 11:08:50 +0000 (13:08 +0200)
committerJanus Weil <janus@gcc.gnu.org>
Tue, 3 Aug 2010 11:08:50 +0000 (13:08 +0200)
2010-08-03  Janus Weil  <janus@gcc.gnu.org>

PR fortran/44584
PR fortran/45161
* class.c (add_procs_to_declared_vtab1): Don't add erroneous procedures.
* resolve.c (resolve_tb_generic_targets): Check for errors.

2010-08-03  Janus Weil  <janus@gcc.gnu.org>

PR fortran/44584
PR fortran/45161
* gfortran.dg/typebound_call_9.f03: Modified.
* gfortran.dg/typebound_generic_1.f03: Modified.

From-SVN: r162840

gcc/fortran/ChangeLog
gcc/fortran/class.c
gcc/fortran/resolve.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/typebound_call_9.f03
gcc/testsuite/gfortran.dg/typebound_generic_1.f03

index 3b5a435e0f0d1de720292ca9c0d99e2a349a5695..23c0a1ef1ff30bd685f05aa9ce9fd416f46f7a58 100644 (file)
@@ -1,3 +1,10 @@
+2010-08-03  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/44584
+       PR fortran/45161
+       * class.c (add_procs_to_declared_vtab1): Don't add erroneous procedures.
+       * resolve.c (resolve_tb_generic_targets): Check for errors.
+
 2010-08-02  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/45159
index 9393b562e6d4efe67225358164313a0aae476df0..558fda2fcf3dea252cfdb879353b7bd09600658c 100644 (file)
@@ -257,10 +257,8 @@ add_procs_to_declared_vtab1 (gfc_symtree *st, gfc_symbol *vtype)
   if (st->right)
     add_procs_to_declared_vtab1 (st->right, vtype);
 
-  if (!st->n.tb)
-    return;
-
-  if (!st->n.tb->is_generic && st->n.tb->u.specific)
+  if (st->n.tb && !st->n.tb->error 
+      && !st->n.tb->is_generic && st->n.tb->u.specific)
     add_proc_comp (vtype, st->name, st->n.tb);
 }
 
index 6ccc565ea3e247839d0c0c6cee70b81025ab8c79..90d193cb14a9020a4887910e9477e8e0ba70fb5d 100644 (file)
@@ -10261,7 +10261,7 @@ resolve_tb_generic_targets (gfc_symbol* super_type,
        target_name = target->specific_st->name;
 
        /* Defined for this type directly.  */
-       if (target->specific_st->n.tb)
+       if (target->specific_st->n.tb && !target->specific_st->n.tb->error)
          {
            target->specific = target->specific_st->n.tb;
            goto specific_found;
index a869861b4307f587f4e40909948109b5e99108a2..ffb64744955efb87e58366a9c1922026f1038df1 100644 (file)
@@ -1,3 +1,10 @@
+2010-08-03  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/44584
+       PR fortran/45161
+       * gfortran.dg/typebound_call_9.f03: Modified.
+       * gfortran.dg/typebound_generic_1.f03: Modified.
+
 2010-08-02  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/45159
index 6bb2ca88303360e8d4cd5fb8434765388e1151cc..4863f07eb596709ff736639da6eeb3979a622643 100644 (file)
@@ -17,7 +17,7 @@ module foo_mod
   contains
 
     procedure, pass(a) :: makenull ! { dg-error "has no argument 'a'" }
-    generic :: null2 => makenull
+    generic :: null2 => makenull   ! { dg-error "Undefined specific binding" }
 
   end type base_foo_type
 
@@ -50,7 +50,7 @@ contains
     endif
 
     call a%makenull()
-    call a%null2 () ! { dg-error "no matching specific binding" }
+    call a%null2 () ! { dg-error "should be a SUBROUTINE" }
 
     Return
   End Subroutine foo_free
index 1ae08fc14f2cec45a1d9f7dc0a6ab5a9049ec14b..fb1dfaec663d5c7ff220a739192c898f5f8f6643 100644 (file)
@@ -18,7 +18,7 @@ MODULE m
     GENERIC :: gen1 => p1a ! { dg-error "are ambiguous" }
 
     GENERIC, PUBLIC :: gen1 => p1, p2
-    GENERIC :: gen1 => p3 ! Implicitelly PUBLIC.
+    GENERIC :: gen1 => p3 ! Implicitly PUBLIC.
     GENERIC, PRIVATE :: gen2 => p1
 
     GENERIC :: gen2 => p2 ! { dg-error "same access" }
@@ -29,7 +29,8 @@ MODULE m
     GENERIC :: gen3 => ! { dg-error "specific binding" }
     GENERIC :: gen4 => p1 x ! { dg-error "Junk after" }
     GENERIC :: gen5 => p_notthere ! { dg-error "Undefined specific binding" }
-    GENERIC :: gen6 => gen1 ! { dg-error "must target a specific binding" }
+    GENERIC :: gen6 => p1
+    GENERIC :: gen7 => gen6 ! { dg-error "must target a specific binding" }
 
     GENERIC :: gensubr => p2 ! { dg-error "mixed FUNCTION/SUBROUTINE" }
     GENERIC :: gensubr => subr