Discussion:
flush geterg and iargc question
Benjamin Réveillé
2005-11-07 09:05:40 UTC
Permalink
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
Steve Kargl
2005-11-07 14:47:04 UTC
Permalink
Post by Benjamin Réveillé
Post by Benjamin Réveillé
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...
gfortran is doing exactly what you requested. While you
develop code, use "-Wall -pedantic", but once the code is
written remove the options if you don't want to see the
warnings.
--
Steve
Benjamin Réveillé
2005-11-07 15:26:20 UTC
Permalink
Post by Steve Kargl
Post by Benjamin Réveillé
Post by Benjamin Réveillé
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...
gfortran is doing exactly what you requested. While you
develop code, use "-Wall -pedantic", but once the code is
written remove the options if you don't want to see the
warnings.
--
Steve
Hi Steve

I knew these where extensions but I didn't think I'd get a warning
when using the -std that supports them.

If I follow you correctly any non-f95 supported extension will compile
with -std=legacy but issue such a message with -Wall -pedantic.

Thanks for your answer.

Ben
Steve Kargl
2005-11-07 15:34:50 UTC
Permalink
Post by Benjamin Réveillé
Post by Steve Kargl
Post by Benjamin Réveillé
Post by Benjamin Réveillé
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...
gfortran is doing exactly what you requested. While you
develop code, use "-Wall -pedantic", but once the code is
written remove the options if you don't want to see the
warnings.
I knew these where extensions but I didn't think I'd get a warning
when using the -std that supports them.
When it comes to the -std= option and intrinsics procedures,
the option will enable or disable the recognition of a procedure
as intrinsic.
Post by Benjamin Réveillé
If I follow you correctly any non-f95 supported extension will compile
with -std=legacy but issue such a message with -Wall -pedantic.
I have to check on what -std=legacy turns on. I believe
your statement is correct if you say -std=gnu instead of legacy.
Note -std=gnu is the default.
--
Steve
Richard E Maine
2005-11-07 17:21:37 UTC
Permalink
Post by Benjamin Réveillé
I knew these where extensions but I didn't think I'd get a warning
when using the -std that supports them.
I'm slightly puzzled, either by your expectations, or perhaps just the
way they are expressed; I'm not entirely sure which.

There is *NO* version of the standard that supports iargc or the flush
subroutine. From the way you wrote the above, I get the impression that
you think thay they are supported in some version of the standard.
Therefore when you ask for standard-conformance checking, you'll get
messages about them. That's the whole point of asking for
standard-conformance checking. If you don't want messages for such
things, then don't ask for that. If you want some of the other messages
you get, but you don't want these in particular, then that would be
asking for the ability to customize your own list of things checked
for. While that would be a nice feature, it isn't one that gfortran has
(nor do most compilers, though sometimes there are switches for
particularly common cases).

The functionality of iargc and flush are in f2003, but not "spelled"
those ways. As you apparently know, the standard form of iargc in f2003
is system_argument_count. While I understand your concern that the
f2003 form isn't yet supported by all compilers, that concern doesn't
change the fact that iargc is nonstandard, so you'll get complaints
about it if you ask for standard-conformance checking (any version).
You might, by the way, want to check into Lawson Wakefield's fkcli at
<www.winteracter.com/f2kcli>. The functionality of flush is in f2003,
but it is a statement instead of a subroutine.
--
Richard Maine | Good judgment comes from experience;
***@nasa.gov | experience comes from bad judgment.
| -- Mark Twain
Steve Kargl
2005-11-07 18:03:47 UTC
Permalink
Post by Richard E Maine
<www.winteracter.com/f2kcli>. The functionality of flush is in f2003,
but it is a statement instead of a subroutine.
gfortran provides the F2003 flush.
--
Steve
Benjamin Réveillé
2005-11-08 10:17:36 UTC
Permalink
Hello Richard

It's probably by the way I express them. And my possible
mis-interpretation of gfortran's warning messages.

I activate -std=gnu instead of -std=f95 to have acces to flush getarg
and iargc [as used by the other compilers] since they are not provided
at all with -std=f95 because I know they are not in the f95
standard...


