Silverfrost Forums

Welcome to our forums

Problem with compiler option

16 Oct 2009 4:47 #5196

Hello all,

I have just downloaded FTN95 personal, installed on Win XP x64 SP2. It seems to work mostly fine; however, I tried to compile code with a lot of declarations such as

real (kind = 8) a

which fails with error 600. I found that the option /ALT_KINDS would make kind = 8 acceptable, however I cannot get it to work: either from plato (Project → properties → compiler options → miscellaneous → extra compiler options) or compiling from the command line (ftn95 test1.f95 /ALT_KINDS) the error still appears. Am I missing something?

I would prefer not changing the code to kind = 2 or something else for portability reasons.

Regards,

Fernando

16 Oct 2009 5:49 #5197

When I put this into a short program I don't get an error. Maybe you need to post a larger sample.

16 Oct 2009 7:53 #5199

This is the whole test program, not much larger indeed:

program test

real (kind = 8) a

a = 2

end
17 Oct 2009 7:10 #5200

This program works fine for me but I am not using a 64bit OS. Can anyone else test this on a 64bit OS?

17 Oct 2009 7:29 #5203

Hello Paul,

I have installed ftn95 in two other machines, both running Win XP 32 bits SP3, with the same result. The option /ALT_KINDS seems to be ignored; either specifying it or not, the result is the same:

0003) real (kind = 8) a
*** The KIND number should be 1, 2, or 3
COMMENT - Specifying the kind of the type REAL with the constant '1' is
    non-portable - 'SELECTED_REAL_KIND(6,37)' would be better
    1 ERROR, 1 COMMENT  [<TEST> FTN95/Win32 v5.30.0]
*** Compilation failed

If I change the program to kind = 2 it compiles either without of with /ALT_KINDS in the command line

Moreover, I tried downloading from the two sites (CNET and Tucows) just in case, but there is no difference (as expected).

Quite puzzling, but I do not know what to do next.

Regards,

Fernando

18 Oct 2009 8:04 #5204

I can only think of two possible reasons for the failure.

  1. You are accessing an old version of the compiler. The version appears when you type FTN95 on a command line.

  2. The option /ALT_KINDS is not getting through to the compiler. If you also add /EXPLIST to the command line then the .lis file generated will provide a list of the options that the compiler is using.

18 Oct 2009 7:52 #5208

The .lis file generated is the following:

Silverfrost FTN95/WIN32 Ver 5.30.0 test1.F95 Sun Oct 18 16:46:52 2009

Compiler Options in Effect: ALT_KINDS COLOUR DELETE_OBJ_ON_ERROR EXPLIST MINIMISE_REBUILD NO_QUIT NON_STANDARD SINGLE_THREADED

0001 program test 0002
0003 real (kind = 8) a 0004
*** The KIND number should be 1, 2, or 3 COMMENT - Specifying the kind of the type REAL with the constant '1' is non-portable - 'SELECTED_REAL_KIND(6,37)' would be better 0005 real*8 b 0006
0007 a = 2 + b 0008
0009 end

As it can be seen, version is 5.30.0 and ALT_KINDS is listed as in effect. Besides, real*8 is not a problem.

19 Oct 2009 6:05 #5210

Looks like you need to wait for version 5.4 of FTN95. This is available for download except for the personal edition which will be made available in due course.

19 Oct 2009 1:36 #5214

OK, I understand. Any guess about when the 'due course' will arrive?

Thanks for the attention

Fernando

19 Oct 2009 6:07 #5215

Version 5.40 is available now. I have put a direct link on the download page to our MediaFire account that we use for the Express version. The problem with cnet and tucows is that they can take weeks just to process an update (unless you pay $1000 and then it takes 10 minutes).

Edit: the link is http://www.silverfrost.com/32/ftn95/ftn95_personal_edition.aspx


-- Admin Silverfrost Limited
19 Oct 2009 8:10 #5216

Excellent!

Thanks a lot

20 Oct 2009 12:02 #5217

Why not try

real*8 a

Having the value of kind not being defined in the standard has always looked as a 'one step foward, one step back' approach. The standards committee has always frowned on 'real*8', which I have said many times is concise and clear definition of the number being used.

My Ver 5.30.0 also does not work for /alt_kind. I'm not sure if it worked in the past for variable definitions, such the example above. Constants, such as 2.1_8 appear to compile ok.

John

program test 

real*8 b, c
! real (kind = 8) a 

b = 2.1_8
c = 2.1d0
write (*,*) b,c
! a = 2 

end
20 Oct 2009 2:34 #5218

Because I am trying FTN95 with programs that heavily use code from netlib, which in f90 (for example minpack.f90) use kind = 8 all the time. Besides, as far as I know, is the most common way to use 'kind'.

20 Oct 2009 6:30 #5220

I am surprised that Netlib have general use of kind as 'real (kind = 8)' as although this syntax is valid in the standard, it is definately not portable. I am not sure how many other fortran 90+ compilers, apart from Salford, who don't use the value of kind as the number of bytes, but it is definately not a requirement of the standard. As I have only compiled in a Control Data / Prime / Vax / Apollo / Sun / Wintel environment, I am not aware of any compiler since Control Data that does not support Real8 As I have limited experience of the high performance super-computers and workstations, I'd be interested to know of those that don't support real8.

