https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88079

MarkEggleston <mark.eggleston at codethink dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark.eggleston at codethink 
dot co
                   |                            |m

--- Comment #3 from MarkEggleston <mark.eggleston at codethink dot com> ---
I propose that -Wintent be added that would provide warnings in the following
circumstances:

1. At declaration of a dummy variable, this will include interface blocks.
2. Assignment of a value to a dummy variable that has no intent specified
(unless it has the value attribute (Fortran 2003)).
3. When dummy variable (with unknown or in intent) is used as an argument to a
procedure where the intent of the associated dummy variable is unknown, out or
inout. This would also apply where an implicit interface is used.

The reason a warning should be issued at declaration is so that a suitable
warning is raised when there is no way of determining whether the variable can
be changed as the procedure is only known by its interface i.e. it is compiled
separately.

Code that does not specify the intent of dummy values run the risk containing
errors that will result in the program crashing at runtime, e.g. calling a
procedure with a constant as an argument and the associated dummy variable is
modified. Catching potential bugs at compile time is preferable.

Using -Wintent in conjunction with -Wimplicit-interface and -Werror will
encourage the use of interface blocks and intent thus improving Fortran code.

Reply via email to