Menu

#2327 Uninitialized fileds in local struct variables

closed-duplicate
nobody
None
Front-end
5
2014-12-23
2014-12-02
Ben Shi
No

With the following c code,

typedef struct {
char a;
char b;
char c;
} sss;

void dump(void *p);

void ddd()
{
sss s = {.b = 'B'};
dump(&s);
}

the field .c is initialized to zero, but .a remains random value.

Please refer to the attachment for details.

1 Attachments

Discussion

  • Ben Shi

    Ben Shi - 2014-12-23
    • status: open --> closed-duplicate
     
  • Ben Shi

    Ben Shi - 2014-12-23

    duplicated to bug #2167.

     

Log in to post a comment.