]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/58803 (Proc-pointer component: free_components deallocates twice pointe...
authorTobias Burnus <burnus@net-b.de>
Mon, 21 Oct 2013 19:39:19 +0000 (21:39 +0200)
committerTobias Burnus <burnus@gcc.gnu.org>
Mon, 21 Oct 2013 19:39:19 +0000 (21:39 +0200)
2013-10-21  Tobias Burnus  <burnus@net-b.de>

        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.

From-SVN: r203909

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 067d1fdca5ba24f5f1ba2879bb925a5cd9e8a7a5..5e51f2bbc276bffa8486db03ad2d532c1cafd60b 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 3a8175f3ff203be9645375521115a86cd4dd4d97..9c9fd4ffbf0488ea1e2b2d1acae312c42a7eba08 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 c91928561b02d37125423170cecae72c6199e965..4f277ac9e6197fc8ac45bd0defcb2ec58dc169b5 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