2013-10-21 Tobias Burnus <burnus@net-b.de>
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 21 Oct 2013 19:39:19 +0000 (19:39 +0000)
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 21 Oct 2013 19:39:19 +0000 (19:39 +0000)
        PR fortran/58803
        * decl.c (match_ppc_decl): Prevent later
        double free.

2013-10-21  Tobias Burnus  <burnus@net-b.de>

        PR fortran/58803
        * gfortran.dg/proc_ptr_comp_38.f90: New.

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

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

index 067d1fd..5e51f2b 100644 (file)
@@ -1,3 +1,9 @@
+2013-10-21  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/58803
+       * decl.c (match_ppc_decl): Prevent later
+       double free.
+
 2013-10-17  Andrew MacLeod  <amacleod@redhat.com>
 
        * trans-openmp.c: Include omp-low.h.
index 3a8175f..9c9fd4f 100644 (file)
@@ -5055,7 +5055,14 @@ match_ppc_decl (void)
       if (!gfc_add_proc (&c->attr, name, NULL))
        return MATCH_ERROR;
 
-      c->tb = tb;
+      if (num == 1)
+       c->tb = tb;
+      else
+       {
+         c->tb = XCNEW (gfc_typebound_proc);
+         c->tb->where = gfc_current_locus;
+         *c->tb = *tb;
+       }
 
       /* Set interface.  */
       if (proc_if != NULL)
index c919285..4f277ac 100644 (file)
@@ -1,3 +1,8 @@
+2013-10-21  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/58803
+       * gfortran.dg/proc_ptr_comp_38.f90: New.
+
 2013-10-21  Marek Polacek  <polacek@redhat.com>
 
        PR middle-end/58809
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_comp_38.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_comp_38.f90
new file mode 100644 (file)
index 0000000..2a71ca0
--- /dev/null
@@ -0,0 +1,12 @@
+! { dg-do compile }
+!
+! PR fortran/58803
+!
+! Contributed by Vittorio Zecca
+!
+! Was before ICEing due to a double free
+!
+      type t
+       procedure(real), pointer, nopass  :: f1, f2
+      end type
+      end