Commit e46aceff by Erik Edelmann

re PR fortran/18197 (bus error on returning from a function)

fortran/
2005-12-14  Erik Edelmann  <eedelman@gcc.gnu.org>

        PR fortran/18197
        * resolve.c (resolve_formal_arglist): Remove code to set
        the type of a function symbol from it's result symbol.


testsuite/
2005-12-14  Erik Edelmann  <eedelman@gcc.gnu.org>

        PR fortran/18197
        * gfortran.dg/dummy_functions_1.f90: New.

From-SVN: r108555
parent a9573616
2005-12-14 Erik Edelmann <eedelman@gcc.gnu.org>
PR fortran/18197
* resolve.c (resolve_formal_arglist): Remove code to set
the type of a function symbol from it's result symbol.
2005-12-13 Richard Guenther <rguenther@suse.de> 2005-12-13 Richard Guenther <rguenther@suse.de>
* trans-expr.c (gfc_conv_substring): Use fold_build2 and * trans-expr.c (gfc_conv_substring): Use fold_build2 and
......
...@@ -137,16 +137,6 @@ resolve_formal_arglist (gfc_symbol * proc) ...@@ -137,16 +137,6 @@ resolve_formal_arglist (gfc_symbol * proc)
{ {
if (!sym->attr.function || sym->result == sym) if (!sym->attr.function || sym->result == sym)
gfc_set_default_type (sym, 1, sym->ns); gfc_set_default_type (sym, 1, sym->ns);
else
{
/* Set the type of the RESULT, then copy. */
if (sym->result->ts.type == BT_UNKNOWN)
gfc_set_default_type (sym->result, 1, sym->result->ns);
sym->ts = sym->result->ts;
if (sym->as == NULL)
sym->as = gfc_copy_array_spec (sym->result->as);
}
} }
gfc_resolve_array_spec (sym->as, 0); gfc_resolve_array_spec (sym->as, 0);
......
2005-12-14 Erik Edelmann <eedelman@gcc.gnu.org>
PR fortran/18197
* gfortran.dg/dummy_functions_1.f90: New.
2005-12-14 Ulrich Weigand <uweigand@de.ibm.com> 2005-12-14 Ulrich Weigand <uweigand@de.ibm.com>
PR rtl-optimization/25310 PR rtl-optimization/25310
...@@ -38939,3 +38944,4 @@ rlsruhe.de> ...@@ -38939,3 +38944,4 @@ rlsruhe.de>
correspond to c-torture 1.11. correspond to c-torture 1.11.
* New file. * New file.
! { dg-do compile }
! PR 18197: Check that dummy functions with RESULT variable and dimension works.
module innerfun
contains
function f(n,x) result(y)
integer, intent(in) :: n
real, dimension(:), intent(in) :: x
real, dimension(n) :: y
y = 1
end function f
end module innerfun
module outerfun
contains
subroutine foo(n,funname)
integer, intent(in) :: n
real, dimension(n) :: y
real, dimension(2) :: x
interface
function funname(n,x) result(y)
integer, intent(in) :: n
real, dimension(:), intent(in) :: x
real, dimension(n) :: y
end function funname
end interface
y = funname(n, (/ 0.2, 0.3 /) )
end subroutine foo
end module outerfun
program test
use outerfun
use innerfun
call foo(3,f)
end program test
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment