]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR fortran/58803 (Proc-pointer component: free_components deallocates...
authorJanus Weil <janus@gcc.gnu.org>
Sun, 9 Feb 2014 17:32:07 +0000 (18:32 +0100)
committerJanus Weil <janus@gcc.gnu.org>
Sun, 9 Feb 2014 17:32:07 +0000 (18:32 +0100)
2014-02-09  Janus Weil  <janus@gcc.gnu.org>

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

PR fortran/58803
PR fortran/59395
* decl.c (match_ppc_decl): Prevent later double free.

2014-02-09  Janus Weil  <janus@gcc.gnu.org>

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

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

From-SVN: r207644

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 cd277aa3a26e72566c5f16e5113a73ae1168fbfb..32a43bac8dec5791b2d293327bd7672d8ae7bda0 100644 (file)
@@ -1,3 +1,12 @@
+2014-02-09  Janus Weil  <janus@gcc.gnu.org>
+
+       Backport from mainline
+       2013-10-21  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/58803
+       PR fortran/59395
+       * decl.c (match_ppc_decl): Prevent later double free.
+
 2014-02-08  Mikael Morin  <mikael@gcc.gnu.org>
 
        PR fortran/57033
index b748cfd95610ce07228b39c42762f62eb5a0897a..c6e16c7e366a3e4a348a113936e1b07b2e9a7379 100644 (file)
@@ -5069,7 +5069,14 @@ match_ppc_decl (void)
       if (gfc_add_proc (&c->attr, name, NULL) == FAILURE)
        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 4a33d938c40f2827ef56f1cd24ecdaa8faaf0c86..95e206ecbfbdbd0be1c5a6ea38e12ce554a73c84 100644 (file)
@@ -1,3 +1,12 @@
+2014-02-09  Janus Weil  <janus@gcc.gnu.org>
+
+       Backport from mainline
+       2013-10-21  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/58803
+       PR fortran/59395
+       * gfortran.dg/proc_ptr_comp_38.f90: New.
+
 2014-02-08  Mikael Morin  <mikael@gcc.gnu.org>
 
        PR fortran/57033
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