Google Groups Home
Help | Sign in
Message from discussion KIND optional argument in transformational intrinsics
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
James Van Buskirk  
View profile
 More options May 16, 4:19 am
Newsgroups: comp.lang.fortran
From: "James Van Buskirk" <not_va...@comcast.net>
Date: Fri, 16 May 2008 02:19:53 -0600
Local: Fri, May 16 2008 4:19 am
Subject: KIND optional argument in transformational intrinsics
I found that gfortran is missing the KIND optional argument in some
of the transformational intrinsics.  Also a couple of usages of KIND
were not documented, and gfortran does not yet accept f2008 usage for
the SIZE intrinsic.

C:\gfortran\james\intrinsics\func1>type kind.f90
program test
   implicit none
   integer, parameter :: ck = kind('A')
   integer, parameter :: ik = selected_int_kind(18)
   integer i
   real x
   integer array(1)

   i = 42
   x = 3.14
   array = 13

   write(*,*) achar(i,kind=ck) ! KIND works but is not documented
   write(*,*) char(i,kind=ck) ! KIND works but is not documented
   write(*,*) maxloc(array,kind=ik) ! Consistent with f2003 usage
   write(*,*) minloc(array,kind=ik) ! Consistent with f2003 usage
   write(*,*) nint(x,kind=ik) ! KIND works but is not documented
   write(*,*) shape(array,kind=ik) ! Consistent with f2003 usage
   write(*,*) size(ik) ! Consistent with f2008 usage
end program test

C:\gfortran\james\intrinsics\func1>gfortran kind.f90 -okind
kind.f90:15.13:

   write(*,*) maxloc(array,kind=ik) ! Consistent with f2003 usage
            1
Error: Can't find keyword named 'kind' in call to 'maxloc' at (1)
kind.f90:16.13:

   write(*,*) minloc(array,kind=ik) ! Consistent with f2003 usage
            1
Error: Can't find keyword named 'kind' in call to 'minloc' at (1)
kind.f90:18.13:

   write(*,*) shape(array,kind=ik) ! Consistent with f2003 usage
            1
Error: Too many arguments in call to 'shape' at (1)
kind.f90:19.19:

   write(*,*) size(ik) ! Consistent with f2008 usage
                  1
Error: 'array' argument of 'size' intrinsic at (1) must be an array

--
write(*,*) transfer((/17.392111325966148d0,6.5794487871554595D-85, &
6.0134700243160014d-154/),(/'x'/)); end


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google