KIND optional argument in transformational intrinsics
  Home FAQ Contact Sign in
comp.lang.fortran only
 
Advanced search
POPULAR GROUPS

more...

comp.lang.fortran Profile…
 Up
KIND optional argument in transformational intrinsics         


Author: James Van Buskirk
Date: May 16, 2008 01:19

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
Show full article (1.76Kb)
16 Comments
Re: KIND optional argument in transformational intrinsics         


Author: FX
Date: May 16, 2008 01:28

> 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

The "works but not documented" cases are documentation bugs indeed. The
others are just because gfortran is not yet a full F2003 compiler, and
are already known.

--
FX
no comments
Re: KIND optional argument in transformational intrinsics         


Author: James Giles
Date: May 16, 2008 11:01

James Van Buskirk wrote:
> [...] and gfortran does not yet accept f2008 usage for
> the SIZE intrinsic.

You astonish me. An F95 complier with some f2003
features that doesn't fully support a standard that hasn't
even been approved yet?!? This is unacceptable!

--
J. Giles

"I conclude that there are two ways of constructing a software
design: One way is to make it so simple that there are obviously
no deficiencies and the other way is to make it so complicated
that there are no obvious deficiencies." -- C. A. R. Hoare
no comments
Re: KIND optional argument in transformational intrinsics         


Author: James Van Buskirk
Date: May 16, 2008 11:49

"James Giles" worldnet.att.net> wrote in message
news:CZjXj.214613$D_3.97013@bgtnsc05-news.ops.worldnet.att.net...
> James Van Buskirk wrote:
>> [...] and gfortran does not yet accept f2008 usage for
>> the SIZE intrinsic.
> You astonish me. An F95 complier with some f2003
> features that doesn't fully support a standard that hasn't
> even been approved yet?!? This is unacceptable!

Well, I was hoping that the issues raised in this thread were in the
feasible range. Not supporting KIND optional argument for MAXLOC,
MINLOC, and SHAPE for a compiler that uses nondefault integers for
array indices internally might be considered a bug by some:

C:\gfortran\test\large>gfortran large.f90 -olarge

C:\gfortran\test\large>large
2
1
2
Show full article (1.61Kb)
no comments
Re: KIND optional argument in transformational intrinsics         


Author: Thomas Koenig
Date: May 16, 2008 12:03

On 2008-05-16, James Van Buskirk comcast.net> wrote:
> Well, I was hoping that the issues raised in this thread were in the
> feasible range. Not supporting KIND optional argument for MAXLOC,
> MINLOC, and SHAPE for a compiler that uses nondefault integers for
> array indices internally might be considered a bug by some:

It is considered a bug (an enhancement-one, though): http://gcc.gnu.org/PR29600
no comments
Re: KIND optional argument in transformational intrinsics         


Author: James Van Buskirk
Date: May 16, 2008 12:34

"James Van Buskirk" comcast.net> wrote in message
news:UtKdneAOs8GoSrDVnZ2dnUVZ_vadnZ2d@comcast.com...
> Man, that paged everything out! Also supporting scalar actual
> argument for ARRAY argument to SIZE intrinsic doesn't seem that
> hard: the compiler already detects the case, so all that would be
> left is to check the DIM argument (1 <= DIM <= 0) :) and give the
> result as INT(0,KIND).

Must have paged me out as well. The result should have been
INT(1,KIND) for scalar ARRAY actual argument (I think).

--
write(*,*) transfer((/17.392111325966148d0,6.5794487871554595D-85, &
6.0134700243160014d-154/),(/'x'/)); end
no comments
Re: KIND optional argument in transformational intrinsics         


Author: James Giles
Date: May 16, 2008 12:35

James Van Buskirk wrote:
> "James Giles" worldnet.att.net> wrote in message
> news:CZjXj.214613$D_3.97013@bgtnsc05-news.ops.worldnet.att.net...
...
>> You astonish me. An F95 complier with some f2003
>> features that doesn't fully support a standard that hasn't
>> even been approved yet?!? This is unacceptable!

Well, I misread your original article. I thought the following
really was some new f2008 usage:

write(*,*) size(ik) ! Consistent with f2008 usage

Turns out that F2008 also requires the initial (non-optional)
argument to SIZE to be an array. You line is simply wrong.
(I thought maybe F2008 was doing this as a way of reporting
the bit- or byte-size of a default integer.)

Now, if your example had said:

write(*,*) size(array,ik) ! Consistent with f2008 usage

Maybe I wouldn't have thought that was so completely absurd.
Show full article (1.38Kb)
no comments
Re: KIND optional argument in transformational intrinsics         


Author: James Van Buskirk
Date: May 16, 2008 12:56

"James Giles" worldnet.att.net> wrote in message
news:kmlXj.214889$D_3.196336@bgtnsc05-news.ops.worldnet.att.net...
> James Van Buskirk wrote:
> Well, I misread your original article. I thought the following
> really was some new f2008 usage:
> write(*,*) size(ik) ! Consistent with f2008 usage
> Turns out that F2008 also requires the initial (non-optional)
> argument to SIZE to be an array. You line is simply wrong.
> (I thought maybe F2008 was doing this as a way of reporting
> the bit- or byte-size of a default integer.)

Am I reading an obsolete draft? In N1723.pdf, section 13.7.155:

"SIZE(ARRAY[, DIM, KIND])

Description. Extent of an array along a specified dimension or
the total number of elements in the array.

Class. Inquiry function.

Arguments.
ARRAY shall be a scalar or array of any type."

So where do I find the more current draft that says this is wrong?
> Now, if your example had said:
Show full article (2.08Kb)
no comments
Re: KIND optional argument in transformational intrinsics         


Author: James Giles
Date: May 16, 2008 14:13

James Van Buskirk wrote:
> "James Giles" worldnet.att.net> wrote in message
> news:kmlXj.214889$D_3.196336@bgtnsc05-news.ops.worldnet.att.net...
>
>> James Van Buskirk wrote:
>
>> Well, I misread your original article. I thought the following
>> really was some new f2008 usage:
>
>> write(*,*) size(ik) ! Consistent with f2008 usage
>
>> Turns out that F2008 also requires the initial (non-optional)
>> argument to SIZE to be an array. You line is simply wrong.
>> (I thought maybe F2008 was doing this as a way of reporting
>> the bit- or byte-size of a default integer.)
>
> Am I reading an obsolete draft? In N1723.pdf, section 13.7.155:
>
> "SIZE(ARRAY[, DIM, KIND]
Show full article (1.55Kb)
no comments
Re: KIND optional argument in transformational intrinsics         


Author: James Van Buskirk
Date: May 16, 2008 14:30

"James Giles" worldnet.att.net> wrote in message
news:6OmXj.215188$D_3.90327@bgtnsc05-news.ops.worldnet.att.net...
> James Van Buskirk wrote:
>> "SIZE(ARRAY[, DIM, KIND]
> Looks like the correct description. In what way does SIZE(IK)
> match the above syntax diagram? IK is a scalar integer named
> constant in your sample program. The first (and only) non-optional
> argument to SIZE must be an array.

I observe that you have chosen to omit the passage I quoted that
said in plain terms that you were wrong. It read:
> Arguments.
> ARRAY shall be a scalar or array of any type."

SIZE(ik) matches that description, ik being scalar and scalar
being a member of the set {scalar, array}. Or has the standard
document for the English language changed in the interim?

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