jfb added a comment.

In D61280#1485115 <https://reviews.llvm.org/D61280#1485115>, @rjmccall wrote:

> I don't think the implication is supposed to be that padding is 
> zero-initialized or not depending on where in the aggregate it appears, but 
> it doesn't really matter, I don't think we're arguing about the goal of this 
> patch.


The way I read it, C guarantees that an aggregate's padding is zero-initialized 
when you use brace-enclosed list *unless* you've mentioned all the elements / 
members of the aggregate. Fail to mention one → padding must be zero. Mention 
all of them → padding isn't guaranteed.

But then *reading* padding is another story. What triggered this change is C 
code that used `memcmp` on a struct with padding, and was expecting padding to 
be set. Not great code, but AFAICT technically correct.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61280/new/

https://reviews.llvm.org/D61280



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to