public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/100318] New: [OpenMP] Offloading with two identically named static functions fails
@ 2021-04-28 14:38 burnus at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: burnus at gcc dot gnu.org @ 2021-04-28 14:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100318
           Summary: [OpenMP] Offloading with two identically named static
                    functions fails
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: openmp
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

Based on
https://github.com/clang-ykt/omptests/tree/master/t-same-name-definitions

g++ -fopenmp A.cpp B.cpp

The problem for the example below is that the function 'fAB2' exists in both
translation units.  (The linked testcase tries the same also with global
variables, templates etc.)

With nvptx, the program fails with:
  lto1: fatal error: a-A.o: section _ZL4fAB2v$_omp_fn$0.3 is missing
where lto1 == nvptx-none/lto1  and   "_ZL4fAB2v" = "fAB2()".

It does compile with GCN offloading, which produces:
  _ZL4fAB2v._omp_fn.0.lto_priv.0
  _ZL4fAB2v._omp_fn.0.lto_priv.1
on the GCN side.

However, it does not seem to find the function name at runtime - such that
always the host version is executed. 


------ A.cpp --------------
int b ();

static int
fAB2 ()
{
  int i = 0;
  #pragma omp target map(tofrom: i)
    i = 42;
  return i;
}

int
a ()
{
  int res = fAB2 ();
  return res;
}

int main()
{
  if (a () != 42)
    __builtin_abort ();
  if (b () != 5)
    __builtin_abort ();
  return 0;
}
------ B.cpp --------------
static int
fAB2 ()
{
  int j = 0;
  #pragma omp target map(tofrom: j)
    j = 5;
  return j;
}

int
b ()
{
  return fAB2 ();
}

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

only message in thread, other threads:[~2021-04-28 14:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-28 14:38 [Bug middle-end/100318] New: [OpenMP] Offloading with two identically named static functions fails burnus at gcc dot gnu.org

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