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

            Bug ID: 81761
           Summary: assembler error on __func__ et al. on attribute target
                    overloads
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

Using the assert() macro or the __func__ special identifier in two or more
overloads of a function that differ only in their attribute target
specification leads to assembler errors caused by the identifiers not being
sufficiently differentiated from one another.  The test case below shows the
problem on x86_64 but the same issue is likely to affect the powerpc64 back
end.

$ cat a.c && gcc -Wall -Wextra -xc++ a.c && ./a.out 
#include <assert.h>

#define A "arch=silvermont"

void __attribute__ ((target ("default")))
foo ()
{
  assert (!__builtin_cpu_is ("silvermont"));
}

void __attribute__ ((target (A)))
foo ()
{
  assert (__builtin_cpu_is ("silvermont"));
}

/tmp/ccX8mC6W.s: Assembler messages:
/tmp/ccX8mC6W.s:82: Error: symbol `_ZZ3foovE19__PRETTY_FUNCTION__' is already
defined

Reply via email to