Possible problem

Ian Nixon ian@tharas.com
Wed Oct 21 18:58:00 GMT 1998


  Please find attached a simple (at least I hope it's simple) test case
for something I've run into
with egcs. The problem details are:

Version/Machine :
Reading specs from
/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.91.57/specs
gcc version egcs-2.91.57 19980901 (egcs-1.1 release)

Problem:
    It looks like the introduction of a typedef of a template
specialization within a name space
causes someone to mess up the name generated for a function in an
(apparently) unrelated
namespace. The attached test produces the following when I run the make
file:

g++ f1.o f2.o main.o -o main
Undefined                       first referenced
 symbol                             in file
NS1::func(void)                     main.o
ld: fatal: Symbol referencing errors. No output written to main
collect2: ld returned 1 exit status
make: *** [main] Error 1

  The make works correctly if the typedef in the file f2.h is removed.
If I look at the nm output
for the f1.o with and without the typedef I see the following:

With typedef:

f1.o:

[Index]   Value      Size    Type  Bind  Other Shndx   Name

[4]     |         0|       0|SECT |LOCL |0    |2      |
[5]     |         0|       0|SECT |LOCL |0    |3      |
[3]     |         0|       0|NOTY |LOCL |0    |3      |__FRAME_BEGIN__
[1]     |         0|       0|FILE |LOCL |0    |ABS    |f1.cc
[6]     |         0|      28|FUNC |GLOB |0    |2      |func___3NS1v
[2]     |         0|       0|NOTY |LOCL |0    |2      |gcc2_compiled.


Without typedef:

f1.o:

[Index]   Value      Size    Type  Bind  Other Shndx   Name

[4]     |         0|       0|SECT |LOCL |0    |2      |
[5]     |         0|       0|SECT |LOCL |0    |3      |
[3]     |         0|       0|NOTY |LOCL |0    |3      |__FRAME_BEGIN__
[1]     |         0|       0|FILE |LOCL |0    |ABS    |f1.cc
[6]     |         0|      28|FUNC |GLOB |0    |2      |func__3NS1v
[2]     |         0|       0|NOTY |LOCL |0    |2      |gcc2_compiled.


   I see an extra '_' in the func__3NS1v name in the "wrong" version.

  I hope that's enough to go on and I apologise in a advance if this is
just some bizzare
screw-up at my end.

  Thanks
    Ian.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: B1.shar
Type: text/x-c
Size: 1317 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-bugs/attachments/19981021/876ce848/attachment.bin>


More information about the Gcc-bugs mailing list