#2167 Implicit zero in initialization omitted

open
nobody
None
Front-end
5
2013-05-25
2013-05-23
No

Initialization by zero in sdcc is quite broken anyway, but this aspect does not seem to have a bug report yet:

When using designators, according to the standard, all elements not explicitly mentioned should be initialized to zero ("all subobjects that are not initialized explicitly shall be initialized implicitly the same as objects that have static storage duration.").

e.g. in

struct A { int i; int j; int k; int l; };
struct B { struct A a; int r[1]; };

void
f (void)
{
struct A a = { .j = 5 };

sdcc initializes b.a.j to 5, and leaves everything the otehr memebrs of b.a uninitialized, but the standard requires them to be zeroed.

Philipp

P.S.: The above example istaken from regression test gcc-torture-execute-20050613-1.c.

Related

Bugs: #1967
Bugs: #2103

Discussion