aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/check.c
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2011-12-03 12:03:30 +0100
committerTobias Burnus <burnus@gcc.gnu.org>2011-12-03 12:03:30 +0100
commitfde50fe6afbf70fc1dfeb1f0c69e404c894bfd2c (patch)
treeda9bfc5a55ce02996170af86a28a72042901bfd9 /gcc/fortran/check.c
parentdf1204ec90c671971a8da2e0551db3ffe5a6e567 (diff)
downloadgcc-fde50fe6afbf70fc1dfeb1f0c69e404c894bfd2c.zip
gcc-fde50fe6afbf70fc1dfeb1f0c69e404c894bfd2c.tar.gz
gcc-fde50fe6afbf70fc1dfeb1f0c69e404c894bfd2c.tar.bz2
check.c (gfc_check_move_alloc): Allow nonpolymorphic FROM with polymorphic TO.
2011-12-03 Tobias Burnus <burnus@net-b.de> * check.c (gfc_check_move_alloc): Allow nonpolymorphic FROM with polymorphic TO. * trans-intrinsic.c (conv_intrinsic_move_alloc): Handle nonpolymorphic FROM with polymorphic TO. 2011-12-03 Tobias Burnus <burnus@net-b.de> * gfortran.dg/select_type_23.f03: Revert Rev. 181801, i.e. remove the dg-error line. * gfortran.dg/move_alloc_5.f90: Ditto and change back to dg-do run. * gfortran.dg/move_alloc_9.f90: New. * gfortran.dg/move_alloc_10.f90: New From-SVN: r181966
Diffstat (limited to 'gcc/fortran/check.c')
-rw-r--r--gcc/fortran/check.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 832eb64..605c77d 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -2688,17 +2688,17 @@ gfc_check_move_alloc (gfc_expr *from, gfc_expr *to)
if (allocatable_check (to, 1) == FAILURE)
return FAILURE;
- if (same_type_check (to, 1, from, 0) == FAILURE)
- return FAILURE;
-
- if (to->ts.type != from->ts.type)
+ if (from->ts.type == BT_CLASS && to->ts.type == BT_DERIVED)
{
- gfc_error ("The FROM and TO arguments in MOVE_ALLOC call at %L must be "
- "either both polymorphic or both nonpolymorphic",
+ gfc_error ("The TO arguments in MOVE_ALLOC at %L must be "
+ "polymorphic if FROM is polymorphic",
&from->where);
return FAILURE;
}
+ if (same_type_check (to, 1, from, 0) == FAILURE)
+ return FAILURE;
+
if (to->rank != from->rank)
{
gfc_error ("the '%s' and '%s' arguments of '%s' intrinsic at %L must "
@@ -2718,7 +2718,7 @@ gfc_check_move_alloc (gfc_expr *from, gfc_expr *to)
return FAILURE;
}
- /* CLASS arguments: Make sure the vtab is present. */
+ /* CLASS arguments: Make sure the vtab of from is present. */
if (to->ts.type == BT_CLASS)
gfc_find_derived_vtab (from->ts.u.derived);