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

Bug#228506: marked as done (gcc-3.3: initalizing to zero equals uninitialised)



Your message dated Mon, 19 Jan 2004 16:19:43 +0100
with message-id <20040119151943.GA5604@astrid.mathiasson.nu>
and subject line gcc-3.3: initalizing to zero equals uninitialised
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 19 Jan 2004 12:49:56 +0000
>From peter@mathiasson.nu Mon Jan 19 04:49:56 2004
Return-path: <peter@mathiasson.nu>
Received: from general.brannstrom.se [217.8.32.232] 
	by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1AiYqq-0004WE-00; Mon, 19 Jan 2004 04:49:56 -0800
Received: from [217.8.42.17] (helo=astrid.brannstrom.se)
	by general.brannstrom.se with asmtp (Exim 3.33 #1 (Debian))
	id 1AiYqK-0001o0-00; Mon, 19 Jan 2004 13:49:24 +0100
Received: from pm by astrid.brannstrom.se with local (Exim 3.35 #1 (Debian))
	id 1AiYqJ-0000oB-00; Mon, 19 Jan 2004 13:49:23 +0100
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
From: Peter Mathiasson <peterm@debian.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: gcc-3.3: initalizing to zero equals uninitialised
X-Mailer: reportbug 2.36
Date: Mon, 19 Jan 2004 13:49:22 +0100
Message-Id: <[🔎] E1AiYqJ-0000oB-00@astrid.brannstrom.se>
Delivered-To: submit@bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2004_01_14 
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-5.0 required=4.0 tests=HAS_PACKAGE autolearn=no 
	version=2.60-bugs.debian.org_2004_01_14
X-Spam-Level: 

Package: gcc-3.3
Version: 1:3.3.3-0pre2
Severity: important

If I have a static variable initialized to 0 it ends up as uninitialized.
See below. Compiling this with gcc-3.2 yields a correct result.

$ cat test.c
#include <stdio.h>
int main(void) {
    static int a;
    static int b = 0;
    static int c = 7;
    printf("a: %d, b: %d, c: %d\n", a, b, c);
}

$ gcc --version
gcc (GCC) 3.3.3 20040110 (prerelease) (Debian)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gcc -S test.c

$ cat test.s
[...]
[static int a gets initialized, this one is uninitialized]
    .local  a.0
    .comm   a.0,4,4
[static int b gets initialized, this one is also uninitialized]
    .local  b.1
    .comm   b.1,4,4
[static int c is placed in .data-section and initialized to 7]
    .data
    .align 4
    .type   c.2, @object
    .size   c.2, 4
c.2:
    .long   7
[...]


Compiling with gcc-3.2 gives an initialization of b as follows:
    .data
    .align 4
    .type   b.1,@object
    .size   b.1,4
b.1:
    .long   0



-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux astrid 2.4.20-3-686 #1 Sat Jun 7 22:34:55 EST 2003 i686
Locale: LANG=C, LC_CTYPE=sv_SE

Versions of packages gcc-3.3 depends on:
ii  binutils                   2.14.90.0.7-3 The GNU assembler, linker and bina
ii  cpp-3.3                    1:3.3.3-0pre2 The GNU C preprocessor
ii  gcc-3.3-base               1:3.3.3-0pre2 The GNU Compiler Collection (base 
ii  libc6                      2.3.2.ds1-10  GNU C Library: Shared libraries an
ii  libgcc1                    1:3.3.3-0pre2 GCC support library

-- no debconf information


---------------------------------------
Received: (at 228506-done) by bugs.debian.org; 19 Jan 2004 15:20:17 +0000
>From peterm@debian.org Mon Jan 19 07:20:17 2004
Return-path: <peterm@debian.org>
Received: from general.brannstrom.se [217.8.32.232] 
	by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1AibCL-0003EV-00; Mon, 19 Jan 2004 07:20:17 -0800
Received: from [217.8.42.17] (helo=astrid.brannstrom.se)
	by general.brannstrom.se with asmtp (Exim 3.33 #1 (Debian))
	id 1AibBo-0001zr-00
	for <228506-done@bugs.debian.org>; Mon, 19 Jan 2004 16:19:44 +0100
Received: from pm by astrid.brannstrom.se with local (Exim 3.35 #1 (Debian))
	id 1AibBn-0001V2-00
	for <228506-done@bugs.debian.org>; Mon, 19 Jan 2004 16:19:43 +0100
Date: Mon, 19 Jan 2004 16:19:43 +0100
From: Peter Mathiasson <peterm@debian.org>
To: 228506-done@bugs.debian.org
Subject: Re: gcc-3.3: initalizing to zero equals uninitialised
Message-ID: <20040119151943.GA5604@astrid.mathiasson.nu>
References: <[🔎] E1AiYqJ-0000oB-00@astrid.brannstrom.se>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <[🔎] E1AiYqJ-0000oB-00@astrid.brannstrom.se>
User-Agent: Mutt/1.5.4i
Delivered-To: 228506-done@bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2004_01_14 
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=0.0 required=4.0 tests=none autolearn=no 
	version=2.60-bugs.debian.org_2004_01_14
X-Spam-Level: 

On Mon, Jan 19, 2004 at 01:49:22PM +0100, Peter Mathiasson wrote:
> If I have a static variable initialized to 0 it ends up as uninitialized.
> See below. Compiling this with gcc-3.2 yields a correct result.

Further reading leads me to realise that the .bss-section is supposed to
be zero-initialized. I've always thought of .bss as a non-initialized
section (and that's how it's documentented in numerous places).

-- 
Peter Mathiasson, peter at mathiasson dot nu, http://www.mathiasson.nu
GPG Fingerprint: A9A7 F8F6 9821 F415 B066 77F1 7FF5 C2E6 7BF2 F228



Reply to: