From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27477 invoked by alias); 9 May 2003 11:26: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 27438 invoked by uid 71); 9 May 2003 11:26:00 -0000 Date: Fri, 09 May 2003 11:26:00 -0000 Message-ID: <20030509112600.27437.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: "Joseph S. Myers" Subject: Re: c/10696: linker problem with global variable Reply-To: "Joseph S. Myers" X-SW-Source: 2003-05/txt/msg00723.txt.bz2 List-Id: The following reply was made to PR c/10696; it has been noted by GNATS. From: "Joseph S. Myers" To: ehrhardt@mathematik.uni-ulm.de, bhuang@qubit-star.com, gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org Cc: Subject: Re: c/10696: linker problem with global variable Date: Fri, 9 May 2003 12:24:44 +0100 (BST) On Fri, 9 May 2003 ehrhardt@mathematik.uni-ulm.de wrote: > Not a bug! As defined in 6.2.2 foo_global has external linkage in > both translation units, hence both identifiers refer to the same object. Actually, the multiple definitions cause undefined behavior, no diagnostic required. The reported behavior (allowing multiple definitions in different translation units, provided no more than one is initialized) is conventional on Unix. If the reporter wants a diagnostic at link time, compile with -fno-common or link with -Wl,--warn-common (if using GNU binutils). -- Joseph S. Myers jsm28@cam.ac.uk