From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 52301 invoked by alias); 28 Sep 2015 21:39:59 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 52214 invoked by uid 48); 28 Sep 2015 21:39:54 -0000 From: "wilson at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/66068] [6 Regression] error: type variant has different TYPE_VFIELD Date: Mon, 28 Sep 2015 21:39:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: debug X-Bugzilla-Version: 6.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: wilson at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 6.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-09/txt/msg02235.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66068 Jim Wilson changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wilson at gcc dot gnu.org --- Comment #6 from Jim Wilson --- 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.