FORTRAN KIND parameter error

I am trying to get the code below compiling, but it keeps returning the following error:
PGF90-S-0081-Illegal selector - KIND parameter has unknown value for data type

Can anyone let me know if this will compile in any of the PG compilers? I’m currently using an evaluation copy on Mac. If it is possible, what is the correct command line?


PROGRAM FTNKIND16

COMPLEX(16) MyVAR

END


Thanks.
Michael

Hmm. I’m not sure why that doesn’t work, but you can use the ol’ F77 method:

COMPLEX*16  MyVAR

or

DOUBLE COMPLEX MyVAR

and it does compile (though, as I only ever use “regular” COMPLEX, I don’t know if it’s the right precision). Maybe the compiler sees KIND=16 and sees that as quad-precision (which PGI doesn’t support)?

I think we’ll have to wait for the PGI folks to chime in here.

Matt

sees that as quad-precision (which PGI doesn’t support)?

Correct. We don’t yet support Quad-precision, hence the semantic error. Please use double precision (KIND=8).

  • Mat

Mat,

For my own edification, is COMPLEX(KIND=8) the equivalent of two 4-byte reals or two 8-byte reals? That is, does KIND=8 with COMPLEX mean the real and imaginary parts together take 8 bytes (and, thus, is equivalent to a 4-byte real and a 4-byte imaginary) or does the Standard translate that to an 8-byte real and 8-byte imaginary (i.e., COMPLEX(KIND=8) = COMPLEX*16)?

Matt

Hi Matt,

For my own edification, is COMPLEX(KIND=8) the equivalent of two 4-byte reals or two 8-byte reals?

Two 8-byte reals. One for the real part and one for the imaginary part.

does the Standard translate that to an 8-byte real and 8-byte imaginary (i.e., COMPLEX(KIND=8) = COMPLEX*16)?

I’ve always found it confusing that COMPLEX(KIND=8) is equivalent to COMPLEX*16, but that’s correct.

  • Mat