From: Janus Weil Date: Fri, 17 Jun 2011 20:03:04 +0000 (+0200) Subject: re PR fortran/48699 ([OOP] MOVE_ALLOC inside SELECT TYPE) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b53abf71d275c3642dd65d4fdc98a0270fc5ee3c;p=gcc.git re PR fortran/48699 ([OOP] MOVE_ALLOC inside SELECT TYPE) 2011-06-17 Janus Weil PR fortran/48699 * check.c (gfc_check_move_alloc): If 'TO' argument is polymorphic, make sure the vtab is present. 2011-06-17 Janus Weil PR fortran/48699 * gfortran.dg/move_alloc_5.f90: New. From-SVN: r175151 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index e0428211dd7..d7c59819430 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2011-06-17 Janus Weil + + PR fortran/48699 + * check.c (gfc_check_move_alloc): If 'TO' argument is polymorphic, + make sure the vtab is present. + 2011-06-16 Janus Weil PR fortran/49074 diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c index 11789673115..972b290c987 100644 --- a/gcc/fortran/check.c +++ b/gcc/fortran/check.c @@ -2672,6 +2672,10 @@ gfc_check_move_alloc (gfc_expr *from, gfc_expr *to) return FAILURE; } + /* CLASS arguments: Make sure the vtab is present. */ + if (to->ts.type == BT_CLASS) + gfc_find_derived_vtab (from->ts.u.derived); + return SUCCESS; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8fe2a0374bd..1adce47c621 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-06-17 Janus Weil + + PR fortran/48699 + * gfortran.dg/move_alloc_5.f90: New. + 2011-06-17 Hans-Peter Nilsson PR rtl-optimization/48542 diff --git a/gcc/testsuite/gfortran.dg/move_alloc_5.f90 b/gcc/testsuite/gfortran.dg/move_alloc_5.f90 new file mode 100644 index 00000000000..b2759de2c1d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/move_alloc_5.f90 @@ -0,0 +1,24 @@ +! { dg-do run } +! +! PR 48699: [4.6/4.7 Regression] [OOP] MOVE_ALLOC inside SELECT TYPE +! +! Contributed by Salvatore Filippone + +program testmv1 + + type bar + end type + + type, extends(bar) :: bar2 + end type + + class(bar), allocatable :: sm + type(bar2), allocatable :: sm2 + + allocate (sm2) + call move_alloc (sm2,sm) + + if (allocated(sm2)) call abort() + if (.not. allocated(sm)) call abort() + +end program