https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78211
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |marxin at gcc dot gnu.org --- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- This seems to be IPA-ICF bug. With -fdump-ipa-icf-all I'm seeing differences like: group: with 1 classes: - class with id: 1, hash: 3010449829, items: 2 - _ZNK8VwViewer13FindViewPlaneERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(0x7fdb1be7b900/2) _ZN8VwViewer13FindViewPlaneERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(0x7fdb1be7b800/1) + class with id: 0, hash: 1515816170, items: 2 + _ZN11VwViewer_2D15undrawStickyBoxEv(0x7f12887d2c00/4) _ZN11VwViewer_2D13drawStickyBoxEv(0x7f12887d2b00/3) group: with 1 classes: - class with id: 0, hash: 698082993, items: 2 - _ZN11VwViewer_2D15undrawStickyBoxEv(0x7fdb1be7bb00/4) _ZN11VwViewer_2D13drawStickyBoxEv(0x7fdb1be7ba00/3) + class with id: 1, hash: 3232079217, items: 2 + _ZNK8VwViewer13FindViewPlaneERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(0x7f12887d2a00/2) _ZN8VwViewer13FindViewPlaneERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(0x7f12887d2900/1) Dump after WPA based types groups Congruence classes: 2 (unique hash values: 2), with total: 4 items Class size histogram [num of members]: number of classe number of classess Remember the basic rules for -fcompare-debug - DECL_UID can be different, but their order must be the same (essentially -g can create bigger gaps in between them), SSA_NAME_VERSION must be identical, and cfun->funcdef_no must be identical. The last one is what breaks, IPA-ICF creates funcdef_no that are swapped. Hashing to different hash values is fine, but care must be taken when actually traversing the hash tables to generate stuff in the same order between -g and -g0 if it could affect code generation in any way.