Next: Debugging Options, Previous: Fortran Dialect Options, Up: Invoking GFORTRAN
Warnings are diagnostic messages that report constructions which are not inherently erroneous but which are risky or suggest there might have been an error.
You can request many specific warnings with options beginning -W, for example -Wimplicit to request warnings on implicit declarations. Each of these specific warning options also has a negative form beginning -Wno- to turn off warnings; for example, -Wno-implicit. This manual lists only one of the two forms, whichever is not the default.
These options control the amount and kinds of warnings produced by GNU Fortran:
-fsyntax-only
-pedantic
Valid FORTRAN 95 programs should compile properly with or without this option. However, without this option, certain GNU extensions and traditional Fortran features are supported as well. With this option, many of them are rejected.
Some users try to use -pedantic to check programs for conformance. They soon find that it does not do quite what they want—it finds some nonstandard practices, but not all. However, improvements to gfortran in this area are welcome.
This should be used in conjunction with -std=std.
-pedantic-errors
-w
-Wall
-Waliasing
intent(in)
and a dummy argument with intent(out)
in a call
with an explicit interface.
The following example will trigger the warning.
interface subroutine bar(a,b) integer, intent(in) :: a integer, intent(out) :: b end subroutine end interface integer :: a call bar(a,a)
-Wconversion
-Wimplicit-interface
-Wnonstd-intrinsic
-Wsurprising
This currently produces a warning under the following circumstances:
-Wunderflow
-Wunused-labels
-Werror
-W
See Options to Request or Suppress Warnings, for information on more options offered by the GBE shared by gfortran, gcc and other GNU compilers.
Some of these have no effect when compiling programs written in Fortran.