https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95379

--- Comment #3 from Asher Gordon <AsDaGo at posteo dot net> ---
Thanks for the quick reply!

(In reply to Andrew Pinski from comment #1)
> Why not just use { .foo = 0 }; instead?

Well I could do that, but I feel that it doesn't convey the message of "set all
fields to zero" as well, and it's also more verbose...

> Also this attribute is model after sparse's attribute, does sparse implement
> what you are asking (https://sparse.wiki.kernel.org/index.php/Main_Page)?

It seems that Sparse's behavior is the same as GCC's. It warns on '{ 0 }'.
(Note that in Sparse, the attribute must be specified after the closing brace.)

(In reply to Andrew Pinski from comment #2)
> I suspect this will be closed as won't fix.

Personally, I don't see any reason why this shouldn't be implemented. I think
almost all cases of '{ 0 }' are intended to initialize a structure to zero, not
just set the first element to 0. And '{ 0 }' will always do the same thing no
matter what the internal arrangement of the structure is.

Reply via email to