This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c/128: Re: gcc 2.95.2 doesn't fully zero-initialize character arrays
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c/128: Re: gcc 2.95.2 doesn't fully zero-initialize character arrays
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Thu, 23 Mar 2000 09:52:22 +0100
- References: <38D9A9FE.2699231C@roguewave.com>
- Resent-Cc: gcc-prs at gcc dot gnu dot org, sebor at roguewave dot com
- Resent-Reply-To: gcc-gnats@gcc.gnu.org, "Martin v. Loewis" <martin@loewis.home.cs.tu-berlin.de>
>Number: 128
>Category: c
>Synopsis: gcc 2.95.2 doesn't fully zero-initialize character arrays
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: analyzed
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Thu Mar 23 01:06:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator: Martin Sebor <sebor@roguewave.com>
>Release: 2.95.2
>Organization:
>Environment:
>Description:
Original-Message-ID: <38D9A9FE.2699231C@roguewave.com>
Date: Wed, 22 Mar 2000 22:22:06 -0700
Hi,
gcc doesn't zero out explicitly uninitialized elements of a character array
(required by 6.7.8, p21 of C99 - this seems to be a change from C89).
Regards
Martin
PS This is not a bug report since C99 wasn't ratified until the end of '99.
Test case: on i86 when built with no compiler options the program returns 1, 0
is expected.
int foo ()
{
char s[2] = "";
return 0 == s[1];
}
int main ()
{
{ // dirty up the stack
char s[] = "x";
}
return !foo ();
}
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: