public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/65011] New: misleading error message for target attribute
@ 2015-02-11  1:55 drepper.fsp+rhbz at gmail dot com
  0 siblings, 0 replies; only message in thread
From: drepper.fsp+rhbz at gmail dot com @ 2015-02-11  1:55 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65011
           Summary: misleading error message for target attribute
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: drepper.fsp+rhbz at gmail dot com

The target attribute named "default" is handled special and this causes a
problem in error reporting.  If I have code like this:

__attribute__((target("sse2","avx2")))
void foo(double *__restrict r, const double *__restrict a, const double
*__restrict b, double f)
{
  for (unsigned i = 0; i < 128; ++i)
    r[i] = a[i] * f + b[i];
}

the compiler doesn't complain even though it ignores one of the parameters of
the target attribute.  That's a question for another day.

The problem is that replacing one of the strings with "default" causes a
problem:

$ cat u.cc
__attribute__((target("default","avx2")))
void foo(double *__restrict r, const double *__restrict a, const double
*__restrict b, double f)
{
  for (unsigned i = 0; i < 128; ++i)
    r[i] = a[i] * f + b[i];
}
$ local-gcc -c -O3 u.cc
u.cc:10:96: error: attribute(target("default")) is unknown
 void foo(double *__restrict r, const double *__restrict a, const double
*__restrict b, double f)
                                                                               
                ^

Of course "default" is known.  But it is not parsed in
ix86_valid_target_attribute_inner_p.  It seems (haven't verified it) that the
caller checks for "default" being the entire string and if this is not the case
defers parsing to ix86_valid_target_attribute_inner_p.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-02-11  1:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-11  1:55 [Bug c++/65011] New: misleading error message for target attribute drepper.fsp+rhbz at gmail dot com

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).