flush geterg and iargc question

Benjamin Réveillé benjamin.reveille@gmail.com
Mon Nov 7 09:05:00 GMT 2005


Here is the simple code I am compiling...

program toto
   implicit none
   intrinsic trim

   integer :: nargs,i
   character(len=256) :: arg

   nargs=iargc()
   do i=0,nargs
      call getarg(i,arg)
      print*,'arg(',i,')=',trim(arg)
   end do

   call flush(6)
end program toto


I compile it with:

gfortran -static -Wall -pedantic -std=${STANDARD} titi.f90

Here is the output with STANDARD=f95
> In file titi.f90:8
>
 >  nargs=iargc()
>        1
>Error: Function 'iargc' at (1) has no IMPLICIT type
This seems normal since it's not in f95 standard and not declared...


Here is the output I get if STANDARD=gnu or legacy or if I remove the
-std=... (which i think is equivalent to -std=gnu)
>In file titi.f90:8
>   nargs=iargc()
>        1
>Warning: Intrinsic 'iargc' at (1) is not included in the selected standard
> In file titi.f90:10
>
>      call getarg(i,arg)
>                       1
>Warning: Intrinsic 'getarg' at (1) is not included in the selected standard
> In file titi.f90:14
>
>   call flush(6)
>               1
>Warning: Intrinsic 'flush' at (1) is not included in the selected standard

Is it a compiler error or is there another standard in which i'll find
these and get rid of the warnings?

I admit this isn't a big issue. But I thought it was worth mentionning.
These messages disappear if I remove either -pedantic or -Wall but
personnaly I like these options...
[I know I could use get_command_argument and command_argument_count
but the other compilers we use don't seem to support them...]

Keep up the good work...

P.S. By the way at work I've successfully compiled our 3D CFD code for
combustion in internal combustion engines. First simple tests I've run
tend to show that gfortran with -03 is as good as pgi5.1 with -fast
(without open MP of course) I am very impressed. When the GOMP guys
are ready I'll give Open MP a test run and compare again...

Ben



More information about the Fortran mailing list