[Patch, fortran-dev] SELECT TYPE execution and allocatable scalar components

Janus Weil janus@gcc.gnu.org
Tue Sep 22 13:49:00 GMT 2009


> The attached is my attempt to build up a derived type actual argument
> to match a formal class.  I did this in trans-expr.c in the end.

Great, that seems to eliminate pretty much all the runtime failures in
the testsuite and that brings our regression count down to one:

FAIL: gfortran.dg/typebound_operator_4.f03  -O  (internal compiler error)

gfortran-4.5 typebound_operator_4.f03
typebound_operator_4.f03: In function ‘assign_real’:
typebound_operator_4.f03:60:0: internal compiler error: in
fold_convert_loc, at fold-const.c:2720

This looks similar to Salvatore's failure, but is a different issue I think.



> The next thing that you will have to do within the TYPE IS and CLASS
> IS blocks is to implicitly assign the data and the vindex to a hidden
> variable which then substitutes the selector within the block.
>
> eg.  SELECT TYPE (selector)
>           TYPE IS (selector_derived1)
>               {TYPE(selector_derived1) :: $selector.selector_derived1
> (arrayspec & attrs of selector }
>               {$selector.selector_derived1%$data => selector_derived1%$data}
>               {$selector.selector_derived1%$vindex = selector_derived1%$vindex}
>                  .........rest of block with
> $selector.selector_derived1 replacing selector.
>
> where braces denote gfc_code injected in the frontend.
>
> This allows the blocks to access all the components of the local type,
> in addition to those of the declared type.

Ah, good point. I almost forgot about this ...


Cheers,
Janus



More information about the Fortran mailing list