Sophie

Sophie

distrib > Mandriva > 2011.0 > x86_64 > by-pkgid > f13f137693327172bf7ba9b443ff3a61 > files > 114

gcc-gfortran-4.6.1-2.x86_64.rpm

<html lang="en">
<head>
<title>Error and Warning Options - The GNU Fortran Compiler</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="The GNU Fortran Compiler">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Invoking-GNU-Fortran.html#Invoking-GNU-Fortran" title="Invoking GNU Fortran">
<link rel="prev" href="Preprocessing-Options.html#Preprocessing-Options" title="Preprocessing Options">
<link rel="next" href="Debugging-Options.html#Debugging-Options" title="Debugging Options">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Funding Free Software'', the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below).  A copy of the license is included in the section entitled
``GNU Free Documentation License''.

(a) The FSF's Front-Cover Text is:

     A GNU Manual

(b) The FSF's Back-Cover Text is:

     You have freedom to copy and modify this GNU Manual, like GNU
     software.  Copies published by the Free Software Foundation raise
     funds for GNU development.-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<a name="Error-and-Warning-Options"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Debugging-Options.html#Debugging-Options">Debugging Options</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Preprocessing-Options.html#Preprocessing-Options">Preprocessing Options</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Invoking-GNU-Fortran.html#Invoking-GNU-Fortran">Invoking GNU Fortran</a>
<hr>
</div>

<h3 class="section">2.4 Options to request or suppress errors and warnings</h3>

<p><a name="index-options_002c-warnings-109"></a><a name="index-options_002c-errors-110"></a><a name="index-warnings_002c-suppressing-111"></a><a name="index-messages_002c-error-112"></a><a name="index-messages_002c-warning-113"></a><a name="index-suppressing-warnings-114"></a>
Errors are diagnostic messages that report that the GNU Fortran compiler
cannot compile the relevant piece of source code.  The compiler will
continue to process the program in an attempt to report further errors
to aid in debugging, but will not produce any compiled output.

   <p>Warnings are diagnostic messages that report constructions which
are not inherently erroneous but which are risky or suggest there is
likely to be a bug in the program.  Unless <samp><span class="option">-Werror</span></samp> is specified,
they do not prevent compilation of the program.

   <p>You can request many specific warnings with options beginning <samp><span class="option">-W</span></samp>,
for example <samp><span class="option">-Wimplicit</span></samp> to request warnings on implicit
declarations.  Each of these specific warning options also has a
negative form beginning <samp><span class="option">-Wno-</span></samp> to turn off warnings;
for example, <samp><span class="option">-Wno-implicit</span></samp>.  This manual lists only one of the
two forms, whichever is not the default.

   <p>These options control the amount and kinds of errors and warnings produced
by GNU Fortran:

     <dl>
<dt><code>-fmax-errors=</code><var>n</var><dd><a name="index-g_t_0040code_007bfmax_002derrors_003d_007d_0040var_007bn_007d-115"></a><a name="index-errors_002c-limiting-116"></a>Limits the maximum number of error messages to <var>n</var>, at which point
GNU Fortran bails out rather than attempting to continue processing the
source code.  If <var>n</var> is 0, there is no limit on the number of error
messages produced.

     <br><dt><code>-fsyntax-only</code><dd><a name="index-g_t_0040code_007bfsyntax_002donly_007d-117"></a><a name="index-syntax-checking-118"></a>Check the code for syntax errors, but don't actually compile it.  This
will generate module files for each module present in the code, but no
other output file.

     <br><dt><code>-pedantic</code><dd><a name="index-g_t_0040code_007bpedantic_007d-119"></a>Issue warnings for uses of extensions to Fortran 95. 
<samp><span class="option">-pedantic</span></samp> also applies to C-language constructs where they
occur in GNU Fortran source files, such as use of &lsquo;<samp><span class="samp">\e</span></samp>&rsquo; in a
character constant within a directive like <code>#include</code>.

     <p>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.

     <p>Some users try to use <samp><span class="option">-pedantic</span></samp> to check programs for conformance. 
They soon find that it does not do quite what they want&mdash;it finds some
nonstandard practices, but not all. 
However, improvements to GNU Fortran in this area are welcome.

     <p>This should be used in conjunction with <samp><span class="option">-std=f95</span></samp>,
<samp><span class="option">-std=f2003</span></samp> or <samp><span class="option">-std=f2008</span></samp>.

     <br><dt><code>-pedantic-errors</code><dd><a name="index-g_t_0040code_007bpedantic_002derrors_007d-120"></a>Like <samp><span class="option">-pedantic</span></samp>, except that errors are produced rather than
warnings.

     <br><dt><code>-Wall</code><dd><a name="index-g_t_0040code_007bWall_007d-121"></a><a name="index-all-warnings-122"></a><a name="index-warnings_002c-all-123"></a>Enables commonly used warning options pertaining to usage that
