[Bug libstdc++/64504] Invalid free() with _GLIBCXX_DEBUG and -fwhole-program

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jan 26 10:56:00 GMT 2015


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu.org

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Looks like _S_empty_rep_storage is tested like

  if (ptr != &_S_empty_rep_storage)

in libstdc++ and thus having multiple _S_empty_rep_storage instantiations is
going to break.

Honza - how was -fwhole-program (and LTO?!) designed to deal with C++ ODR
rules?  With -fno-linker-plugin, that is?


To others:

-fwhole-program basically assumes that all defined symbols can be brought
local to the unit (apart from main()).  Seems like this includes instantiated
templates which means that we assume there is only a single TU and thus ODR
violations never arise from that.



More information about the Gcc-bugs mailing list