debug/6577: debug info of static const variables leads to undefined references
Bruno Haible
bruno@clisp.org
Mon May 6 04:26:00 GMT 2002
>Number: 6577
>Category: debug
>Synopsis: debug info of static const variables leads to undefined references
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Mon May 06 04:26:05 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Bruno Haible
>Release: 3.1 20020423 (prerelease)
>Organization:
GNU hackers
>Environment:
System: Linux linuix 2.4.18-4GB #1 Wed Mar 27 13:57:05 UTC 2002 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../configure --prefix=/packages/gnu-snapshot --enable-shared --enable-version-specific-runtime-libs --enable-nls
>Description:
For C++ variables with attributes 'static const' which can be
optimized away, the debug info that is generated leads to undefined
references.
>How-To-Repeat:
$ cat <<\EOF > foo.cc
struct cl_class {};
extern cl_class cl_class_fixnum;
extern cl_class cl_class_bignum;
static const void* const cl_I_classes_dummy[] = { &cl_I_classes_dummy,
&cl_class_fixnum
};
int main () {}
EOF
$ g++ -O2 foo.cc
; OK, no error
$ g++ -O2 -g foo.cc
/usr/bin/ld: Dwarf Error: Invalid or unhandled FORM value: 14.
/usr/bin/ld: Dwarf Error: Invalid or unhandled FORM value: 14.
/usr/bin/ld: Dwarf Error: Invalid or unhandled FORM value: 14.
/tmp/cco4BRgH.o::7: undefined reference to `cl_I_classes_dummy'
/tmp/cco4BRgH.o::7: undefined reference to `cl_class_fixnum'
collect2: ld returned 1 exit status
>Fix:
Omit the debug info for variables which are optimized away.
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list