[Patch, fortran] PR24092 - recursive derived types - part 2

Paul Thomas paulthomas2@wanadoo.fr
Mon Oct 10 04:41:00 GMT 2005


:ADDPATCH fortran:

Herewith is the promised, improved patch for PR24092.

Not only does this patch not produce unrequited field lists but it is 
somewhat easier to understand.  I have split out a loop through the 
components, which obtains the backend_decls for the derived type 
components, building them if necessary.  After this loop is a test to 
see if the fields exist.  This happens in the circumstance that we are 
seeking to fix and is best discussed with repect to the test case:

      type :: it
         character*10  :: k
         integer :: c(2)
      end type it
      type :: bt                         !! 2nd - gets to check derived 
type components
         type (nt), pointer :: p
      end type bt
      type :: nt                         !! 3rd - builds type(nt)
         type (it) :: i
         type (bt) :: b                  !! 4th - builds type(bt) & 
original call returns.
      end type nt
      type (bt), pointer :: ptr          !! Starting point => make a 
type(bt)

Thus, the original call to gfc_get_derived_type is interrupted by the 
test for the field list, which by now has been done in the course of 
constructing type(nt).

The original mainloop over the components is slightly simplified by use 
of the backend_decls, built in the first loop, for the fields. Also, the 
gcc_assert has been moved to apply to the field, rather than the 
backend_decl. Except, in the recursive case, this part of the code is 
reached on the first time call.

For intrinsic types, the code is unchanged.

Bootstrapped and regtested on FC3/Athlon.  OK for mainline and 4.0?

Paul T


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: submit_pointer.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20051010/961443f4/attachment.txt>


More information about the Gcc-patches mailing list