This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/19515] [4.0 Regression] Violation of C99 6.7.8 §21 for unions
- From: "rth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Jan 2005 11:28:36 -0000
- Subject: [Bug middle-end/19515] [4.0 Regression] Violation of C99 6.7.8 §21 for unions
- References: <20050118221058.19515.ebotcazou@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19515