From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3513 invoked by alias); 3 May 2004 02:40:13 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 3502 invoked from network); 3 May 2004 02:40:12 -0000 Received: from unknown (HELO yosemite.airs.com) (209.128.65.135) by sources.redhat.com with SMTP; 3 May 2004 02:40:12 -0000 Received: (qmail 10920 invoked by uid 10); 3 May 2004 02:40:12 -0000 Received: (qmail 4921 invoked by uid 500); 3 May 2004 02:39:37 -0000 From: Ian Lance Taylor To: kenner@vlsi1.ultra.nyu.edu (Richard Kenner) Cc: ebotcazou@act-europe.fr, gcc@gcc.gnu.org Subject: Re: -fzero-initialized-in-bss again References: <10405011530.AA09902@vlsi1.ultra.nyu.edu> Date: Mon, 03 May 2004 02:40:00 -0000 In-Reply-To: <10405011530.AA09902@vlsi1.ultra.nyu.edu> Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2004-05/txt/msg00044.txt.bz2 kenner@vlsi1.ultra.nyu.edu (Richard Kenner) writes: > Let me rephrase: if the only purpose of this line is to mimic what the > C compiler does with common variables and the Ada compiler doesn't > need common variables, let's delete the line. > > So the question that would be good to answer is: does the Ada compiler > need common variables? > > I have non clue what a "common variable" might mean. A common variable has semantics which more or less follow the way FORTRAN common statements are handled. Specifically, multiple common definitions of a variable are permitted. There may be exactly zero or one non-common definition of a variable. When there are multiple common definitions and no non-common definition, the size of the variable is the size of the largest common definition. Very old C compilers used these semantics for uninitialized definitions in C. So, for example, a program which had "char a[10];" in one file and "char a[100];" in another file, with no initialized "char a[NN];" anywhere, would link without error, and "a" would wind up as a 100 byte array. Current C compilers use these semantics only for backward compatibility. Standard C doesn't actually permit doing this, although the standard describes it as a common extension. > What we are discussing is what object file section each variable > should go into. And what I'm saying is that this shouldn't depend on > whether a variable was written in C or Ada: it should only be a function > of language-independent attributes. "Common" is not an object file section in the usual sense. The "common" section is an imaginary section, along the lines of the "undefined" section (which holds all references to otherwise undefined symbols). The common section has no size or address. Putting a symbol in the "common" section implies that the symbol should have the semantics defined above. If Ada does not have variables which have semantics like those described above, then Ada should never use the common section. Regardless of whether -fcommon was specific. -fcommon is, in my opinion, really a C specific option. Ian