I don't "understand why"/"find odd that" gfortrans warning messages
say that they aren't in the "standard" i'm using i.e. "gnu" when they
are provided by -std=gnu.
"Warning: Intrinsic 'getarg' at (1) is not included in the selected standard"
Maybe I'm confusing "standard" and -std option... I interpret
"standard" as what I have asked for with the -std option. That may be
wrong. If so thanks for enlightening me.

I hope this clears up what I mean.
Post by Benjamin Réveillé
I knew these where extensions but I didn't think I'd get a warning
when using the -std that supports them.
I'm slightly puzzled, either by your expectations, or perhaps just the
way they are expressed; I'm not entirely sure which.
There is *NO* version of the standard that supports iargc or the flush
subroutine. From the way you wrote the above, I get the impression that
you think thay they are supported in some version of the standard.
Therefore when you ask for standard-conformance checking, you'll get
messages about them. That's the whole point of asking for
standard-conformance checking. If you don't want messages for such
things, then don't ask for that. If you want some of the other messages
you get, but you don't want these in particular, then that would be
asking for the ability to customize your own list of things checked
for. While that would be a nice feature, it isn't one that gfortran has
(nor do most compilers, though sometimes there are switches for
particularly common cases).
The functionality of iargc and flush are in f2003, but not "spelled"
those ways. As you apparently know, the standard form of iargc in f2003
is system_argument_count. While I understand your concern that the
f2003 form isn't yet supported by all compilers, that concern doesn't
change the fact that iargc is nonstandard, so you'll get complaints
about it if you ask for standard-conformance checking (any version).
You might, by the way, want to check into Lawson Wakefield's fkcli at
<www.winteracter.com/f2kcli>. The functionality of flush is in f2003,
but it is a statement instead of a subroutine.
--
Richard Maine | Good judgment comes from experience;
| -- Mark Twain
Steve Kargl
2005-11-08 15:13:15 UTC
Permalink
Post by Benjamin Réveillé
It's probably by the way I express them. And my possible
mis-interpretation of gfortran's warning messages.
I activate -std=gnu instead of -std=f95 to have acces to flush getarg
and iargc [as used by the other compilers] since they are not provided
at all with -std=f95 because I know they are not in the f95
standard...
I don't "understand why"/"find odd that" gfortrans warning messages
say that they aren't in the "standard" i'm using i.e. "gnu" when they
are provided by -std=gnu.
"Warning: Intrinsic 'getarg' at (1) is not included in the selected standard"
Maybe I'm confusing "standard" and -std option... I interpret
"standard" as what I have asked for with the -std option. That may be
wrong. If so thanks for enlightening me.
I hope this clears up what I mean.
Okay, I can see the confusion. "-Wall -pedantic" will
issue warnings for The Standard (ie. the Fortran 95 standard).
These are independent from what may be set by -std=.
--
Steve
Richard E Maine
2005-11-08 18:11:41 UTC
Permalink
Post by Benjamin Réveillé
I activate -std=gnu instead of -std=f95 to have acces to flush getarg
and iargc... I know they are not in the f95 standard
...
Post by Benjamin Réveillé
Maybe I'm confusing "standard" and -std option... I interpret
"standard" as what I have asked for with the -std option. That may be
wrong. If so thanks for enlightening me.
Ah. Now I understand what you mean. Yes, at least one of us is
confusing the definitions of "standard" vs "-std=". It might be me.
--
Richard Maine | Good judgment comes from experience;
***@nasa.gov | experience comes from bad judgment.
| -- Mark Twain
Toon Moene
2005-11-09 08:11:09 UTC
Permalink
Post by Richard E Maine
Ah. Now I understand what you mean. Yes, at least one of us is
confusing the definitions of "standard" vs "-std=". It might be me.
One of the confusing aspects of the compiler option -std= is, that
-std=f95 has a definite meaning: Check for conformance to the Fortran 95
Standard.

-std=gnu unfortunately doesn't mean anything else than: Accept the
language-du-jour that GNU Fortran understands. It is by no means a
standard until we at least actually define it by writing it up in
standardese (in the GNU Fortran documentation)

:-)
--
Toon Moene, KNMI, The Netherlands
Phone: +31 30 2206443; e-mail: ***@knmi.nl
Loading...