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]

Re: [Patch, fortran] PR58793 - Wrong value for _vtab for intrinsic types with CLASS(*): storage_size of class(*) gives wrong result


Dear Tobias,


>
> Looks good to me. Thanks for the patch.
>
........
>
> I think that should be done as follow-up patch.In particular, it is not
> obvious how it should be handled.

OK - I'll commit tonight, as is.

>
> The program below ICEs in gfc_typenode_for_spec;with both Intel's and Cray's
> compiler, it gives
>  Character with len 3
>  Something else
> I somehow had expected that it maps to a character.

I guess that it would do no harm to do that mapping.... anyway, I'll
have a think about it tonight.

Cheers and thanks for the review.

Paul

>
> program test
>   call up("abc")
>   call up(3habc)
> contains
>   subroutine up(x)
>     class(*) :: x
>     select type(x)
>      type is (character(*))
>       print *, 'Character with len', len(x)
>      class default
>       print *, 'Something else'
>     end select
>   end subroutine
> end program test
>
>  The following - related to TYPE(*) - is also accepted, but I think it
> shouldn't. (call up(x) is presumably invalid). It fails here at assembler
> time.
>
> program test
>   use iso_c_binding
>   integer,target ::aa
>   call up(c_loc(aa)) ! Probably okay but not matchable?
>   call bar(aa) !OK
> contains
>   subroutine up(x)
>     class(*) :: x
>     select type(x)
> !     type is (c_ptr) ! invalid & rejected by gfortran
> !      print *, 'C_ptr'
>      class default
>       print *, 'Something else'
>     end select
>   end subroutine
>   subroutine bar(x)
>    type(*) :: x
>    call up(x) ! Invalid
>   end subroutine bar
> end program test
>
>
> Tobias
>
>
>> 2013-10-20  Paul Thomas  <pault@gcc.gnu.org>
>>
>>      PR fortran 57893
>>      * class.c : Include target-memory.h.
>>      (gfc_find_intrinsic_vtab) Build a minimal expression so that
>>      gfc_element_size can be used to obtain the storage size, rather
>>      that the kind value.
>>
>> 2013-10-20  Paul Thomas  <pault@gcc.gnu.org>
>>
>>      PR fortran 57893
>>      * gfortran.dg/unlimited_polymorphic_12.f90 : New test.
>
>



-- 
The knack of flying is learning how to throw yourself at the ground and miss.
       --Hitchhikers Guide to the Galaxy


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