Fortran-Dialect-Options.html 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1999-2017 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Funding Free Software", the Front-Cover
  8. Texts being (a) (see below), and with the Back-Cover Texts being (b)
  9. (see below). A copy of the license is included in the section entitled
  10. "GNU Free Documentation License".
  11. (a) The FSF's Front-Cover Text is:
  12. A GNU Manual
  13. (b) The FSF's Back-Cover Text is:
  14. You have freedom to copy and modify this GNU Manual, like GNU
  15. software. Copies published by the Free Software Foundation raise
  16. funds for GNU development. -->
  17. <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <title>The GNU Fortran Compiler: Fortran Dialect Options</title>
  20. <meta name="description" content="The GNU Fortran Compiler: Fortran Dialect Options">
  21. <meta name="keywords" content="The GNU Fortran Compiler: Fortran Dialect Options">
  22. <meta name="resource-type" content="document">
  23. <meta name="distribution" content="global">
  24. <meta name="Generator" content="makeinfo">
  25. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  26. <link href="index.html#Top" rel="start" title="Top">
  27. <link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="Invoking-GNU-Fortran.html#Invoking-GNU-Fortran" rel="up" title="Invoking GNU Fortran">
  30. <link href="Preprocessing-Options.html#Preprocessing-Options" rel="next" title="Preprocessing Options">
  31. <link href="Option-Summary.html#Option-Summary" rel="prev" title="Option Summary">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.smallquotation {font-size: smaller}
  36. div.display {margin-left: 3.2em}
  37. div.example {margin-left: 3.2em}
  38. div.indentedblock {margin-left: 3.2em}
  39. div.lisp {margin-left: 3.2em}
  40. div.smalldisplay {margin-left: 3.2em}
  41. div.smallexample {margin-left: 3.2em}
  42. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  43. div.smalllisp {margin-left: 3.2em}
  44. kbd {font-style:oblique}
  45. pre.display {font-family: inherit}
  46. pre.format {font-family: inherit}
  47. pre.menu-comment {font-family: serif}
  48. pre.menu-preformatted {font-family: serif}
  49. pre.smalldisplay {font-family: inherit; font-size: smaller}
  50. pre.smallexample {font-size: smaller}
  51. pre.smallformat {font-family: inherit; font-size: smaller}
  52. pre.smalllisp {font-size: smaller}
  53. span.nocodebreak {white-space:nowrap}
  54. span.nolinebreak {white-space:nowrap}
  55. span.roman {font-family:serif; font-weight:normal}
  56. span.sansserif {font-family:sans-serif; font-weight:normal}
  57. ul.no-bullet {list-style: none}
  58. -->
  59. </style>
  60. </head>
  61. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  62. <a name="Fortran-Dialect-Options"></a>
  63. <div class="header">
  64. <p>
  65. Next: <a href="Preprocessing-Options.html#Preprocessing-Options" accesskey="n" rel="next">Preprocessing Options</a>, Previous: <a href="Option-Summary.html#Option-Summary" accesskey="p" rel="prev">Option Summary</a>, Up: <a href="Invoking-GNU-Fortran.html#Invoking-GNU-Fortran" accesskey="u" rel="up">Invoking GNU Fortran</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  66. </div>
  67. <hr>
  68. <a name="Options-controlling-Fortran-dialect"></a>
  69. <h3 class="section">2.2 Options controlling Fortran dialect</h3>
  70. <a name="index-dialect-options"></a>
  71. <a name="index-language_002c-dialect-options"></a>
  72. <a name="index-options_002c-dialect"></a>
  73. <p>The following options control the details of the Fortran dialect
  74. accepted by the compiler:
  75. </p>
  76. <dl compact="compact">
  77. <dt><code>-ffree-form</code></dt>
  78. <dt><code>-ffixed-form</code></dt>
  79. <dd><a name="index-ffree_002dform"></a>
  80. <a name="index-ffixed_002dform"></a>
  81. <a name="index-options_002c-Fortran-dialect"></a>
  82. <a name="index-file-format_002c-free"></a>
  83. <a name="index-file-format_002c-fixed"></a>
  84. <p>Specify the layout used by the source file. The free form layout
  85. was introduced in Fortran 90. Fixed form was traditionally used in
  86. older Fortran programs. When neither option is specified, the source
  87. form is determined by the file extension.
  88. </p>
  89. </dd>
  90. <dt><code>-fall-intrinsics</code></dt>
  91. <dd><a name="index-fall_002dintrinsics"></a>
  92. <p>This option causes all intrinsic procedures (including the GNU-specific
  93. extensions) to be accepted. This can be useful with <samp>-std=f95</samp> to
  94. force standard-compliance but get access to the full range of intrinsics
  95. available with <code>gfortran</code>. As a consequence, <samp>-Wintrinsics-std</samp>
  96. will be ignored and no user-defined procedure with the same name as any
  97. intrinsic will be called except when it is explicitly declared <code>EXTERNAL</code>.
  98. </p>
  99. </dd>
  100. <dt><code>-fd-lines-as-code</code></dt>
  101. <dt><code>-fd-lines-as-comments</code></dt>
  102. <dd><a name="index-fd_002dlines_002das_002dcode"></a>
  103. <a name="index-fd_002dlines_002das_002dcomments"></a>
  104. <p>Enable special treatment for lines beginning with <code>d</code> or <code>D</code>
  105. in fixed form sources. If the <samp>-fd-lines-as-code</samp> option is
  106. given they are treated as if the first column contained a blank. If the
  107. <samp>-fd-lines-as-comments</samp> option is given, they are treated as
  108. comment lines.
  109. </p>
  110. </dd>
  111. <dt><code>-fdec</code></dt>
  112. <dd><a name="index-fdec"></a>
  113. <p>DEC compatibility mode. Enables extensions and other features that mimic
  114. the default behavior of older compilers (such as DEC).
  115. These features are non-standard and should be avoided at all costs.
  116. For details on GNU Fortran&rsquo;s implementation of these extensions see the
  117. full documentation.
  118. </p>
  119. <p>Other flags enabled by this switch are:
  120. <samp>-fdollar-ok</samp> <samp>-fcray-pointer</samp> <samp>-fdec-structure</samp>
  121. <samp>-fdec-intrinsic-ints</samp> <samp>-fdec-static</samp> <samp>-fdec-math</samp>
  122. </p>
  123. <p>If <samp>-fd-lines-as-code</samp>/<samp>-fd-lines-as-comments</samp> are unset, then
  124. <samp>-fdec</samp> also sets <samp>-fd-lines-as-comments</samp>.
  125. </p>
  126. </dd>
  127. <dt><code>-fdec-structure</code></dt>
  128. <dd><a name="index-fdec_002dstructure"></a>
  129. <p>Enable DEC <code>STRUCTURE</code> and <code>RECORD</code> as well as <code>UNION</code>,
  130. <code>MAP</code>, and dot (&rsquo;.&rsquo;) as a member separator (in addition to &rsquo;%&rsquo;). This is
  131. provided for compatibility only; Fortran 90 derived types should be used
  132. instead where possible.
  133. </p>
  134. </dd>
  135. <dt><code>-fdec-intrinsic-ints</code></dt>
  136. <dd><a name="index-fdec_002dintrinsic_002dints"></a>
  137. <p>Enable B/I/J/K kind variants of existing integer functions (e.g. BIAND, IIAND,
  138. JIAND, etc...). For a complete list of intrinsics see the full documentation.
  139. </p>
  140. </dd>
  141. <dt><code>-fdec-math</code></dt>
  142. <dd><a name="index-fdec_002dmath"></a>
  143. <p>Enable legacy math intrinsics such as COTAN and degree-valued trigonometric
  144. functions (e.g. TAND, ATAND, etc...) for compatability with older code.
  145. </p>
  146. </dd>
  147. <dt><code>-fdec-static</code></dt>
  148. <dd><a name="index-fdec_002dstatic"></a>
  149. <p>Enable DEC-style STATIC and AUTOMATIC attributes to explicitly specify
  150. the storage of variables and other objects.
  151. </p>
  152. </dd>
  153. <dt><code>-fdollar-ok</code></dt>
  154. <dd><a name="index-fdollar_002dok"></a>
  155. <a name="index-_0024"></a>
  156. <a name="index-symbol-names"></a>
  157. <a name="index-character-set"></a>
  158. <p>Allow &lsquo;<samp>$</samp>&rsquo; as a valid non-first character in a symbol name. Symbols
  159. that start with &lsquo;<samp>$</samp>&rsquo; are rejected since it is unclear which rules to
  160. apply to implicit typing as different vendors implement different rules.
  161. Using &lsquo;<samp>$</samp>&rsquo; in <code>IMPLICIT</code> statements is also rejected.
  162. </p>
  163. </dd>
  164. <dt><code>-fbackslash</code></dt>
  165. <dd><a name="index-backslash-1"></a>
  166. <a name="index-backslash"></a>
  167. <a name="index-escape-characters"></a>
  168. <p>Change the interpretation of backslashes in string literals from a single
  169. backslash character to &ldquo;C-style&rdquo; escape characters. The following
  170. combinations are expanded <code>\a</code>, <code>\b</code>, <code>\f</code>, <code>\n</code>,
  171. <code>\r</code>, <code>\t</code>, <code>\v</code>, <code>\\</code>, and <code>\0</code> to the ASCII
  172. characters alert, backspace, form feed, newline, carriage return,
  173. horizontal tab, vertical tab, backslash, and NUL, respectively.
  174. Additionally, <code>\x</code><var>nn</var>, <code>\u</code><var>nnnn</var> and
  175. <code>\U</code><var>nnnnnnnn</var> (where each <var>n</var> is a hexadecimal digit) are
  176. translated into the Unicode characters corresponding to the specified code
  177. points. All other combinations of a character preceded by \ are
  178. unexpanded.
  179. </p>
  180. </dd>
  181. <dt><code>-fmodule-private</code></dt>
  182. <dd><a name="index-fmodule_002dprivate"></a>
  183. <a name="index-module-entities"></a>
  184. <a name="index-private"></a>
  185. <p>Set the default accessibility of module entities to <code>PRIVATE</code>.
  186. Use-associated entities will not be accessible unless they are explicitly
  187. declared as <code>PUBLIC</code>.
  188. </p>
  189. </dd>
  190. <dt><code>-ffixed-line-length-<var>n</var></code></dt>
  191. <dd><a name="index-ffixed_002dline_002dlength_002dn"></a>
  192. <a name="index-file-format_002c-fixed-1"></a>
  193. <p>Set column after which characters are ignored in typical fixed-form
  194. lines in the source file, and through which spaces are assumed (as
  195. if padded to that length) after the ends of short fixed-form lines.
  196. </p>
  197. <p>Popular values for <var>n</var> include 72 (the
  198. standard and the default), 80 (card image), and 132 (corresponding
  199. to &ldquo;extended-source&rdquo; options in some popular compilers).
  200. <var>n</var> may also be &lsquo;<samp>none</samp>&rsquo;, meaning that the entire line is meaningful
  201. and that continued character constants never have implicit spaces appended
  202. to them to fill out the line.
  203. <samp>-ffixed-line-length-0</samp> means the same thing as
  204. <samp>-ffixed-line-length-none</samp>.
  205. </p>
  206. </dd>
  207. <dt><code>-ffree-line-length-<var>n</var></code></dt>
  208. <dd><a name="index-ffree_002dline_002dlength_002dn"></a>
  209. <a name="index-file-format_002c-free-1"></a>
  210. <p>Set column after which characters are ignored in typical free-form
  211. lines in the source file. The default value is 132.
  212. <var>n</var> may be &lsquo;<samp>none</samp>&rsquo;, meaning that the entire line is meaningful.
  213. <samp>-ffree-line-length-0</samp> means the same thing as
  214. <samp>-ffree-line-length-none</samp>.
  215. </p>
  216. </dd>
  217. <dt><code>-fmax-identifier-length=<var>n</var></code></dt>
  218. <dd><a name="index-fmax_002didentifier_002dlength_003dn"></a>
  219. <p>Specify the maximum allowed identifier length. Typical values are
  220. 31 (Fortran 95) and 63 (Fortran 2003 and Fortran 2008).
  221. </p>
  222. </dd>
  223. <dt><code>-fimplicit-none</code></dt>
  224. <dd><a name="index-fimplicit_002dnone"></a>
  225. <p>Specify that no implicit typing is allowed, unless overridden by explicit
  226. <code>IMPLICIT</code> statements. This is the equivalent of adding
  227. <code>implicit none</code> to the start of every procedure.
  228. </p>
  229. </dd>
  230. <dt><code>-fcray-pointer</code></dt>
  231. <dd><a name="index-fcray_002dpointer"></a>
  232. <p>Enable the Cray pointer extension, which provides C-like pointer
  233. functionality.
  234. </p>
  235. </dd>
  236. <dt><code>-fopenacc</code></dt>
  237. <dd><a name="index-fopenacc"></a>
  238. <a name="index-OpenACC"></a>
  239. <p>Enable the OpenACC extensions. This includes OpenACC <code>!$acc</code>
  240. directives in free form and <code>c$acc</code>, <code>*$acc</code> and
  241. <code>!$acc</code> directives in fixed form, <code>!$</code> conditional
  242. compilation sentinels in free form and <code>c$</code>, <code>*$</code> and
  243. <code>!$</code> sentinels in fixed form, and when linking arranges for the
  244. OpenACC runtime library to be linked in.
  245. </p>
  246. <p>Note that this is an experimental feature, incomplete, and subject to
  247. change in future versions of GCC. See
  248. <a href="https://gcc.gnu.org/wiki/OpenACC">https://gcc.gnu.org/wiki/OpenACC</a><!-- /@w --> for more information.
  249. </p>
  250. </dd>
  251. <dt><code>-fopenmp</code></dt>
  252. <dd><a name="index-fopenmp"></a>
  253. <a name="index-OpenMP"></a>
  254. <p>Enable the OpenMP extensions. This includes OpenMP <code>!$omp</code> directives
  255. in free form
  256. and <code>c$omp</code>, <code>*$omp</code> and <code>!$omp</code> directives in fixed form,
  257. <code>!$</code> conditional compilation sentinels in free form
  258. and <code>c$</code>, <code>*$</code> and <code>!$</code> sentinels in fixed form,
  259. and when linking arranges for the OpenMP runtime library to be linked
  260. in. The option <samp>-fopenmp</samp> implies <samp>-frecursive</samp>.
  261. </p>
  262. </dd>
  263. <dt><code>-fno-range-check</code></dt>
  264. <dd><a name="index-frange_002dcheck"></a>
  265. <p>Disable range checking on results of simplification of constant
  266. expressions during compilation. For example, GNU Fortran will give
  267. an error at compile time when simplifying <code>a = 1. / 0</code>.
  268. With this option, no error will be given and <code>a</code> will be assigned
  269. the value <code>+Infinity</code>. If an expression evaluates to a value
  270. outside of the relevant range of [<code>-HUGE()</code>:<code>HUGE()</code>],
  271. then the expression will be replaced by <code>-Inf</code> or <code>+Inf</code>
  272. as appropriate.
  273. Similarly, <code>DATA i/Z'FFFFFFFF'/</code> will result in an integer overflow
  274. on most systems, but with <samp>-fno-range-check</samp> the value will
  275. &ldquo;wrap around&rdquo; and <code>i</code> will be initialized to <em>-1</em> instead.
  276. </p>
  277. </dd>
  278. <dt><code>-fdefault-integer-8</code></dt>
  279. <dd><a name="index-fdefault_002dinteger_002d8"></a>
  280. <p>Set the default integer and logical types to an 8 byte wide type. This option
  281. also affects the kind of integer constants like <code>42</code>. Unlike
  282. <samp>-finteger-4-integer-8</samp>, it does not promote variables with explicit
  283. kind declaration.
  284. </p>
  285. </dd>
  286. <dt><code>-fdefault-real-8</code></dt>
  287. <dd><a name="index-fdefault_002dreal_002d8"></a>
  288. <p>Set the default real type to an 8 byte wide type. This option also affects
  289. the kind of non-double real constants like <code>1.0</code>, and does promote
  290. the default width of <code>DOUBLE PRECISION</code> to 16 bytes if possible, unless
  291. <code>-fdefault-double-8</code> is given, too. Unlike <samp>-freal-4-real-8</samp>,
  292. it does not promote variables with explicit kind declaration.
  293. </p>
  294. </dd>
  295. <dt><code>-fdefault-double-8</code></dt>
  296. <dd><a name="index-fdefault_002ddouble_002d8"></a>
  297. <p>Set the <code>DOUBLE PRECISION</code> type to an 8 byte wide type. Do nothing if this
  298. is already the default. If <samp>-fdefault-real-8</samp> is given,
  299. <code>DOUBLE PRECISION</code> would instead be promoted to 16 bytes if possible, and
  300. <samp>-fdefault-double-8</samp> can be used to prevent this. The kind of real
  301. constants like <code>1.d0</code> will not be changed by <samp>-fdefault-real-8</samp>
  302. though, so also <samp>-fdefault-double-8</samp> does not affect it.
  303. </p>
  304. </dd>
  305. <dt><code>-finteger-4-integer-8</code></dt>
  306. <dd><a name="index-finteger_002d4_002dinteger_002d8"></a>
  307. <p>Promote all <code>INTEGER(KIND=4)</code> entities to an <code>INTEGER(KIND=8)</code>
  308. entities. If <code>KIND=8</code> is unavailable, then an error will be issued.
  309. This option should be used with care and may not be suitable for your codes.
  310. Areas of possible concern include calls to external procedures,
  311. alignment in <code>EQUIVALENCE</code> and/or <code>COMMON</code>, generic interfaces,
  312. BOZ literal constant conversion, and I/O. Inspection of the intermediate
  313. representation of the translated Fortran code, produced by
  314. <samp>-fdump-tree-original</samp>, is suggested.
  315. </p>
  316. </dd>
  317. <dt><code>-freal-4-real-8</code></dt>
  318. <dt><code>-freal-4-real-10</code></dt>
  319. <dt><code>-freal-4-real-16</code></dt>
  320. <dt><code>-freal-8-real-4</code></dt>
  321. <dt><code>-freal-8-real-10</code></dt>
  322. <dt><code>-freal-8-real-16</code></dt>
  323. <dd><a name="index-freal_002d4_002dreal_002d8"></a>
  324. <a name="index-freal_002d4_002dreal_002d10"></a>
  325. <a name="index-freal_002d4_002dreal_002d16"></a>
  326. <a name="index-freal_002d8_002dreal_002d4"></a>
  327. <a name="index-freal_002d8_002dreal_002d10"></a>
  328. <a name="index-freal_002d8_002dreal_002d16"></a>
  329. <a name="index-options_002c-real-kind-type-promotion"></a>
  330. <p>Promote all <code>REAL(KIND=M)</code> entities to <code>REAL(KIND=N)</code> entities.
  331. If <code>REAL(KIND=N)</code> is unavailable, then an error will be issued.
  332. All other real kind types are unaffected by this option.
  333. These options should be used with care and may not be suitable for your
  334. codes. Areas of possible concern include calls to external procedures,
  335. alignment in <code>EQUIVALENCE</code> and/or <code>COMMON</code>, generic interfaces,
  336. BOZ literal constant conversion, and I/O. Inspection of the intermediate
  337. representation of the translated Fortran code, produced by
  338. <samp>-fdump-tree-original</samp>, is suggested.
  339. </p>
  340. </dd>
  341. <dt><code>-std=<var>std</var></code></dt>
  342. <dd><a name="index-std_003dstd-option"></a>
  343. <p>Specify the standard to which the program is expected to conform, which
  344. may be one of &lsquo;<samp>f95</samp>&rsquo;, &lsquo;<samp>f2003</samp>&rsquo;, &lsquo;<samp>f2008</samp>&rsquo;, &lsquo;<samp>gnu</samp>&rsquo;, or
  345. &lsquo;<samp>legacy</samp>&rsquo;. The default value for <var>std</var> is &lsquo;<samp>gnu</samp>&rsquo;, which
  346. specifies a superset of the Fortran 95 standard that includes all of the
  347. extensions supported by GNU Fortran, although warnings will be given for
  348. obsolete extensions not recommended for use in new code. The
  349. &lsquo;<samp>legacy</samp>&rsquo; value is equivalent but without the warnings for obsolete
  350. extensions, and may be useful for old non-standard programs. The
  351. &lsquo;<samp>f95</samp>&rsquo;, &lsquo;<samp>f2003</samp>&rsquo; and &lsquo;<samp>f2008</samp>&rsquo; values specify strict
  352. conformance to the Fortran 95, Fortran 2003 and Fortran 2008 standards,
  353. respectively; errors are given for all extensions beyond the relevant
  354. language standard, and warnings are given for the Fortran 77 features
  355. that are permitted but obsolescent in later standards. &lsquo;<samp>-std=f2008ts</samp>&rsquo;
  356. allows the Fortran 2008 standard including the additions of the
  357. Technical Specification (TS) 29113 on Further Interoperability of Fortran
  358. with C and TS 18508 on Additional Parallel Features in Fortran.
  359. </p>
  360. </dd>
  361. <dt><code>-ftest-forall-temp</code></dt>
  362. <dd><a name="index-ftest_002dforall_002dtemp"></a>
  363. <p>Enhance test coverage by forcing most forall assignments to use temporary.
  364. </p>
  365. </dd>
  366. </dl>
  367. <hr>
  368. <div class="header">
  369. <p>
  370. Next: <a href="Preprocessing-Options.html#Preprocessing-Options" accesskey="n" rel="next">Preprocessing Options</a>, Previous: <a href="Option-Summary.html#Option-Summary" accesskey="p" rel="prev">Option Summary</a>, Up: <a href="Invoking-GNU-Fortran.html#Invoking-GNU-Fortran" accesskey="u" rel="up">Invoking GNU Fortran</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  371. </div>
  372. </body>
  373. </html>