On Tue, 25 Jul 2017, Vipul Parekh wrote:
> Date: Tue, 25 Jul 2017 11:16:31 -0400
> From: Vipul Parekh <[log in to unmask]>
> Reply-To: Fortran 90 List <[log in to unmask]>
> To: [log in to unmask]
> Subject: Re: Misuse of same_type_as intrinsic?
>
> On Thu, Jul 20, 2017 at 8:24 PM, Malcolm Cohen <[log in to unmask]> wrote:
>>>> I think that a strong case should be made that the behavior of this
>>>> intrinsic should be consistent with SELECT TYPE which does really end
>>>> up being SELECT TYPE AND KIND.
>>
>> No, this would have adverse impacts both on existing program semantics, and on performance.
>>
>
> What impact on performance? And how?
>
> Consider this simple program:
>>>>>>>>>>>>>>>>>>>>
> class(*), allocatable :: x
> class(*), allocatable :: y
>
> allocate( x, source=0.0 )
> allocate( y, source=0D0 )
>
> print *, "same_type_as( real :: x, double precision :: y ) = ",
> same_type_as(x, y)
>
> end
>>>>>>>>>>>>>>>>>>>>
>
> The compilers I am able to try all print F with above program which is
> only what most coders would intuitively expect as the result. But
> based on the original note in this thread, there is some processor out
> there that would disagree with this (it'll be interesting to know
> which one!).
Sun Fortran 95 8.7 Linux_i386 2014/10/20 printed T. We were not told
which other compilers Vipul tried, but gfortran 6.3.1 and ifort version
17.0.0 both printed F.
-- John Harper, School of Mathematics and Statistics
Victoria University, PO Box 600, Wellington 6140, New Zealand
e-mail [log in to unmask] phone (+64)(4)463 5276 fax (+64)(4)463 5045
|