From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29542 invoked by alias); 20 Dec 2012 19:52:59 -0000 Received: (qmail 29401 invoked by uid 48); 20 Dec 2012 19:52:32 -0000 From: "xinliangli at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/55742] __attribute__ in class function declaration cause "prototype does not match" errors. Date: Thu, 20 Dec 2012 19:52:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: xinliangli at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: CC Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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 X-SW-Source: 2012-12/txt/msg02047.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55742 davidxl changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |xinliangli at gmail dot com --- Comment #6 from davidxl 2012-12-20 19:52:32 UTC --- Since target attribute merging/conflicts handling is not well specified nor implemented, with the introduction of MV, it is a good opportunity to straighten it out and document it. MV helps providing diagnostics to detect the broken code (where the target attribute is ignored) :) David (In reply to comment #5) > (In reply to comment #4) > > On Thu, Dec 20, 2012 at 1:21 PM, tmsriram at google dot com > > wrote: > > > > > However, with function multiversioning, this will become a problem as > > > multiversioning does not treat two decls with different target attributes > > > as > > > identical. Since we are enabling multiversioning by default, atleast in > > > C++ > > > front-end for now, IMO, it is better to insist that the definition and > > > declaration contain identical target attributes. > > > > Unfortunately, we cannot do that. A lot of existing code relies on > > this attribute merging. The cleanest approach here is probably to add > > an additional 'mv' attribute to explicitly enable multiversioning. > > Breaking the existing semantics is going to break a lot of code. > > Ok, just to be clear, there are two problems here: > > 1) Target attribute merging. If the assumption that the target attributes of > the decls must be merged is valid, there is a bug. Also, this means that using > target attributes to do multiversioning is wrong. > > 2) Function multiversioning is exposing the bug, via build failures, the > problem of declarations and definitions not having identical target attributes. > > > First, we need to decide if target attribute merging is a valid assumption. If > so, we fix the bug and make function multiversioning use a new attribute. > > If the assumption is not valid, changing the source is the only solution. The > source is invalid now since the intended behaviour is not happening. > > > > > > > > Diego.