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

            Bug ID: 106686
           Summary: [lto][offloading] lto-wrapper leaves "target.o"
                    temporay files behind when error diagnostic occurred
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

I found a couple of /tmp/ccGARvpn.target.o files - which are surely unintended
leftovers.

The filename is returned by lto-wrapper.cc's compile_offload_image and then
collected in
  offload_names[next_name_entry] = compile_offload_image (...)
and processed as
      if (offload_names)
        {
          find_crtoffloadtable (save_temps, dumppfx);
          for (i = 0; offload_names[i]; i++)
            printf ("%s\n", offload_names[i]);

That seems to work well if not error occurred - but if there was an error, it
seems to be the only file suffix which is not cleaned up.


Reproducer:
- You need a GCC configured for offload (nvptx, gcn or intelmic)
- You need to get it to fail.

On mainline, one way is to compile the following with offloading: 'gcc -fopenmp
*.c'
which outputs:
  lto1: error: OpenMP 'requires' directive with 'unified_shared_memory'
specified only in some compilation units
  lto1: fatal error: errors during merging of translation units

Input:
------- 1.c ----------
#pragma omp requires unified_shared_memory
int i;
void foo() {
  #pragma omp target enter data map(to:i)
}

------- 2.c ----------
int j;
void foo() {
  #pragma omp target enter data map(to:j)
}

Reply via email to