[Bug c++/55742] __attribute__ in class function declaration cause "prototype does not match" errors.

xinliangli at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Dec 20 19:52:00 GMT 2012


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

davidxl <xinliangli at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |xinliangli at gmail dot com

--- Comment #6 from davidxl <xinliangli at gmail dot com> 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
> > <gcc-bugzilla@gcc.gnu.org> 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.



More information about the Gcc-bugs mailing list