On Fri, Jul 22, 2022 at 12:38:31PM +0200, Tobias Burnus wrote: > OpenMP requires: Fix diagnostic filename corner case > > The issue occurs when there is, e.g., main._omp_fn.0 in two files with > different OpenMP requires clauses. The function entries in the offload > table ends up having the same decl tree and, hence, the diagnostic showed > the same filename for both. Solution: Use the .o filename in this case. > > Note that the issue does not occur with same-named 'static' functions and > without the fatal error from the requires diagnostic, there would be > later a linker error due to having two 'main'. > > gcc/ > * lto-cgraph.cc (input_offload_tables): Improve requires diagnostic > when filenames come out identically. > > diff --git a/gcc/lto-cgraph.cc b/gcc/lto-cgraph.cc > index 062677a32eb..350195d86db 100644 > --- a/gcc/lto-cgraph.cc > +++ b/gcc/lto-cgraph.cc > @@ -1893,6 +1893,11 @@ input_offload_tables (bool do_force_output) > if (tmp_decl != NULL_TREE) > fn2 = IDENTIFIER_POINTER (DECL_NAME (tmp_decl)); > } > + if (fn1 == fn2) > + { > + fn1 = requires_fn; > + fn2 = file_data->file_name; > + }
Ugly but ok. Jakub