------- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-16 
03:21 -------
Just for the record UNION TYPE is defined in tree.def as something different 
than what the Ada front-
end is using it for, From tree.def:
/* Union in C.  Like a struct, except that the offsets of the fields
   will all be zero.  */
/* See the comment above, before ENUMERAL_TYPE, for how
   forward references to union tags are handled in C.  */
DEFTREECODE (UNION_TYPE, "union_type", tcc_type, 0)     /* C union type */

The code in the Ada front-end to use unions instead of structs was introduced 
with:
2005-02-09  Eric Botcazou  <[EMAIL PROTECTED]>
            Richard Kenner  <[EMAIL PROTECTED]>

        Fix for c330001 - PR ada/19386

So this is a new bug in that the ada front-end is abusing UNION in this case

Here is the link to the patch: 
<http://gcc.gnu.org/ml/gcc-patches/2005-02/msg00424.html>.

In fact the quote "GCC assumes that a RECORD_TYPE does not have any overlapping 
fields. " is true and 
so is UNION_TYPE assumes that only one field is initialized as shown above.

I would assume this requires a large number of fixes in the Ada front-end.

(There was a C++ bug which was caused by the overlapping fields also which was 
fixed correctly).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kenner at vlsi1 dot ultra
                   |                            |dot nyu dot edu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19900

Reply via email to