If you ask Fortran Standards comittee, they will recomend that you use a module to define the value of kind, by using SELECTED_REAL_KIND and specify a precision. To me it's a total 'waste of space' as there are not that many different values of precision that are provided by all the hardware/software manufactures available.

John

20 Oct 2009 12:39 #5222

I agree that real8 is simpler than any use of 'kind'. But this is what I have found. Regarding SELECTED_REAL_KIND, I only know of one package (Ronald Cools' cubpack.f90) which uses it. Besides the old days of the PDP-11, my experience with fortan compilers is in the PC environment, either windows or, to some extent, linux, and real8 and the like are always supported, as far as I know.

Fernando

21 Oct 2009 12:11 #5223

Today I have a project where I need real numbers with 9 significant digits. It would be good if I could call 'Selected_real_Kind (9,12)' and get a numeric precision that suits that. The reality is that I get real*8, as there are very few options available.

WRT /alt_kinds compiler option, I tested the following program; with and without the /alt_kinds option. The results do not change.

Paul, should we expect the results to be different ?

I think that the reality of the /alt_kind implementation is that it is presently limited to numeric constants, of the form '2.1_8' and not yet 'real (kind=8)'

   integer*4 p, k
write (*,*) 'Real_Kind'
   do p = 1,18
      k = selected_real_kind (p,0)
      write (*,*) p,k
   end do
write (*,*) 'Integer_Kind'
   do p = 1,18
      k = selected_int_kind (p)
      write (*,*) p,k
   end do
   end
21 Oct 2009 7:38 #5224

selected_real_kind etc. give the compiler defaults. I am not surprised that /alt_kinds makes no difference. I guess that strictly it should but in practice programmers will either use literal constants or selected_x_kind not both.

Perhaps it is strictly a bug that I need to fix.

21 Oct 2009 8:14 #5226

It amazed me, and annoyed me at the same time, that Fortran 90 et seq. eschewed the ubiquitous REAL8 for all this KIND nonsense. The reason that CDC didn't have REAL8 is that they ran 60-bit words. You could therefore have 60 bit REAL or 120 bit DOUBLE PRECISION, but not 64 bit anything. When computers were word-based instead of being byte-based, there were all sorts of native precisions, for example, 36-bit or 24-bit words etc.

Although there are a few constructs in Fortran 90 that have no equivalent in Fortran 77, mostly the new features duplicate things you could already do. The 9x standards simply ignore such things as graphics, user interfaces and so on, as a result of which the language went nowhere at a time it could have been rejuvenated. To get all those things, one has to tie oneself to a specific compiler, e.g. FTNxx with ClearWin+. I imagine that this makes commercial developers nervous. However, Salford/Silverfrost's FTN proved more durable than Microsoft's Fortran! Tying oneself to Windows is less of an issue, given the proportion of machines that use it.

I recently spent some time pondering Hatton's 'safe subset' idea (i.e. that there is a subset of a language that programmers make fewest mistakes with - in his case he considered Fortran 77). The safe subset of Fortran 9x is, of course, Fortran 77. Not only is this true of user code, but based on what gets fixed release by release, it is true of FTN95 itself (forgetting 'reversions' - of which there are few).

In my view, it is sad that we don't have REAL6, as this is for many uses REAL4 is grossly inadequate, and REAL*8 is overkill. We had this precision on ICL computers, and also on the BBC micro.

KIND might be of more use if one could trade off range and precision, but in practice, one can't. There is one model for how the bits are shared out, and that is that.

A similar argument could be adduced for the introduction of 'short' INTEGERs. I never got integer overflow on a machine where the INTEGER and REAL were the same length - it was a problem I first encountered (but only once) on a PC when I used short (INTEGER2) integers to save space on my first PC back in 1983. I realise that few people get integer overflow with INTEGER4, but that small number becomes even smaller with INTEGER*6.

Eddie

21 Oct 2009 11:20 #5227

Eddie,

Remember the REAL*16 on the VAX, and there was a compiler option to use 'Huge' or 'Grand' whereby the size of the mantissa and exponent could be juggled to give a 'Huge' range or a 'Grand' precision.

We can use REAL10 on FTN95 which goes someway towards what we had in the 1980s. And of course INTEGER8. But are these available to Win32 only and not .net?

I also seem to remember that DECUS provided Fortran source code to use arbitary precision variables.

Ian

21 Oct 2009 12:26 #5228

Paul,

I would say that not supporting 'real (kind=8)' or 'real (8)' when /alt_kinds is selected is the main bug that should be corrected.

I am not aware of this ever working with /alt_kinds, although I have been wrong before when recalling past versions of ftn95.

Also the interpretation of 'integer (kind=4)' or 'integer (4)' should be guaranteed to work when /alt is or is not selected. It's use probably should include a warning as to what precision was implied. I think this is the only kind value overlap when using the /alt_kinds model.

When it comes to reals, why can't the kind value sets of 1,2,3 or 4,8,10 both be supported ? With integers, we have 1,2,3,4 or 1,2,4,8 giving ambiguity only for integer (kind=4). Logical and complex can also easily overlap. ( Is there a LOGICAL*8 ?)

John

Please login to reply.