Hello, While debugging a self comparison error, I realized that some types where comparing different during IR type canonicalization for no good reason. Looking deeper, I realized it's due to an anonymous enum comparing different to the same anonymous enum defined elsewhere. Both anonymous enums have naming typedefs. The discrepancy is due to the fact that one of these enums didn't have its naming typedef applied, by the DWARF reader. This is because the DWARF reader "re-uses" typedef types whenever it can, and thus re-uses naming typedefs too. Thinking deeply about this, I think naming typedefs should not be re-used, otherwise, some anonymous types would lack their naming typedefs. Oops. So the patch avoids typedefs to be re-used altogether. There doesn't seem to be any performance hit. With that fixed, another problem came up: Some typedefs of type foo are compared to said type foo and the comparison yields "false", wrongly. This is in the context of a type 'foo' used by type 'bar' defined in a translation unit, and the same type 'bar' uses a typedef of 'foo' in another translation unit. Both types 'bar' should compare equal, but don't, today. This is true especially for function types. The patch strips typedefs off of the types of function parameters when comparing function types. To make things consistent, typedefs are stripped off of function parameters when function types (and decls) are pretty printed for internal purposes, especially for type canonicalization. * src/abg-dwarf-reader.cc (build_typedef_type): Do not re-use typedefs. * src/abg-ir.cc (get_function_type_name, get_method_type_name) (function_decl::get_pretty_representation_of_declarator): Strip typedefs when the function name is computed for internal purposes. (equals): In the overload for function_decl::parameter, strip typedefs when comparing parameter types. * tests/data/test-annotate/libtest23.so.abi: Adjust. * tests/data/test-annotate/test14-pr18893.so.abi: Likewise. * tests/data/test-annotate/test15-pr18892.so.abi: Likewise. * tests/data/test-annotate/test17-pr19027.so.abi: Likewise. * tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-annotate/test21-pr19092.so.abi: Likewise. * tests/data/test-diff-dwarf/test2-report.txt: Likewise. * tests/data/test-diff-filter/test3-report.txt: Likewise. * tests/data/test-diff-pkg/PR24690/PR24690-report-0.txt: Likewise. * tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise. * tests/data/test-read-dwarf/PR25007-sdhci.ko.abi: Likewise. * tests/data/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi: Likewise. * tests/data/test-read-dwarf/libtest23.so.abi: Likewise. * tests/data/test-read-dwarf/test-libaaudio.so.abi: Likewise. * tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise. * tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise. * tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise. * tests/data/test-read-dwarf/test14-pr18893.so.abi: Likewise. * tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise. * tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise. * tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise. * tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise. Signed-off-by: Dodji Seketeli --- src/abg-dwarf-reader.cc | 10 - src/abg-ir.cc | 21 +- tests/data/test-annotate/libtest23.so.abi | 3 + .../data/test-annotate/test14-pr18893.so.abi | 6888 ++- .../data/test-annotate/test15-pr18892.so.abi | 26954 +++++----- .../data/test-annotate/test17-pr19027.so.abi | 668 +- ...st18-pr19037-libvtkRenderingLIC-6.1.so.abi | 144 + ...19-pr19023-libtcmalloc_and_profiler.so.abi | 17259 +++---- ...st20-pr19025-libvtkParallelCore-6.1.so.abi | 204 + .../data/test-annotate/test21-pr19092.so.abi | 4906 +- tests/data/test-diff-dwarf/test2-report.txt | 11 - tests/data/test-diff-filter/test3-report.txt | 2 +- .../PR24690/PR24690-report-0.txt | 5 +- .../test-read-dwarf/PR22122-libftdc.so.abi | 1230 +- .../data/test-read-dwarf/PR25007-sdhci.ko.abi | 6312 ++- .../PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi | 772 +- tests/data/test-read-dwarf/libtest23.so.abi | 2 + .../test-read-dwarf/test-libaaudio.so.abi | 12 +- .../test-read-dwarf/test-libandroid.so.abi | 2852 +- .../test-read-dwarf/test10-pr18818-gcc.so.abi | 3436 +- .../test-read-dwarf/test12-pr18844.so.abi | 2437 +- .../test-read-dwarf/test14-pr18893.so.abi | 6796 ++- .../test-read-dwarf/test15-pr18892.so.abi | 26469 +++++----- .../test-read-dwarf/test16-pr18904.so.abi | 17761 ++++--- .../test-read-dwarf/test17-pr19027.so.abi | 592 +- ...st18-pr19037-libvtkRenderingLIC-6.1.so.abi | 108 + ...19-pr19023-libtcmalloc_and_profiler.so.abi | 16961 +++---- ...st20-pr19025-libvtkParallelCore-6.1.so.abi | 153 + .../test-read-dwarf/test21-pr19092.so.abi | 4825 +- .../test22-pr19097-libstdc++.so.6.0.17.so.abi | 40653 +++++++++------- .../test9-pr18818-clang.so.abi | 2348 +- 31 files changed, 100137 insertions(+), 90657 deletions(-) Attaching the gzipped patch as it's otherwise too big for the list.