From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18546 invoked by alias); 8 Sep 2002 07:06:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 18525 invoked by uid 71); 8 Sep 2002 07:06:01 -0000 Resent-Date: 8 Sep 2002 07:06:01 -0000 Resent-Message-ID: <20020908070601.18524.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org, Andrew Suffield Resent-Reply-To: gcc-gnats@gcc.gnu.org, 159838@bugs.debian.org Received: (qmail 7116 invoked from network); 8 Sep 2002 06:57:27 -0000 Received: from unknown (HELO hirsch.in-berlin.de) (192.109.42.6) by sources.redhat.com with SMTP; 8 Sep 2002 06:57:27 -0000 Received: from gate.local (mail@dsl-213-023-043-023.arcor-ip.net [213.23.43.23]) by hirsch.in-berlin.de (8.12.1/8.12.1/Debian -2) with ESMTP id g886vNvC025265; Sun, 8 Sep 2002 08:57:23 +0200 Received: from doko by gate.local with local (Exim 3.36 #1 (Debian)) id 17nvuB-0005Cn-00; Sun, 08 Sep 2002 08:50:47 +0200 Message-Id: Date: Sun, 08 Sep 2002 00:06:00 -0000 From: Matthias Klose Reply-To: 159838@bugs.debian.org To: gcc-gnats@gcc.gnu.org, debian-gcc@lists.debian.org Cc: chris@debian.org X-Send-Pr-Version: 3.113 X-GNATS-Notify: Andrew Suffield Subject: c/7853: gcc reports multiple symbol definitions on the wrong line X-SW-Source: 2002-09/txt/msg00112.txt.bz2 List-Id: >Number: 7853 >Category: c >Synopsis: gcc reports multiple symbol definitions on the wrong line >Confidential: no >Severity: non-critical >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Sun Sep 08 00:06:00 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Andrew Suffield >Release: 3.2.1 CVS (Debian) (Debian unstable) >Organization: The Debian Project >Environment: System: Debian GNU/Linux (unstable) Architecture: i686 >Description: [ Reported to the Debian BTS as report #159838. Please CC 159838@bugs.debian.org on replies. Log of report can be found at http://bugs.debian.org/159838 ] Andrew Suffield writes: (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). >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: