c/10696: linker problem with global variable
Joseph S. Myers
jsm28@cam.ac.uk
Fri May 9 12:36:00 GMT 2003
On Fri, 9 May 2003 ehrhardt@mathematik.uni-ulm.de wrote:
> Not a bug! As defined in 6.2.2 foo_global has external linkage in
> both translation units, hence both identifiers refer to the same object.
Actually, the multiple definitions cause undefined behavior, no diagnostic
required. The reported behavior (allowing multiple definitions in
different translation units, provided no more than one is initialized) is
conventional on Unix. If the reporter wants a diagnostic at link time,
compile with -fno-common or link with -Wl,--warn-common (if using GNU
binutils).
--
Joseph S. Myers
jsm28@cam.ac.uk
More information about the Gcc-bugs
mailing list