This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, Fortran] PR42650 - F90: DT function with in-line DT definition and RESULT is rejected


Another kind of obvious patch.

Build & regtested on x86-64-linux.
OK for the trunk?

Tobias

PS: Paul, thanks for your review! I have added the variable declaration
and assignment for the other patch before committal.
2010-02-02  Tobias Burnus  <burnus@net-b.de>

	PR fortran/42650
	* parse.c (decode_specification_statement): Use sym->result not sym.

2010-02-02  Tobias Burnus  <burnus@net-b.de>

	PR fortran/42650
	* gfortran.dg/func_result_5.f90: New test.

Index: gcc/fortran/parse.c
===================================================================
--- gcc/fortran/parse.c	(Revision 156433)
+++ gcc/fortran/parse.c	(Arbeitskopie)
@@ -111,7 +111,7 @@ decode_specification_statement (void)
   match ("import", gfc_match_import, ST_IMPORT);
   match ("use", gfc_match_use, ST_USE);
 
-  if (gfc_current_block ()->ts.type != BT_DERIVED)
+  if (gfc_current_block ()->result->ts.type != BT_DERIVED)
     goto end_of_block;
 
   match (NULL, gfc_match_st_function, ST_STATEMENT_FUNCTION);
Index: gcc/testsuite/gfortran.dg/func_result_5.f90
===================================================================
--- gcc/testsuite/gfortran.dg/func_result_5.f90	(Revision 0)
+++ gcc/testsuite/gfortran.dg/func_result_5.f90	(Revision 0)
@@ -0,0 +1,14 @@
+! { dg-do compile }
+!
+! PR fortran/42650
+!
+! Result type was not working
+!
+
+type(t) function func2() result(res)
+  type t
+    sequence
+    integer :: i = 5
+  end type t
+  res%i = 2
+end function func2

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]