re PR fortran/21977 (nested function returning array)

2006-01-09  Andrew Pinski  <pinskia@physics.uc.edu>

        PR fortran/21977
        * gfortran.dg/nesting_2.f90: New test.
        * gfortran.dg/nesting_3.f90: New test.

2006-01-09  Andrew Pinski  <pinskia@physics.uc.edu>

        PR fortran/21977
        * trans-decl.c (gfc_generate_function_code): Move the NULLing of
        current_fake_result_decl down to below generate_local_vars.

From-SVN: r109503
This commit is contained in:
Andrew Pinski 2006-01-09 19:36:35 +00:00 committed by Andrew Pinski
parent 487bf3e670
commit 90b2f8b640
5 changed files with 44 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2006-01-09 Andrew Pinski <pinskia@physics.uc.edu>
PR fortran/21977
* trans-decl.c (gfc_generate_function_code): Move the NULLing of
current_fake_result_decl down to below generate_local_vars.
2006-01-09 Feng Wang <fengwang@nudt.edu.cn>
PR fortran/12456

View File

@ -2558,9 +2558,6 @@ gfc_generate_function_code (gfc_namespace * ns)
trans_function_start (sym);
/* Will be created as needed. */
current_fake_result_decl = NULL_TREE;
gfc_start_block (&block);
if (ns->entries && ns->proc_name->ts.type == BT_CHARACTER)
@ -2582,7 +2579,9 @@ gfc_generate_function_code (gfc_namespace * ns)
gfc_generate_contained_functions (ns);
generate_local_vars (ns);
/* Will be created as needed. */
current_fake_result_decl = NULL_TREE;
current_function_return_label = NULL;
/* Now generate the code for the body of this function. */

View File

@ -1,3 +1,9 @@
2006-01-09 Andrew Pinski <pinskia@physics.uc.edu>
PR fortran/21977
* gfortran.dg/nesting_2.f90: New test.
* gfortran.dg/nesting_3.f90: New test.
2006-01-09 Hans-Peter Nilsson <hp@axis.com>
* gcc.dg/Wpadded.c: Gate alignment warning on ! default_packed.

View File

@ -0,0 +1,15 @@
! check to make the nested function dawsonseries_v gets the correct
! fake return decl and that the outer (dawson_v) has an assignment of
! just the fake return decl for real and not the inner's return decl.
FUNCTION dawson_v()
IMPLICIT NONE
REAL :: dawson_v
dawson_v = 1.0
CONTAINS
FUNCTION dawsonseries_v()
IMPLICIT NONE
REAL, DIMENSION(1) :: dawsonseries_v
dawsonseries_v=1.0
END FUNCTION dawsonseries_v
END FUNCTION dawson_v

View File

@ -0,0 +1,14 @@
! check to make the nested function dawsonseries_v gets the correct
! fake return decl and that the outer (dawson_v) has an assignment of
! just the fake return decl for real and not the inner's return decl.
FUNCTION dawson_v()
IMPLICIT NONE
REAL,DIMENSION(1) :: dawson_v
dawson_v = 1.0
CONTAINS
FUNCTION dawsonseries_v()
IMPLICIT NONE
REAL, DIMENSION(1) :: dawsonseries_v
dawsonseries_v=1.0
END FUNCTION dawsonseries_v
END FUNCTION dawson_v