public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "xinliangli at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/55742] [4.8 regression] __attribute__ in class function declaration cause "prototype does not match" errors.
Date: Fri, 18 Jan 2013 17:28:00 -0000	[thread overview]
Message-ID: <bug-55742-4-8Wz0opSiHc@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-55742-4@http.gcc.gnu.org/bugzilla/>


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

--- Comment #34 from davidxl <xinliangli at gmail dot com> 2013-01-18 17:27:43 UTC ---

The patch is missing changes in documentation on the new attribute.

David


(In reply to comment #32)
> Created attachment 29207 [details]
> gcc48-pr55742.patch
> 
> This bug is open for way too long given its severity, so let's start talking
> over patches.
> 
> This patch attempts to implement what I understand from Jason's comments, just
> with "default" instead of "any", because it is indeed the default target
> attribute (whatever you specify on the command line).
> 
> Say on:
> void foo ();
> void foo () __attribute__((target ("avx")));
> void foo () __attribute__((target ("default")));
> __attribute__((target ("default"))) void foo ()
> {
> }
> __attribute__((target ("avx"))) void foo ()
> {
> }
> void (*fn) () = foo;
> 
> first we merge the first two decls, because only if target attribute is present
> on both, we consider it for multi-versioning, for compatibility with 4.7 and
> older.  On e.g.
> void foo ();
> void foo () __attribute__((target ("sse4")));
> void foo () __attribute__((target ("default")));
> void foo ()
> {
> }
> we reject the last fn definition, because at that point foo is already known to
> be multi-versioned, thus it is required that target attribute is specified for
> foo (either "default", or some other).  Unfortunately, for this case the error
> is reported twice for some reason.
> 
> The #c0 testcase now compiles.
> 
> Now, the issues I discovered with multiversioning, still unfixed by the patch:
> 1) the mv*.C testcases should be moved, probably to g++.dg/ext/mv*.C
> 2) can you please explain the mess in handle_target_attribute?
>   /* Do not strip invalid target attributes for targets which support function
>      multiversioning as the target string is used to determine versioned
>      functions.  */
>   else if (! targetm.target_option.valid_attribute_p (*node, name, args,
>                                                       flags)
>            && ! targetm.target_option.supports_function_versions ())
>     *no_add_attrs = true;
> Why do you need that?  Consider complete garbage in target attribute arguments,
> which is errored about, but the above for i386/x86_64 keeps the target
> attribute around anyway, leading to lots of ICEs everywhere:
> Consider e.g.:
> __attribute__((target ("default"))) void foo (void)
> {
> }
> __attribute__((target (128))) void foo (void)
> {
> }
> 3) the multiversioning code assumes that target has a single argument, but it
> can have more than one.  Say for:
> __attribute__((target ("avx,popcnt"))) void foo (void)
> {
> }
> __attribute__((target ("popcnt","avx"))) void bar (void)
> {
> }
> the compiler handles those two as equivalent, but with -Dbar=foo
> multi-versioning only considers the first string out of that.


  parent reply	other threads:[~2013-01-18 17:28 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-19 16:46 [Bug c++/55742] New: " dnovillo at gcc dot gnu.org
2012-12-19 23:30 ` [Bug c++/55742] " tmsriram at google dot com
2012-12-20 18:00 ` dnovillo at gcc dot gnu.org
2012-12-20 18:21 ` tmsriram at google dot com
2012-12-20 18:24 ` dnovillo at google dot com
2012-12-20 19:37 ` tmsriram at google dot com
2012-12-20 19:52 ` xinliangli at gmail dot com
2013-01-10 22:10 ` tmsriram at google dot com
2013-01-14 14:33 ` [Bug c++/55742] [4.8 regression] " jason at gcc dot gnu.org
2013-01-14 14:35 ` rguenth at gcc dot gnu.org
2013-01-14 14:38 ` rguenth at gcc dot gnu.org
2013-01-14 15:14 ` jakub at gcc dot gnu.org
2013-01-14 17:17 ` xinliangli at gmail dot com
2013-01-14 17:21 ` xinliangli at gmail dot com
2013-01-14 17:46 ` tmsriram at google dot com
2013-01-14 17:50 ` xinliangli at gmail dot com
2013-01-14 18:07 ` tmsriram at google dot com
2013-01-14 18:26 ` jakub at gcc dot gnu.org
2013-01-14 18:33 ` jakub at gcc dot gnu.org
2013-01-14 20:18 ` xinliangli at gmail dot com
2013-01-14 20:24 ` jakub at gcc dot gnu.org
2013-01-14 20:30 ` xinliangli at gmail dot com
2013-01-15 18:45 ` jason at gcc dot gnu.org
2013-01-15 19:03 ` xinliangli at gmail dot com
2013-01-16  8:12 ` jakub at gcc dot gnu.org
2013-01-16 15:54 ` jason at gcc dot gnu.org
2013-01-16 16:03 ` jakub at gcc dot gnu.org
2013-01-16 16:06 ` richard.guenther at gmail dot com
2013-01-16 17:21 ` tmsriram at google dot com
2013-01-16 17:26 ` tmsriram at google dot com
2013-01-16 20:04 ` jason at gcc dot gnu.org
2013-01-17 22:45 ` xinliangli at gmail dot com
2013-01-18  9:49 ` richard.guenther at gmail dot com
2013-01-18 14:19 ` jakub at gcc dot gnu.org
2013-01-18 16:59 ` jason at gcc dot gnu.org
2013-01-18 17:28 ` xinliangli at gmail dot com [this message]
2013-01-18 17:52 ` jakub at gcc dot gnu.org
2013-01-18 18:03 ` tmsriram at google dot com
2013-01-18 18:08 ` tmsriram at google dot com
2013-01-18 19:53 ` tmsriram at google dot com
2013-01-19 10:14 ` jakub at gcc dot gnu.org
2013-01-19 10:28 ` jakub at gcc dot gnu.org
2013-01-19 17:18 ` tmsriram at google dot com
2013-01-21 11:41 ` jakub at gcc dot gnu.org
2013-01-23 16:39 ` jakub at gcc dot gnu.org
2013-01-30 18:05 ` jakub at gcc dot gnu.org
2013-01-30 18:18 ` jakub at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-55742-4-8Wz0opSiHc@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).