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

            Bug ID: 105076
           Summary: [OpenMP] Weak/template functions: split-off
                    offload-region functions should also be weak
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: missed-optimization, openmp
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

When using something like

template<T>
void foo(T var)
{
  #pragma omp target ...
    ...
}

the function 'foo' is weak – but its associated offload function isn't.

Result: While at the end only one 'foo' function remains, there will be as many
offload function as 'foo'-using translation units.

Expected: Also the split off target-regions should be a weak symbol.

NOTE: Requires a consistent naming of the offload functions, but I think that's
already guaranteed by create_omp_child_function_name (invoked from
create_omp_child_function_name).

Existing testcase:
  'test_map' in libgomp/testsuite/libgomp.c++/target-same-name-2.C
   of PR104285 / r12-7776-g1002a7ace11
   (checks only for link/run-time errors and not for how many offload functions
remain)

Reply via email to