Hi! On 2022-07-01T23:08:16+0200, Tobias Burnus wrote: > Updated version attached – I hope I got everything right, but I start to > get tired, I am not 100% sure. ..., and so the obligatory copy'n'past-o ;-) crept in: > --- a/gcc/lto-cgraph.cc > +++ b/gcc/lto-cgraph.cc > @@ -1773,6 +1804,10 @@ input_offload_tables (bool do_force_output) > struct lto_file_decl_data **file_data_vec = lto_get_file_decl_data (); > struct lto_file_decl_data *file_data; > unsigned int j = 0; > + const char *requires_fn = NULL; > + tree requires_decl = NULL_TREE; > + > + omp_requires_mask = (omp_requires) 0; > > while ((file_data = file_data_vec[j++])) > { > @@ -1784,6 +1819,7 @@ input_offload_tables (bool do_force_output) > if (!ib) > continue; > > + tree tmp_decl = NULL_TREE; > enum LTO_symtab_tags tag > = streamer_read_enum (ib, LTO_symtab_tags, LTO_symtab_last_tag); > while (tag) > @@ -1799,6 +1835,7 @@ input_offload_tables (bool do_force_output) > LTO mode. */ > if (do_force_output) > cgraph_node::get (fn_decl)->mark_force_output (); > + tmp_decl = fn_decl; > } > else if (tag == LTO_symtab_variable) > { > @@ -1810,6 +1847,72 @@ input_offload_tables (bool do_force_output) > may be no refs to var_decl in offload LTO mode. */ > if (do_force_output) > varpool_node::get (var_decl)->force_output = 1; > + tmp_decl = var_decl; > + } > + else if (tag == LTO_symtab_edge) > + { > + static bool error_emitted = false; > + HOST_WIDE_INT val = streamer_read_hwi (ib); > + > + if (omp_requires_mask == 0) > + { > + omp_requires_mask = (omp_requires) val; > + requires_decl = tmp_decl; > + requires_fn = file_data->file_name; > + } > + else if (omp_requires_mask != val && !error_emitted) > + { > + const char *fn1 = requires_fn; > + if (requires_decl != NULL_TREE) > + { > + while (DECL_CONTEXT (requires_decl) != NULL_TREE > + && TREE_CODE (requires_decl) != TRANSLATION_UNIT_DECL) > + requires_decl = DECL_CONTEXT (requires_decl); > + if (requires_decl != NULL_TREE) > + fn1 = IDENTIFIER_POINTER (DECL_NAME (requires_decl)); > + } > + > + const char *fn2 = file_data->file_name; > + if (tmp_decl != NULL_TREE) > + { > + while (DECL_CONTEXT (tmp_decl) != NULL_TREE > + && TREE_CODE (tmp_decl) != TRANSLATION_UNIT_DECL) > + tmp_decl = DECL_CONTEXT (tmp_decl); > + if (tmp_decl != NULL_TREE) > + fn2 = IDENTIFIER_POINTER (DECL_NAME (requires_decl)); > + } ... here: tmp_decl' not 'requires_decl'. OK to push the attached "Fix one issue in OpenMP 'requires' directive diagnostics"? I'd even push that one "as obvious", but thought I'd ask whether you maybe have a quick idea about the XFAILs that I'm adding? (I'm otherwise not planning on resolving that issue at this time.) > + > + char buf1[sizeof ("unified_address, unified_shared_memory, " > + "reverse_offload")]; > + char buf2[sizeof ("unified_address, unified_shared_memory, " > + "reverse_offload")]; > + omp_requires_to_name (buf2, sizeof (buf2), > + val != OMP_REQUIRES_TARGET_USED > + ? val > + : (HOST_WIDE_INT) omp_requires_mask); > + if (val != OMP_REQUIRES_TARGET_USED > + && omp_requires_mask != OMP_REQUIRES_TARGET_USED) > + { > + omp_requires_to_name (buf1, sizeof (buf1), > + omp_requires_mask); > + error ("OpenMP % directive with non-identical " > + "clauses in multiple compilation units: %qs vs. " > + "%qs", buf1, buf2); > + inform (UNKNOWN_LOCATION, "%qs has %qs", fn1, buf1); > + inform (UNKNOWN_LOCATION, "%qs has %qs", fn2, buf2); > + } > + else > + { > + error ("OpenMP % directive with %qs specified " > + "only in some compilation units", buf2); > + inform (UNKNOWN_LOCATION, "%qs has %qs", > + val != OMP_REQUIRES_TARGET_USED ? fn2 : fn1, > + buf2); > + inform (UNKNOWN_LOCATION, "but %qs has not", > + val != OMP_REQUIRES_TARGET_USED ? fn1 : fn2); > + } > + error_emitted = true; > + } > } > else > fatal_error (input_location, Grüße Thomas ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955