This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

gcc 2.95.2 doesn't fully zero-initialize character arrays


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 ();
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]