https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83954
Martin Liška <marxin at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|marxin at gcc dot gnu.org |hubicka at gcc dot gnu.org --- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> --- Slightly reduced test-case: $ cat lto.h struct foo; extern struct foo *FOO_PTR_ARR[1]; $ cat lto1.c #include "lto.h" int main() { // just to prevent symbol removal FOO_PTR_ARR[1] = 0; return 0; } $ cat lto2.c #include "lto.h" struct foo { int x; }; struct foo *FOO_PTR_ARR[1] = { 0 }; We end up comparison following 2 types in ODR mismatch: (gdb) p debug_tree(type) <array_type 0x7ffff6a0dbd0 type <pointer_type 0x7ffff6a0db28 type <record_type 0x7ffff6a0da80 foo VOID align:8 warn_if_not_align:0 symtab:0 alias-set -1 structural-equality context <translation_unit_decl 0x7ffff681e168 lto1.c> pointer_to_this <pointer_type 0x7ffff6a0db28> chain <type_decl 0x7ffff6a0e130 D.4320>> unsigned DI size <integer_cst 0x7ffff6814be8 constant 64> unit-size <integer_cst 0x7ffff6814c00 constant 8> align:64 warn_if_not_align:0 symtab:0 alias-set 1 structural-equality> DI size <integer_cst 0x7ffff6814be8 64> unit-size <integer_cst 0x7ffff6814c00 8> align:64 warn_if_not_align:0 symtab:0 alias-set 1 structural-equality domain <integer_type 0x7ffff6a0d9d8 type <integer_type 0x7ffff6828000 sizetype public unsigned DI size <integer_cst 0x7ffff6814be8 64> unit-size <integer_cst 0x7ffff6814c00 8> align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7ffff6828738 precision:64 min <integer_cst 0x7ffff6814c18 0> max <integer_cst 0x7ffff68154a0 18446744073709551615>> DI size <integer_cst 0x7ffff6814be8 64> unit-size <integer_cst 0x7ffff6814c00 8> align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7ffff6828738 precision:64 min <integer_cst 0x7ffff6814c18 0> max <integer_cst 0x7ffff6814c18 0>> pointer_to_this <pointer_type 0x7ffff6a0dc78>> $3 = void (gdb) p debug_tree(prevailing_type) <array_type 0x7ffff6a0df18 type <pointer_type 0x7ffff6a0de70 type <record_type 0x7ffff6a0ddc8 foo SI size <integer_cst 0x7ffff6814e28 constant 32> unit-size <integer_cst 0x7ffff6814e40 constant 4> align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7ffff6a0ddc8 fields <field_decl 0x7ffff6a0e260 x> context <translation_unit_decl 0x7ffff681e1e0 lto2.c> pointer_to_this <pointer_type 0x7ffff6a0de70> chain <type_decl 0x7ffff6a0e1c8 D.4324>> unsigned DI size <integer_cst 0x7ffff6814be8 constant 64> unit-size <integer_cst 0x7ffff6814c00 constant 8> align:64 warn_if_not_align:0 symtab:0 alias-set 2 structural-equality> DI size <integer_cst 0x7ffff6814be8 64> unit-size <integer_cst 0x7ffff6814c00 8> align:64 warn_if_not_align:0 symtab:0 alias-set 2 structural-equality domain <integer_type 0x7ffff6a0d9d8 type <integer_type 0x7ffff6828000 sizetype public unsigned DI size <integer_cst 0x7ffff6814be8 64> unit-size <integer_cst 0x7ffff6814c00 8> align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7ffff6828738 precision:64 min <integer_cst 0x7ffff6814c18 0> max <integer_cst 0x7ffff68154a0 18446744073709551615>> DI size <integer_cst 0x7ffff6814be8 64> unit-size <integer_cst 0x7ffff6814c00 8> align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7ffff6828738 precision:64 min <integer_cst 0x7ffff6814c18 0> max <integer_cst 0x7ffff6814c18 0>>> Honza can you please take a look?