we recommend avoiding and that we believe are easy to avoid. 
This currently includes <samp><span class="option">-Waliasing</span></samp>, <samp><span class="option">-Wampersand</span></samp>,
<samp><span class="option">-Wconversion</span></samp>, <samp><span class="option">-Wsurprising</span></samp>, <samp><span class="option">-Wintrinsics-std</span></samp>,
<samp><span class="option">-Wno-tabs</span></samp>, <samp><span class="option">-Wintrinsic-shadow</span></samp>, <samp><span class="option">-Wline-truncation</span></samp>,
<samp><span class="option">-Wreal-q-constant</span></samp> and <samp><span class="option">-Wunused</span></samp>.

     <br><dt><code>-Waliasing</code><dd><a name="index-g_t_0040code_007bWaliasing_007d-124"></a><a name="index-aliasing-125"></a><a name="index-warnings_002c-aliasing-126"></a>Warn about possible aliasing of dummy arguments. Specifically, it warns
if the same actual argument is associated with a dummy argument with
<code>INTENT(IN)</code> and a dummy argument with <code>INTENT(OUT)</code> in a call
with an explicit interface.

     <p>The following example will trigger the warning.
     <pre class="smallexample">            interface
              subroutine bar(a,b)
                integer, intent(in) :: a
                integer, intent(out) :: b
              end subroutine
            end interface
            integer :: a
          
            call bar(a,a)
</pre>
     <br><dt><code>-Wampersand</code><dd><a name="index-g_t_0040code_007bWampersand_007d-127"></a><a name="index-warnings_002c-ampersand-128"></a><a name="index-g_t_0040code_007b_0026_007d-129"></a>Warn about missing ampersand in continued character constants. The warning is
given with <samp><span class="option">-Wampersand</span></samp>, <samp><span class="option">-pedantic</span></samp>, <samp><span class="option">-std=f95</span></samp>,
<samp><span class="option">-std=f2003</span></samp> and <samp><span class="option">-std=f2008</span></samp>. Note: With no ampersand
given in a continued character constant, GNU Fortran assumes continuation
at the first non-comment, non-whitespace character after the ampersand
that initiated the continuation.

     <br><dt><code>-Warray-temporaries</code><dd><a name="index-g_t_0040code_007bWarray_002dtemporaries_007d-130"></a><a name="index-warnings_002c-array-temporaries-131"></a>Warn about array temporaries generated by the compiler.  The information
generated by this warning is sometimes useful in optimization, in order to
avoid such temporaries.

     <br><dt><code>-Wcharacter-truncation</code><dd><a name="index-g_t_0040code_007bWcharacter_002dtruncation_007d-132"></a><a name="index-warnings_002c-character-truncation-133"></a>Warn when a character assignment will truncate the assigned string.

     <br><dt><code>-Wline-truncation</code><dd><a name="index-g_t_0040code_007bWline_002dtruncation_007d-134"></a><a name="index-warnings_002c-line-truncation-135"></a>Warn when a source code line will be truncated.

     <br><dt><code>-Wconversion</code><dd><a name="index-g_t_0040code_007bWconversion_007d-136"></a><a name="index-warnings_002c-conversion-137"></a><a name="index-conversion-138"></a>Warn about implicit conversions that are likely to change the value of
the expression after conversion. Implied by <samp><span class="option">-Wall</span></samp>.

     <br><dt><code>-Wconversion-extra</code><dd><a name="index-g_t_0040code_007bWconversion_002dextra_007d-139"></a><a name="index-warnings_002c-conversion-140"></a><a name="index-conversion-141"></a>Warn about implicit conversions between different types and kinds.

     <br><dt><code>-Wimplicit-interface</code><dd><a name="index-g_t_0040code_007bWimplicit_002dinterface_007d-142"></a><a name="index-warnings_002c-implicit-interface-143"></a>Warn if a procedure is called without an explicit interface. 
Note this only checks that an explicit interface is present.  It does not
check that the declared interfaces are consistent across program units.

     <br><dt><code>-Wimplicit-procedure</code><dd><a name="index-g_t_0040code_007bWimplicit_002dprocedure_007d-144"></a><a name="index-warnings_002c-implicit-procedure-145"></a>Warn if a procedure is called that has neither an explicit interface
nor has been declared as <code>EXTERNAL</code>.

     <br><dt><code>-Wintrinsics-std</code><dd><a name="index-g_t_0040code_007bWintrinsics_002dstd_007d-146"></a><a name="index-warnings_002c-non_002dstandard-intrinsics-147"></a><a name="index-warnings_002c-intrinsics-of-other-standards-148"></a>Warn if <samp><span class="command">gfortran</span></samp> finds a procedure named like an intrinsic not
available in the currently selected standard (with <samp><span class="option">-std</span></samp>) and treats
it as <code>EXTERNAL</code> procedure because of this.  <samp><span class="option">-fall-intrinsics</span></samp> can
be used to never trigger this behavior and always link to the intrinsic
regardless of the selected standard.

     <br><dt><code>-Wreal-q-constant</code><dd><a name="index-g_t_0040code_007bWreal_002dq_002dconstant_007d-149"></a><a name="index-warnings_002c-_0040code_007bq_007d-exponent_002dletter-150"></a>Produce a warning if a real-literal-constant contains a <code>q</code>
