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

Jim Wilson <wilson at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wilson at gcc dot gnu.org

--- Comment #6 from Jim Wilson <wilson at gcc dot gnu.org> ---
The problem is in c_build_qualified_type.  It calls build_qualified_type at the
end which copies every field to create a new type, including TYPE_VFIELD.  But
this is wrong, as TYPE_VFIELD is set in the main variant type, but should not
be set in the qualified type.  To fix this, I would suggest storing the result
of build_qualify_type in a local var, and then clearing C_TYPE_INCOMPLETE_VARS
(aka TYPE_VFIELD) if this is a struct or union type.

An alternative solution would be to clear TYPE_VFIELD somewhere lower down,
such as in build_distinct_type_copy, but that would affect every front end, so
it isn't obvious if this is safe.  Fixing the problem in the C front end is
clearly a safer solution.

Reply via email to