Commit c47c7215 by Sandra Loosemore Committed by Sandra Loosemore

re PR c/37998 (Unclear documentation of -fno-common)

2016-11-10  Sandra Loosemore  <sandra@codesourcery.com>

	PR c/37998

	gcc/
	* doc/invoke.texi (Code Gen Options) [-fno-common]: Use correct
	terminology.  Expand to remove ambiguity.

From-SVN: r242062
parent 980f9a0a
2016-11-10 Sandra Loosemore <sandra@codesourcery.com>
PR c/37998
* doc/invoke.texi (Code Gen Options) [-fno-common]: Use correct
terminology. Expand to remove ambiguity.
2016-11-10 Segher Boessenkool <segher@kernel.crashing.org> 2016-11-10 Segher Boessenkool <segher@kernel.crashing.org>
PR rtl-optimization/78232 PR rtl-optimization/78232
...@@ -11968,25 +11968,32 @@ Use it to conform to a non-default application binary interface. ...@@ -11968,25 +11968,32 @@ Use it to conform to a non-default application binary interface.
@item -fno-common @item -fno-common
@opindex fno-common @opindex fno-common
In C code, controls the placement of uninitialized global variables. @cindex tentative definitions
Unix C compilers have traditionally permitted multiple definitions of In C code, this option controls the placement of global variables
such variables in different compilation units by placing the variables defined without an initializer, known as @dfn{tentative definitions}
in a common block. in the C standard. Tentative definitions are distinct from declarations
This is the behavior specified by @option{-fcommon}, and is the default of a variable with the @code{extern} keyword, which do not allocate storage.
for GCC on most targets.
On the other hand, this behavior is not required by ISO C, and on some Unix C compilers have traditionally allocated storage for
targets may carry a speed or code size penalty on variable references. uninitialized global variables in a common block. This allows the
The @option{-fno-common} option specifies that the compiler should place linker to resolve all tentative definitions of the same variable
uninitialized global variables in the data section of the object file, in different compilation units to the same object, or to a non-tentative
rather than generating them as common blocks. definition.
This has the effect that if the same variable is declared This is the behavior specified by @option{-fcommon}, and is the default for
(without @code{extern}) in two different compilations, GCC on most targets.
you get a multiple-definition error when you link them. On the other hand, this behavior is not required by ISO
In this case, you must compile with @option{-fcommon} instead. C, and on some targets may carry a speed or code size penalty on
variable references.
The @option{-fno-common} option specifies that the compiler should instead
place uninitialized global variables in the data section of the object file.
This inhibits the merging of tentative definitions by the linker so
you get a multiple-definition error if the same
variable is defined in more than one compilation unit.
Compiling with @option{-fno-common} is useful on targets for which Compiling with @option{-fno-common} is useful on targets for which
it provides better performance, or if you wish to verify that the it provides better performance, or if you wish to verify that the
program will work on other systems that always treat uninitialized program will work on other systems that always treat uninitialized
variable declarations this way. variable definitions this way.
@item -fno-ident @item -fno-ident
@opindex fno-ident @opindex fno-ident
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment