Menu

#1462 incomplete initializers for auto vars fail

closed-fixed
5
2013-05-25
2008-05-29
No

I thought this was in a bug report already, but I can't find it so I probably picked it up somewhere on some mailing list or on an internet forum.

The uninitialized parts of an auto(matic) local variable are not cleared to zero when an incomplete initializer is used. E.g.

void foo(void)
{
char x[5] = { 1, 2 };
ASSERT (x[3] == 0);
}

Regression test zeropad.c has some tests for incomplete initializers but not for auto's.

Maarten

Discussion

  • Maarten Brock

    Maarten Brock - 2008-05-29
    • milestone: --> fixed
    • status: open --> closed-fixed
     
  • Maarten Brock

    Maarten Brock - 2008-05-29

    Logged In: YES
    user_id=888171
    Originator: YES

    Ok, I filed this only for the record because I just fixed it in SDCC 2.8.1 #5186.

     
  • Patryk

    Patryk - 2008-06-02

    Logged In: YES
    user_id=1788180
    Originator: NO

    You could have noticed it here:
    Some spotted SDCC 2.6.0 '52 pitfalls
    http://www.cygnal.org/ubb/Forum10/HTML/000051.html
    Point 4 in first post.

     

Log in to post a comment.