OSDN Git Service

2006-01-09 Andrew Pinski <pinskia@physics.uc.edu>
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 9 Jan 2006 19:36:35 +0000 (19:36 +0000)
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 9 Jan 2006 19:36:35 +0000 (19:36 +0000)
        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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@109503 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/trans-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/nesting_2.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/nesting_3.f90 [new file with mode: 0644]

index a745970..9c92709 100644 (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
index aa4a3b0..a3b5d98 100644 (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.  */
index eac71e9..92f7e02 100644 (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.
diff --git a/gcc/testsuite/gfortran.dg/nesting_2.f90 b/gcc/testsuite/gfortran.dg/nesting_2.f90
new file mode 100644 (file)
index 0000000..e3ec9c9
--- /dev/null
@@ -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
diff --git a/gcc/testsuite/gfortran.dg/nesting_3.f90 b/gcc/testsuite/gfortran.dg/nesting_3.f90
new file mode 100644 (file)
index 0000000..0a052da
--- /dev/null
@@ -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