exponent-letter.

     <br><dt><code>-Wsurprising</code><dd><a name="index-g_t_0040code_007bWsurprising_007d-151"></a><a name="index-warnings_002c-suspicious-code-152"></a>Produce a warning when &ldquo;suspicious&rdquo; code constructs are encountered. 
While technically legal these usually indicate that an error has been made.

     <p>This currently produces a warning under the following circumstances:

          <ul>
<li>An INTEGER SELECT construct has a CASE that can never be matched as its
lower value is greater than its upper value.

          <li>A LOGICAL SELECT construct has three CASE statements.

          <li>A TRANSFER specifies a source that is shorter than the destination.

          <li>The type of a function result is declared more than once with the same type.  If
<samp><span class="option">-pedantic</span></samp> or standard-conforming mode is enabled, this is an error.

          <li>A <code>CHARACTER</code> variable is declared with negative length. 
</ul>

     <br><dt><code>-Wtabs</code><dd><a name="index-g_t_0040code_007bWtabs_007d-153"></a><a name="index-warnings_002c-tabs-154"></a><a name="index-tabulators-155"></a>By default, tabs are accepted as whitespace, but tabs are not members
of the Fortran Character Set.  For continuation lines, a tab followed
by a digit between 1 and 9 is supported.  <samp><span class="option">-Wno-tabs</span></samp> will cause
a warning to be issued if a tab is encountered. Note, <samp><span class="option">-Wno-tabs</span></samp>
is active for <samp><span class="option">-pedantic</span></samp>, <samp><span class="option">-std=f95</span></samp>, <samp><span class="option">-std=f2003</span></samp>,
<samp><span class="option">-std=f2008</span></samp> and <samp><span class="option">-Wall</span></samp>.

     <br><dt><code>-Wunderflow</code><dd><a name="index-g_t_0040code_007bWunderflow_007d-156"></a><a name="index-warnings_002c-underflow-157"></a><a name="index-underflow-158"></a>Produce a warning when numerical constant expressions are
encountered, which yield an UNDERFLOW during compilation.

     <br><dt><code>-Wintrinsic-shadow</code><dd><a name="index-g_t_0040code_007bWintrinsic_002dshadow_007d-159"></a><a name="index-warnings_002c-intrinsic-160"></a><a name="index-intrinsic-161"></a>Warn if a user-defined procedure or module procedure has the same name as an
intrinsic; in this case, an explicit interface or <code>EXTERNAL</code> or
<code>INTRINSIC</code> declaration might be needed to get calls later resolved to
the desired intrinsic/procedure.

     <br><dt><code>-Wunused-dummy-argument</code><dd><a name="index-g_t_0040code_007bWunused_002ddummy_002dargument_007d-162"></a><a name="index-warnings_002c-unused-dummy-argument-163"></a><a name="index-unused-dummy-argument-164"></a><a name="index-dummy-argument_002c-unused-165"></a>Warn about unused dummy arguments. This option is implied by <samp><span class="option">-Wall</span></samp>.

     <br><dt><code>-Wunused-parameter</code><dd><a name="index-g_t_0040code_007bWunused_002dparameter_007d-166"></a><a name="index-warnings_002c-unused-parameter-167"></a><a name="index-unused-parameter-168"></a>Contrary to <samp><span class="command">gcc</span></samp>'s meaning of <samp><span class="option">-Wunused-parameter</span></samp>,
<samp><span class="command">gfortran</span></samp>'s implementation of this option does not warn
about unused dummy arguments (see <samp><span class="option">-Wunused-dummy-argument</span></samp>),
but about unused <code>PARAMETER</code> values. <samp><span class="option">-Wunused-parameter</span></samp>
is not included in <samp><span class="option">-Wall</span></samp> but is implied by <samp><span class="option">-Wall -Wextra</span></samp>.

     <br><dt><code>-Walign-commons</code><dd><a name="index-g_t_0040code_007bWalign_002dcommons_007d-169"></a><a name="index-warnings_002c-alignment-of-_0040code_007bCOMMON_007d-blocks-170"></a><a name="index-alignment-of-_0040code_007bCOMMON_007d-blocks-171"></a>By default, <samp><span class="command">gfortran</span></samp> warns about any occasion of variables being
padded for proper alignment inside a <code>COMMON</code> block. This warning can be turned
off via <samp><span class="option">-Wno-align-commons</span></samp>. See also <samp><span class="option">-falign-commons</span></samp>.

     <br><dt><code>-Werror</code><dd><a name="index-g_t_0040code_007bWerror_007d-172"></a><a name="index-warnings_002c-to-errors-173"></a>Turns all warnings into errors. 
</dl>

   <p>See <a href="../gcc/Warning-Options.html#Warning-Options">Options to Request or Suppress Errors and Warnings</a>, for information on
more options offered by the GBE shared by <samp><span class="command">gfortran</span></samp>, <samp><span class="command">gcc</span></samp>
and other GNU compilers.

   <p>Some of these have no effect when compiling programs written in Fortran.

   </body></html>