[Bug middle-end/19515] [4.0 Regression] Violation of C99 6.7.8 §21 for unions

rth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Jan 20 11:28:00 GMT 2005

------- Additional Comments From rth at gcc dot gnu dot org  2005-01-20 11:28 -------
(In reply to comment #7)
> So we cannot use count_type_elements in gimplify_init_constructor. 

Well, not for unions anyway.

> I think we should somehow compute the size of the CONSTRUCTOR and compare 
> it with int_size_in_bytes (TREE_TYPE (object))...? 

For unions, that may be what we have to do.  With any luck, the element
being initialized will be the largest element of the union, which would
mean we wouldn't have to emit the clear.

For structures, this would mean that any structure with holes would get
cleared.  Which would clearly pessimize a very common case.



More information about the Gcc-bugs mailing list