[Bug c++/107597] LTO causes static inline variables to get a non-uniqued global symbol

hubicka at ucw dot cz gcc-bugzilla@gcc.gnu.org
Fri Nov 11 17:42:38 GMT 2022


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

--- Comment #2 from Jan Hubicka <hubicka at ucw dot cz> ---
Hi,
What happens is that we read the symbol as:
  Visibility: externally_visible semantic_interposition
prevailing_def_ironly_exp public weak comdat comdat_group:_ZN12NonTemplated1xE
one_only
While in visibility pass we promote it to:
  Visibility: externally_visible semantic_interposition
prevailing_def_ironly_exp public comdat
So we disolve comdat group and turn off weak. This leads to better code
generation and we know it does not affect dynamic linking since in
shared library all symbols are interposable.

So this is kind of feature.   How the ODR violations are detected?
I wonder if keeping weak flag disturbs something.


More information about the Gcc-bugs mailing list