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

--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> ---
And for the attached testcase and inside loop elf_link_add_archive_symbols for
'h = archive_symbol_lookup (…)' and the name is symdef->name:

When processing liblocoa.a:

psb_d_oacc_mlt_v_2_ → h == NULL
mpi_fortran_argv_null_ → h->type == bfd_link_hash_common
→ hook call with known_used = false;

second loop
... several with include[i] = 0 until i=10:
__psb_d_oacc_vect_mod_MOD___def_init_psb_d_oacc_vect_mod_Psb_d_vect_oacc
For all i >= 10 now include[i] = true;

Then a third loop: All remaining symbols get include[i] = true.


Thus, the 'd_inner_oacc_mlt_v_2.0._omp_fn' ends up with inluded[i] = true,
but claim_file_handler_v2 got called with known_used = false.

* * *

While the test case can be probably be simplified, it is very difficult to get
h->type == bfd_link_hash_common as first non-null entry. In my attempts to
create a very simple testcase from scratch, I ended up having always h == NULL
followed by a non-'bfd_link_hash_common' item such that the tests never failed.

Reply via email to