aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/linear/struct-init-full.c
AgeCommit message (Collapse)AuthorFilesLines
2017-05-19fix implicit zero initializer.Luc Van Oostenryck1-0/+28
The C standard requires that, when initializing an aggregate, all fieds not explicitly initialized shall be implicity zero-initialized (more exactly "the same as objects that have static storage duration" [6.7.9.21]). Until now sparse didn't did this. Fix this (when an initializer is present and the object not a scalar) by first storing zeroes in the whole object before doing the initialization of each fields explicitly initialized. Note 1: this patch initialize the *whole* aggregate while the standard only requires that existing fields are initialized. Thanks to Linus to notice this. Note 2: this implicit initialization is not needed if all fields are explicitly initialized but is done anyway, for the moment. Note 3: the code simplify nicely when there is a single field that is initialized, much less so when there is several ones. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>