[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#159838: gcc-3.2: reports multiple symbol definitions on the wrong line



Package: gcc-3.2
Version: 1:3.2.1-0pre1
Severity: normal

(I am not sure whether this is a bug in gcc or binutils)

aps100@cyclone:~/tmp$ cat foo.c
int x = 0;

aps100@cyclone:~/tmp$ cat bar.c
int x = 0;

void foo(void) {}
aps100@cyclone:~/tmp$ gcc -shared -g -o foo.so foo.c bar.c
/tmp/cc0wTF8S.o: In function `foo':
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/home/aps100/tmp/bar.c:3: multiple definition of `x'
                       ^
/tmp/ccpK9pwb.o(.data+0x0):/home/aps100/tmp/foo.c: first defined here
collect2: ld returned 1 exit status
aps100@cyclone:~/tmp$ gcc-3.2 -shared -g -o foo.so foo.c bar.c
/tmp/ccBwlA8f.o: In function `foo':
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/home/aps100/tmp/bar.c:3: multiple definition of `x'
                       ^
/tmp/cckwx9Kb.o(.data+0x0): first defined here
collect2: ld returned 1 exit status

Note the indicated parts. Function 'foo' has got nothing to do with
the problem, and that's the wrong place to be highlighting the error.

More generally, it appears that symbol conflicts in the global scope
will always be reported as being in the first function in the
compilation unit (not thoroughly tested, but that's what I
noticed). This means the error message might not even be pointing at
the correct file, let alone the right line.

(Needless to say, this is quite irritating).

-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux cyclone 2.4.19 #7 Sat Aug 3 16:06:09 BST 2002 i686
Locale: LANG=C, LC_CTYPE=C

Versions of packages gcc-3.2 depends on:
ii  binutils                   2.13.90.0.4-1 The GNU assembler, linker and bina
ii  cpp-3.2                    1:3.2.1-0pre1 The GNU C preprocessor.
ii  gcc-3.2-base               1:3.2.1-0pre1 The GNU Compiler Collection (base 
ii  libc6                      2.2.5-14      GNU C Library: Shared libraries an
ii  libgcc1                    1:3.2.1-0pre1 GCC support library.

-- no debconf information


-- 
  .''`.  ** Debian GNU/Linux ** | Andrew Suffield
 : :' :  http://www.debian.org/ | Dept. of Computing,
 `. `'                          | Imperial College,
   `-             -><-          | London, UK



Reply to: