diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index ce3e62cac8e..d7de098028c 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2007-07-31 Francois-Xavier Coudert + + PR fortran/32938 + * trans-stmt.c (gfc_trans_return): Convert to correct type. + 2007-07-31 Steven G. Kargl PR fortran/32942 diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c index 0ec1435dad4..e731967bbb2 100644 --- a/gcc/fortran/trans-stmt.c +++ b/gcc/fortran/trans-stmt.c @@ -447,7 +447,8 @@ gfc_trans_return (gfc_code * code ATTRIBUTE_UNUSED) gfc_conv_expr (&se, code->expr); - tmp = build2 (MODIFY_EXPR, TREE_TYPE (result), result, se.expr); + tmp = build2 (MODIFY_EXPR, TREE_TYPE (result), result, + fold_convert (TREE_TYPE (result), se.expr)); gfc_add_expr_to_block (&se.pre, tmp); tmp = build1_v (GOTO_EXPR, gfc_get_return_label ()); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4990638e685..1c05bf0ec99 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-07-31 Francois-Xavier Coudert + + PR fortran/32938 + * gfortran.dg/altreturn_6.f90: New test. + 2007-07-31 Steven G. Kargl PR fortran/32942 diff --git a/gcc/testsuite/gfortran.dg/altreturn_6.f90 b/gcc/testsuite/gfortran.dg/altreturn_6.f90 new file mode 100644 index 00000000000..61f5f605990 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/altreturn_6.f90 @@ -0,0 +1,5 @@ +! PR 32938 +subroutine r (*) + integer(kind=8) :: i + return i +end