c++/7313: variable declared but not defined with "C" linkage placed in enclosing namespace at link time

sethjschroeder@aol.com sethjschroeder@aol.com
Mon Jul 15 07:56:00 GMT 2002


>Number:         7313
>Category:       c++
>Synopsis:       variable declared but not defined with "C" linkage placed in enclosing namespace at link time
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 15 07:46:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Seth Schroeder
>Release:        Apple Computer, Inc. GCC version 1040, based on gcc version 3.1 20020105 (experimental)
>Organization:
>Environment:
seths% gcc -v
Reading specs from /usr/libexec/gcc/darwin/ppc/3.1/specs
Thread model: posix
Apple Computer, Inc. GCC version 1040, based on gcc version 3.1 20020105 (experimental)

seths% uname -a
Darwin localhost 6.0 Darwin Kernel Version 6.0: Wed May  1 01:04:14 PDT 2002; root:xnu/xnu-282.obj~4/RELEASE_PPC  Power Macintosh powerpc

OS X 10.2 beta build. Problem also occurs on release candidate build of OS.
>Description:
command line: g++ -Wall -c mismatch.cpp
compiler messages: (none)

The problem is that at link time, variables declared with "C" linkage but not defined with it are placed in the enclosing namespace, instead of the global namespace.

This does not happen with g++ 2.96 (stock rh 7.3 flavor) or HP-UX 11.22's aCC. Nor does it happen with functions.
>How-To-Repeat:
see attachment
>Fix:
Place all explicitly-namespaced variables declared with "C" linkage in global namespace at link time.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/x-gzip; name="mismatch.ii.gz"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="mismatch.ii.gz"

H4sICH3dMj0CA21pc21hdGNoLmlpAG2MQQrCMBBF9znFJ93ookLXUTeeJI0jDnQmIU2hWHp3I1hQ
6F++z3sNOljhUXwJz1NIyZrmg879xENpWa8bCFHE6x0DK23wX1QvNCYfCI8YzWJQR3OhrLA3C9aC
3me3z1+HozOr2Y18TVzQdu6HVAcLMpWppuqFtRbecOI1NdIAAAA=



More information about the Gcc-bugs mailing list