https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116478
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hubicka at gcc dot gnu.org Last reconfirmed| |2024-08-25 Component|lto |ipa Status|UNCONFIRMED |NEW Keywords| |diagnostic, lto, wrong-code Ever confirmed|0 |1 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- We emit the diagnostic from both i386_pe_assemble_visibility and default_assemble_visibility (if !HAVE_GAS_HIDDEN). I suspect that what happens is that LTO demotes 'a' to be local thus 'default' now has an effect. Testing on x86-64 with -flto-partition=1to1 shows a/0 (a) Type: function definition analyzed Visibility: force_output semantic_interposition no_reorder prevailing_def_ironly note the missing externally_visible. It's LTRANS unit then has a/0 (a) Type: function definition analyzed Visibility: used_from_other_partition force_output no_reorder prevailing_def_ironly public visibility_specified visibility:hidden and we seem to ignore the 'default' visibility attribute on it. I do not have any access to a mingw toolchain to see how we arrive at a diagnostic there but adding -fdump-ipa-all-details -save-temps should get you .000i.graph and 081i.whole-program dumps you can cross-check this against the above. I think the desired behavior (on x86-64 as well) is to have 'a' have default visibility in the output, not hidden as it currently happens on x86-64-linux. When processing a visibility attribute we adjust DECL_VISIBILITY and DECL_VISIBILITY_SPECIFIED but we also add the attribute because /* Go ahead and attach the attribute to the node as well. This is needed so we can determine whether we have VISIBILITY_DEFAULT because the visibility was not specified, or because it was explicitly overridden from the containing scope. */ (it seems that DECL_VISIBILITY_SPECIFIED could be used for this) Honza?