From 54381af7343506f3be32c51921faae1045fc5574 Mon Sep 17 00:00:00 2001 From: Janus Weil Date: Fri, 20 May 2011 20:05:26 +0200 Subject: [PATCH] re PR fortran/48706 (Type extension inside subroutine) 2011-05-20 Janus Weil PR fortran/48706 * module.c (write_dt_extensions): Do not write extended types which are local to a subroutine. 2011-05-20 Janus Weil PR fortran/48706 * gfortran.dg/extends_12.f03: New. From-SVN: r173966 --- gcc/fortran/ChangeLog | 12 ++++++++++++ gcc/fortran/module.c | 3 +++ gcc/testsuite/ChangeLog | 10 ++++++++++ gcc/testsuite/gfortran.dg/extends_12.f03 | 24 ++++++++++++++++++++++++ 4 files changed, 49 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/extends_12.f03 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 610840130ea..45ca79c6d86 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2011-05-20 Janus Weil + + PR fortran/48706 + * module.c (write_dt_extensions): Do not write extended types which + are local to a subroutine. + 2011-05-20 Joseph Myers * Make-lang.in (GFORTRAN_D_OBJS): Remove version.o and intl.o. @@ -20,6 +26,12 @@ copy for scalar coarrays. * trans-array.c (gfc_conv_array_ref): Ditto. +2011-05-18 Janus Weil + + PR fortran/48700 + * trans-intrinsic.c (gfc_conv_intrinsic_move_alloc): Deallocate 'TO' + argument to avoid memory leaks. + 2011-05-16 Tobias Burnus * gfortran.texi (_gfortran_set_options): Add GFC_STD_F2008_TR. diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index fb8de0e39b6..b6acca3a5f1 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -4817,6 +4817,9 @@ write_dt_extensions (gfc_symtree *st) { if (!gfc_check_symbol_access (st->n.sym)) return; + if (!(st->n.sym->ns && st->n.sym->ns->proc_name + && st->n.sym->ns->proc_name->attr.flavor == FL_MODULE)) + return; mio_lparen (); mio_pool_string (&st->n.sym->name); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ba56b6d7745..a2ccc56f840 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-05-20 Janus Weil + + PR fortran/48706 + * gfortran.dg/extends_12.f03: New. + 2011-05-20 Jason Merrill * g++.dg/template/koenig9.C: New. @@ -53,6 +58,11 @@ * gcc.c-torture/execute/960321-1.x: Remove. +2011-05-18 Janus Weil + + PR fortran/48700 + * gfortran.dg/move_alloc_4.f90: New. + 2011-05-18 H.J. Lu PR target/49002 diff --git a/gcc/testsuite/gfortran.dg/extends_12.f03 b/gcc/testsuite/gfortran.dg/extends_12.f03 new file mode 100644 index 00000000000..a93f6d0f122 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/extends_12.f03 @@ -0,0 +1,24 @@ +! { dg-do compile } +! +! PR 48706: Type extension inside subroutine +! +! Contributed by Tobias Burnus + +module mod_diff_01 + implicit none + type :: foo + end type +contains + subroutine create_ext + type, extends(foo) :: foo_e + end type + end subroutine +end module + +program diff_01 + use mod_diff_01 + implicit none + call create_ext() +end program + +! { dg-final { cleanup-modules "mod_diff_01" } } -- 2.30.2