Code-Gen-Options.html 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  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: Code Gen Options</title>
  20. <meta name="description" content="The GNU Fortran Compiler: Code Gen Options">
  21. <meta name="keywords" content="The GNU Fortran Compiler: Code Gen 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="Environment-Variables.html#Environment-Variables" rel="next" title="Environment Variables">
  31. <link href="Runtime-Options.html#Runtime-Options" rel="prev" title="Runtime Options">
  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="Code-Gen-Options"></a>
  63. <div class="header">
  64. <p>
  65. Next: <a href="Environment-Variables.html#Environment-Variables" accesskey="n" rel="next">Environment Variables</a>, Previous: <a href="Runtime-Options.html#Runtime-Options" accesskey="p" rel="prev">Runtime Options</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-for-code-generation-conventions"></a>
  69. <h3 class="section">2.9 Options for code generation conventions</h3>
  70. <a name="index-code-generation_002c-conventions"></a>
  71. <a name="index-options_002c-code-generation"></a>
  72. <a name="index-options_002c-run_002dtime"></a>
  73. <p>These machine-independent options control the interface conventions
  74. used in code generation.
  75. </p>
  76. <p>Most of them have both positive and negative forms; the negative form
  77. of <samp>-ffoo</samp> would be <samp>-fno-foo</samp>. In the table below, only
  78. one of the forms is listed&mdash;the one which is not the default. You
  79. can figure out the other form by either removing <samp>no-</samp> or adding
  80. it.
  81. </p>
  82. <dl compact="compact">
  83. <dt><code>-fno-automatic</code></dt>
  84. <dd><a name="index-fno_002dautomatic"></a>
  85. <a name="index-SAVE-statement"></a>
  86. <a name="index-statement_002c-SAVE"></a>
  87. <p>Treat each program unit (except those marked as RECURSIVE) as if the
  88. <code>SAVE</code> statement were specified for every local variable and array
  89. referenced in it. Does not affect common blocks. (Some Fortran compilers
  90. provide this option under the name <samp>-static</samp> or <samp>-save</samp>.)
  91. The default, which is <samp>-fautomatic</samp>, uses the stack for local
  92. variables smaller than the value given by <samp>-fmax-stack-var-size</samp>.
  93. Use the option <samp>-frecursive</samp> to use no static memory.
  94. </p>
  95. </dd>
  96. <dt><code>-ff2c</code></dt>
  97. <dd><a name="index-ff2c"></a>
  98. <a name="index-calling-convention"></a>
  99. <a name="index-f2c-calling-convention"></a>
  100. <a name="index-g77-calling-convention"></a>
  101. <a name="index-libf2c-calling-convention"></a>
  102. <p>Generate code designed to be compatible with code generated
  103. by <code>g77</code> and <code>f2c</code>.
  104. </p>
  105. <p>The calling conventions used by <code>g77</code> (originally implemented
  106. in <code>f2c</code>) require functions that return type
  107. default <code>REAL</code> to actually return the C type <code>double</code>, and
  108. functions that return type <code>COMPLEX</code> to return the values via an
  109. extra argument in the calling sequence that points to where to
  110. store the return value. Under the default GNU calling conventions, such
  111. functions simply return their results as they would in GNU
  112. C&mdash;default <code>REAL</code> functions return the C type <code>float</code>, and
  113. <code>COMPLEX</code> functions return the GNU C type <code>complex</code>.
  114. Additionally, this option implies the <samp>-fsecond-underscore</samp>
  115. option, unless <samp>-fno-second-underscore</samp> is explicitly requested.
  116. </p>
  117. <p>This does not affect the generation of code that interfaces with
  118. the <code>libgfortran</code> library.
  119. </p>
  120. <p><em>Caution:</em> It is not a good idea to mix Fortran code compiled with
  121. <samp>-ff2c</samp> with code compiled with the default <samp>-fno-f2c</samp>
  122. calling conventions as, calling <code>COMPLEX</code> or default <code>REAL</code>
  123. functions between program parts which were compiled with different
  124. calling conventions will break at execution time.
  125. </p>
  126. <p><em>Caution:</em> This will break code which passes intrinsic functions
  127. of type default <code>REAL</code> or <code>COMPLEX</code> as actual arguments, as
  128. the library implementations use the <samp>-fno-f2c</samp> calling conventions.
  129. </p>
  130. </dd>
  131. <dt><code>-fno-underscoring</code></dt>
  132. <dd><a name="index-fno_002dunderscoring"></a>
  133. <a name="index-underscore"></a>
  134. <a name="index-symbol-names_002c-underscores"></a>
  135. <a name="index-transforming-symbol-names"></a>
  136. <a name="index-symbol-names_002c-transforming"></a>
  137. <p>Do not transform names of entities specified in the Fortran
  138. source file by appending underscores to them.
  139. </p>
  140. <p>With <samp>-funderscoring</samp> in effect, GNU Fortran appends one
  141. underscore to external names with no underscores. This is done to ensure
  142. compatibility with code produced by many UNIX Fortran compilers.
  143. </p>
  144. <p><em>Caution</em>: The default behavior of GNU Fortran is
  145. incompatible with <code>f2c</code> and <code>g77</code>, please use the
  146. <samp>-ff2c</samp> option if you want object files compiled with
  147. GNU Fortran to be compatible with object code created with these
  148. tools.
  149. </p>
  150. <p>Use of <samp>-fno-underscoring</samp> is not recommended unless you are
  151. experimenting with issues such as integration of GNU Fortran into
  152. existing system environments (vis-&agrave;-vis existing libraries, tools,
  153. and so on).
  154. </p>
  155. <p>For example, with <samp>-funderscoring</samp>, and assuming that <code>j()</code> and
  156. <code>max_count()</code> are external functions while <code>my_var</code> and
  157. <code>lvar</code> are local variables, a statement like
  158. </p><div class="smallexample">
  159. <pre class="smallexample">I = J() + MAX_COUNT (MY_VAR, LVAR)
  160. </pre></div>
  161. <p>is implemented as something akin to:
  162. </p><div class="smallexample">
  163. <pre class="smallexample">i = j_() + max_count__(&amp;my_var__, &amp;lvar);
  164. </pre></div>
  165. <p>With <samp>-fno-underscoring</samp>, the same statement is implemented as:
  166. </p>
  167. <div class="smallexample">
  168. <pre class="smallexample">i = j() + max_count(&amp;my_var, &amp;lvar);
  169. </pre></div>
  170. <p>Use of <samp>-fno-underscoring</samp> allows direct specification of
  171. user-defined names while debugging and when interfacing GNU Fortran
  172. code with other languages.
  173. </p>
  174. <p>Note that just because the names match does <em>not</em> mean that the
  175. interface implemented by GNU Fortran for an external name matches the
  176. interface implemented by some other language for that same name.
  177. That is, getting code produced by GNU Fortran to link to code produced
  178. by some other compiler using this or any other method can be only a
  179. small part of the overall solution&mdash;getting the code generated by
  180. both compilers to agree on issues other than naming can require
  181. significant effort, and, unlike naming disagreements, linkers normally
  182. cannot detect disagreements in these other areas.
  183. </p>
  184. <p>Also, note that with <samp>-fno-underscoring</samp>, the lack of appended
  185. underscores introduces the very real possibility that a user-defined
  186. external name will conflict with a name in a system library, which
  187. could make finding unresolved-reference bugs quite difficult in some
  188. cases&mdash;they might occur at program run time, and show up only as
  189. buggy behavior at run time.
  190. </p>
  191. <p>In future versions of GNU Fortran we hope to improve naming and linking
  192. issues so that debugging always involves using the names as they appear
  193. in the source, even if the names as seen by the linker are mangled to
  194. prevent accidental linking between procedures with incompatible
  195. interfaces.
  196. </p>
  197. </dd>
  198. <dt><code>-fsecond-underscore</code></dt>
  199. <dd><a name="index-fsecond_002dunderscore"></a>
  200. <a name="index-underscore-1"></a>
  201. <a name="index-symbol-names_002c-underscores-1"></a>
  202. <a name="index-transforming-symbol-names-1"></a>
  203. <a name="index-symbol-names_002c-transforming-1"></a>
  204. <a name="index-f2c-calling-convention-1"></a>
  205. <a name="index-g77-calling-convention-1"></a>
  206. <a name="index-libf2c-calling-convention-1"></a>
  207. <p>By default, GNU Fortran appends an underscore to external
  208. names. If this option is used GNU Fortran appends two
  209. underscores to names with underscores and one underscore to external names
  210. with no underscores. GNU Fortran also appends two underscores to
  211. internal names with underscores to avoid naming collisions with external
  212. names.
  213. </p>
  214. <p>This option has no effect if <samp>-fno-underscoring</samp> is
  215. in effect. It is implied by the <samp>-ff2c</samp> option.
  216. </p>
  217. <p>Otherwise, with this option, an external name such as <code>MAX_COUNT</code>
  218. is implemented as a reference to the link-time external symbol
  219. <code>max_count__</code>, instead of <code>max_count_</code>. This is required
  220. for compatibility with <code>g77</code> and <code>f2c</code>, and is implied
  221. by use of the <samp>-ff2c</samp> option.
  222. </p>
  223. </dd>
  224. <dt><code>-fcoarray=<var>&lt;keyword&gt;</var></code></dt>
  225. <dd><a name="index-fcoarray"></a>
  226. <a name="index-coarrays"></a>
  227. <dl compact="compact">
  228. <dt>&lsquo;<samp>none</samp>&rsquo;</dt>
  229. <dd><p>Disable coarray support; using coarray declarations and image-control
  230. statements will produce a compile-time error. (Default)
  231. </p>
  232. </dd>
  233. <dt>&lsquo;<samp>single</samp>&rsquo;</dt>
  234. <dd><p>Single-image mode, i.e. <code>num_images()</code> is always one.
  235. </p>
  236. </dd>
  237. <dt>&lsquo;<samp>lib</samp>&rsquo;</dt>
  238. <dd><p>Library-based coarray parallelization; a suitable GNU Fortran coarray
  239. library needs to be linked.
  240. </p></dd>
  241. </dl>
  242. </dd>
  243. <dt><code>-fcheck=<var>&lt;keyword&gt;</var></code></dt>
  244. <dd><a name="index-fcheck"></a>
  245. <a name="index-array_002c-bounds-checking"></a>
  246. <a name="index-bounds-checking"></a>
  247. <a name="index-pointer-checking"></a>
  248. <a name="index-memory-checking"></a>
  249. <a name="index-range-checking"></a>
  250. <a name="index-subscript-checking"></a>
  251. <a name="index-checking-subscripts"></a>
  252. <a name="index-run_002dtime-checking"></a>
  253. <a name="index-checking-array-temporaries"></a>
  254. <p>Enable the generation of run-time checks; the argument shall be
  255. a comma-delimited list of the following keywords. Prefixing a check with
  256. <samp>no-</samp> disables it if it was activated by a previous specification.
  257. </p>
  258. <dl compact="compact">
  259. <dt>&lsquo;<samp>all</samp>&rsquo;</dt>
  260. <dd><p>Enable all run-time test of <samp>-fcheck</samp>.
  261. </p>
  262. </dd>
  263. <dt>&lsquo;<samp>array-temps</samp>&rsquo;</dt>
  264. <dd><p>Warns at run time when for passing an actual argument a temporary array
  265. had to be generated. The information generated by this warning is
  266. sometimes useful in optimization, in order to avoid such temporaries.
  267. </p>
  268. <p>Note: The warning is only printed once per location.
  269. </p>
  270. </dd>
  271. <dt>&lsquo;<samp>bounds</samp>&rsquo;</dt>
  272. <dd><p>Enable generation of run-time checks for array subscripts
  273. and against the declared minimum and maximum values. It also
  274. checks array indices for assumed and deferred
  275. shape arrays against the actual allocated bounds and ensures that all string
  276. lengths are equal for character array constructors without an explicit
  277. typespec.
  278. </p>
  279. <p>Some checks require that <samp>-fcheck=bounds</samp> is set for
  280. the compilation of the main program.
  281. </p>
  282. <p>Note: In the future this may also include other forms of checking, e.g.,
  283. checking substring references.
  284. </p>
  285. </dd>
  286. <dt>&lsquo;<samp>do</samp>&rsquo;</dt>
  287. <dd><p>Enable generation of run-time checks for invalid modification of loop
  288. iteration variables.
  289. </p>
  290. </dd>
  291. <dt>&lsquo;<samp>mem</samp>&rsquo;</dt>
  292. <dd><p>Enable generation of run-time checks for memory allocation.
  293. Note: This option does not affect explicit allocations using the
  294. <code>ALLOCATE</code> statement, which will be always checked.
  295. </p>
  296. </dd>
  297. <dt>&lsquo;<samp>pointer</samp>&rsquo;</dt>
  298. <dd><p>Enable generation of run-time checks for pointers and allocatables.
  299. </p>
  300. </dd>
  301. <dt>&lsquo;<samp>recursion</samp>&rsquo;</dt>
  302. <dd><p>Enable generation of run-time checks for recursively called subroutines and
  303. functions which are not marked as recursive. See also <samp>-frecursive</samp>.
  304. Note: This check does not work for OpenMP programs and is disabled if used
  305. together with <samp>-frecursive</samp> and <samp>-fopenmp</samp>.
  306. </p></dd>
  307. </dl>
  308. <p>Example: Assuming you have a file <samp>foo.f90</samp>, the command
  309. </p><div class="smallexample">
  310. <pre class="smallexample"> gfortran -fcheck=all,no-array-temps foo.f90
  311. </pre></div>
  312. <p>will compile the file with all checks enabled as specified above except
  313. warnings for generated array temporaries.
  314. </p>
  315. </dd>
  316. <dt><code>-fbounds-check</code></dt>
  317. <dd><a name="index-fbounds_002dcheck"></a>
  318. <p>Deprecated alias for <samp>-fcheck=bounds</samp>.
  319. </p>
  320. </dd>
  321. <dt><code>-ftail-call-workaround</code></dt>
  322. <dt><code>-ftail-call-workaround=<var>n</var></code></dt>
  323. <dd><a name="index-tail_002dcall_002dworkaround"></a>
  324. <p>Some C interfaces to Fortran codes violate the gfortran ABI by
  325. omitting the hidden character length arguments as described in
  326. See <a href="Argument-passing-conventions.html#Argument-passing-conventions">Argument passing conventions</a>. This can lead to crashes
  327. because pushing arguments for tail calls can overflow the stack.
  328. </p>
  329. <p>To provide a workaround for existing binary packages, this option
  330. disables tail call optimization for gfortran procedures with character
  331. arguments. With <samp>-ftail-call-workaround=2</samp> tail call optimization
  332. is disabled in all gfortran procedures with character arguments,
  333. with <samp>-ftail-call-workaround=1</samp> or equivalent
  334. <samp>-ftail-call-workaround</samp> only in gfortran procedures with character
  335. arguments that call implicitly prototyped procedures.
  336. </p>
  337. <p>Using this option can lead to problems including crashes due to
  338. insufficient stack space.
  339. </p>
  340. <p>It is <em>very strongly</em> recommended to fix the code in question.
  341. The <samp>-fc-prototypes-external</samp> option can be used to generate
  342. prototypes which conform to gfortran&rsquo;s ABI, for inclusion in the
  343. source code.
  344. </p>
  345. <p>Support for this option will likely be withdrawn in a future release
  346. of gfortran.
  347. </p>
  348. <p>The negative form, <samp>-fno-tail-call-workaround</samp> or equivalent
  349. <samp>-ftail-call-workaround=0</samp>, can be used to disable this option.
  350. </p>
  351. <p>Default is currently <samp>-ftail-call-workaround</samp>, this will change
  352. in future releases.
  353. </p>
  354. </dd>
  355. <dt><code>-fcheck-array-temporaries</code></dt>
  356. <dd><a name="index-fcheck_002darray_002dtemporaries"></a>
  357. <p>Deprecated alias for <samp>-fcheck=array-temps</samp>.
  358. </p>
  359. </dd>
  360. <dt><code>-fmax-array-constructor=<var>n</var></code></dt>
  361. <dd><a name="index-fmax_002darray_002dconstructor"></a>
  362. <p>This option can be used to increase the upper limit permitted in
  363. array constructors. The code below requires this option to expand
  364. the array at compile time.
  365. </p>
  366. <div class="smallexample">
  367. <pre class="smallexample">program test
  368. implicit none
  369. integer j
  370. integer, parameter :: n = 100000
  371. integer, parameter :: i(n) = (/ (2*j, j = 1, n) /)
  372. print '(10(I0,1X))', i
  373. end program test
  374. </pre></div>
  375. <p><em>Caution: This option can lead to long compile times and excessively
  376. large object files.</em>
  377. </p>
  378. <p>The default value for <var>n</var> is 65535.
  379. </p>
  380. </dd>
  381. <dt><code>-fmax-stack-var-size=<var>n</var></code></dt>
  382. <dd><a name="index-fmax_002dstack_002dvar_002dsize"></a>
  383. <p>This option specifies the size in bytes of the largest array that will be put
  384. on the stack; if the size is exceeded static memory is used (except in
  385. procedures marked as RECURSIVE). Use the option <samp>-frecursive</samp> to
  386. allow for recursive procedures which do not have a RECURSIVE attribute or
  387. for parallel programs. Use <samp>-fno-automatic</samp> to never use the stack.
  388. </p>
  389. <p>This option currently only affects local arrays declared with constant
  390. bounds, and may not apply to all character variables.
  391. Future versions of GNU Fortran may improve this behavior.
  392. </p>
  393. <p>The default value for <var>n</var> is 32768.
  394. </p>
  395. </dd>
  396. <dt><code>-fstack-arrays</code></dt>
  397. <dd><a name="index-fstack_002darrays"></a>
  398. <p>Adding this option will make the Fortran compiler put all local arrays,
  399. even those of unknown size onto stack memory. If your program uses very
  400. large local arrays it is possible that you will have to extend your runtime
  401. limits for stack memory on some operating systems. This flag is enabled
  402. by default at optimization level <samp>-Ofast</samp>.
  403. </p>
  404. </dd>
  405. <dt><code>-fpack-derived</code></dt>
  406. <dd><a name="index-fpack_002dderived"></a>
  407. <a name="index-structure-packing"></a>
  408. <p>This option tells GNU Fortran to pack derived type members as closely as
  409. possible. Code compiled with this option is likely to be incompatible
  410. with code compiled without this option, and may execute slower.
  411. </p>
  412. </dd>
  413. <dt><code>-frepack-arrays</code></dt>
  414. <dd><a name="index-frepack_002darrays"></a>
  415. <a name="index-repacking-arrays"></a>
  416. <p>In some circumstances GNU Fortran may pass assumed shape array
  417. sections via a descriptor describing a noncontiguous area of memory.
  418. This option adds code to the function prologue to repack the data into
  419. a contiguous block at runtime.
  420. </p>
  421. <p>This should result in faster accesses to the array. However it can introduce
  422. significant overhead to the function call, especially when the passed data
  423. is noncontiguous.
  424. </p>
  425. </dd>
  426. <dt><code>-fshort-enums</code></dt>
  427. <dd><a name="index-fshort_002denums"></a>
  428. <p>This option is provided for interoperability with C code that was
  429. compiled with the <samp>-fshort-enums</samp> option. It will make
  430. GNU Fortran choose the smallest <code>INTEGER</code> kind a given
  431. enumerator set will fit in, and give all its enumerators this kind.
  432. </p>
  433. </dd>
  434. <dt><code>-fexternal-blas</code></dt>
  435. <dd><a name="index-fexternal_002dblas"></a>
  436. <p>This option will make <code>gfortran</code> generate calls to BLAS functions
  437. for some matrix operations like <code>MATMUL</code>, instead of using our own
  438. algorithms, if the size of the matrices involved is larger than a given
  439. limit (see <samp>-fblas-matmul-limit</samp>). This may be profitable if an
  440. optimized vendor BLAS library is available. The BLAS library will have
  441. to be specified at link time.
  442. </p>
  443. </dd>
  444. <dt><code>-fblas-matmul-limit=<var>n</var></code></dt>
  445. <dd><a name="index-fblas_002dmatmul_002dlimit"></a>
  446. <p>Only significant when <samp>-fexternal-blas</samp> is in effect.
  447. Matrix multiplication of matrices with size larger than (or equal to) <var>n</var>
  448. will be performed by calls to BLAS functions, while others will be
  449. handled by <code>gfortran</code> internal algorithms. If the matrices
  450. involved are not square, the size comparison is performed using the
  451. geometric mean of the dimensions of the argument and result matrices.
  452. </p>
  453. <p>The default value for <var>n</var> is 30.
  454. </p>
  455. </dd>
  456. <dt><code>-finline-matmul-limit=<var>n</var></code></dt>
  457. <dd><a name="index-finline_002dmatmul_002dlimit"></a>
  458. <p>When front-end optimiztion is active, some calls to the <code>MATMUL</code>
  459. intrinsic function will be inlined. This may result in code size
  460. increase if the size of the matrix cannot be determined at compile
  461. time, as code for both cases is generated. Setting
  462. <code>-finline-matmul-limit=0</code> will disable inlining in all cases.
  463. Setting this option with a value of <var>n</var> will produce inline code
  464. for matrices with size up to <var>n</var>. If the matrices involved are not
  465. square, the size comparison is performed using the geometric mean of
  466. the dimensions of the argument and result matrices.
  467. </p>
  468. <p>The default value for <var>n</var> is 30. The <code>-fblas-matmul-limit</code>
  469. can be used to change this value.
  470. </p>
  471. </dd>
  472. <dt><code>-frecursive</code></dt>
  473. <dd><a name="index-frecursive"></a>
  474. <p>Allow indirect recursion by forcing all local arrays to be allocated
  475. on the stack. This flag cannot be used together with
  476. <samp>-fmax-stack-var-size=</samp> or <samp>-fno-automatic</samp>.
  477. </p>
  478. </dd>
  479. <dt><code>-finit-local-zero</code></dt>
  480. <dt><code>-finit-derived</code></dt>
  481. <dt><code>-finit-integer=<var>n</var></code></dt>
  482. <dt><code>-finit-real=<var>&lt;zero|inf|-inf|nan|snan&gt;</var></code></dt>
  483. <dt><code>-finit-logical=<var>&lt;true|false&gt;</var></code></dt>
  484. <dt><code>-finit-character=<var>n</var></code></dt>
  485. <dd><a name="index-finit_002dlocal_002dzero"></a>
  486. <a name="index-finit_002dderived"></a>
  487. <a name="index-finit_002dinteger"></a>
  488. <a name="index-finit_002dreal"></a>
  489. <a name="index-finit_002dlogical"></a>
  490. <a name="index-finit_002dcharacter"></a>
  491. <p>The <samp>-finit-local-zero</samp> option instructs the compiler to
  492. initialize local <code>INTEGER</code>, <code>REAL</code>, and <code>COMPLEX</code>
  493. variables to zero, <code>LOGICAL</code> variables to false, and
  494. <code>CHARACTER</code> variables to a string of null bytes. Finer-grained
  495. initialization options are provided by the
  496. <samp>-finit-integer=<var>n</var></samp>,
  497. <samp>-finit-real=<var>&lt;zero|inf|-inf|nan|snan&gt;</var></samp> (which also initializes
  498. the real and imaginary parts of local <code>COMPLEX</code> variables),
  499. <samp>-finit-logical=<var>&lt;true|false&gt;</var></samp>, and
  500. <samp>-finit-character=<var>n</var></samp> (where <var>n</var> is an ASCII character
  501. value) options. Components of derived type variables will be initialized
  502. according to these flags only with <samp>-finit-derived</samp>. These options do
  503. not initialize
  504. </p><ul>
  505. <li> allocatable arrays
  506. </li><li> variables that appear in an <code>EQUIVALENCE</code> statement.
  507. </li></ul>
  508. <p>(These limitations may be removed in future releases).
  509. </p>
  510. <p>Note that the <samp>-finit-real=nan</samp> option initializes <code>REAL</code>
  511. and <code>COMPLEX</code> variables with a quiet NaN. For a signalling NaN
  512. use <samp>-finit-real=snan</samp>; note, however, that compile-time
  513. optimizations may convert them into quiet NaN and that trapping
  514. needs to be enabled (e.g. via <samp>-ffpe-trap</samp>).
  515. </p>
  516. <p>Finally, note that enabling any of the <samp>-finit-*</samp> options will
  517. silence warnings that would have been emitted by <samp>-Wuninitialized</samp>
  518. for the affected local variables.
  519. </p>
  520. </dd>
  521. <dt><code>-falign-commons</code></dt>
  522. <dd><a name="index-falign_002dcommons"></a>
  523. <a name="index-alignment-of-COMMON-blocks-1"></a>
  524. <p>By default, <code>gfortran</code> enforces proper alignment of all variables in a
  525. <code>COMMON</code> block by padding them as needed. On certain platforms this is mandatory,
  526. on others it increases performance. If a <code>COMMON</code> block is not declared with
  527. consistent data types everywhere, this padding can cause trouble, and
  528. <samp>-fno-align-commons</samp> can be used to disable automatic alignment. The
  529. same form of this option should be used for all files that share a <code>COMMON</code> block.
  530. To avoid potential alignment issues in <code>COMMON</code> blocks, it is recommended to order
  531. objects from largest to smallest.
  532. </p>
  533. </dd>
  534. <dt><code>-fno-protect-parens</code></dt>
  535. <dd><a name="index-fno_002dprotect_002dparens"></a>
  536. <a name="index-re_002dassociation-of-parenthesized-expressions"></a>
  537. <p>By default the parentheses in expression are honored for all optimization
  538. levels such that the compiler does not do any re-association. Using
  539. <samp>-fno-protect-parens</samp> allows the compiler to reorder <code>REAL</code> and
  540. <code>COMPLEX</code> expressions to produce faster code. Note that for the re-association
  541. optimization <samp>-fno-signed-zeros</samp> and <samp>-fno-trapping-math</samp>
  542. need to be in effect. The parentheses protection is enabled by default, unless
  543. <samp>-Ofast</samp> is given.
  544. </p>
  545. </dd>
  546. <dt><code>-frealloc-lhs</code></dt>
  547. <dd><a name="index-frealloc_002dlhs"></a>
  548. <a name="index-Reallocate-the-LHS-in-assignments"></a>
  549. <p>An allocatable left-hand side of an intrinsic assignment is automatically
  550. (re)allocated if it is either unallocated or has a different shape. The
  551. option is enabled by default except when <samp>-std=f95</samp> is given. See
  552. also <samp>-Wrealloc-lhs</samp>.
  553. </p>
  554. </dd>
  555. <dt><code>-faggressive-function-elimination</code></dt>
  556. <dd><a name="index-faggressive_002dfunction_002delimination"></a>
  557. <a name="index-Elimination-of-functions-with-identical-argument-lists"></a>
  558. <p>Functions with identical argument lists are eliminated within
  559. statements, regardless of whether these functions are marked
  560. <code>PURE</code> or not. For example, in
  561. </p><div class="smallexample">
  562. <pre class="smallexample"> a = f(b,c) + f(b,c)
  563. </pre></div>
  564. <p>there will only be a single call to <code>f</code>. This option only works
  565. if <samp>-ffrontend-optimize</samp> is in effect.
  566. </p>
  567. </dd>
  568. <dt><code>-ffrontend-optimize</code></dt>
  569. <dd><a name="index-frontend_002doptimize"></a>
  570. <a name="index-Front_002dend-optimization"></a>
  571. <p>This option performs front-end optimization, based on manipulating
  572. parts the Fortran parse tree. Enabled by default by any <samp>-O</samp>
  573. option. Optimizations enabled by this option include inlining calls
  574. to <code>MATMUL</code>, elimination of identical function calls within
  575. expressions, removing unnecessary calls to <code>TRIM</code> in comparisons
  576. and assignments and replacing <code>TRIM(a)</code> with
  577. <code>a(1:LEN_TRIM(a))</code>. It can be deselected by specifying
  578. <samp>-fno-frontend-optimize</samp>.
  579. </p></dd>
  580. </dl>
  581. <p>See <a href="http://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options">Options for Code Generation Conventions</a> in <cite>Using the GNU Compiler Collection (GCC)</cite>, for information on more options
  582. offered by the GBE
  583. shared by <code>gfortran</code>, <code>gcc</code>, and other GNU compilers.
  584. </p>
  585. <hr>
  586. <div class="header">
  587. <p>
  588. Next: <a href="Environment-Variables.html#Environment-Variables" accesskey="n" rel="next">Environment Variables</a>, Previous: <a href="Runtime-Options.html#Runtime-Options" accesskey="p" rel="prev">Runtime Options</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>
  589. </div>
  590. </body>
  591. </html>