From 464.h264ref we can see that for t1.c const int i[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; t2.c extern int i[10]; int main () { return i[0]; } we should merge both decls, retaining the const qualification (the middle-end considers both types compatible, lto_symtab_compatible doesn't).
Yes, this seems wrong.
Mine.
Subject: Bug 40902 Author: rguenth Date: Mon Oct 5 14:27:39 2009 New Revision: 152452 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152452 Log: 2009-10-05 Richard Guenther <rguenther@suse.de> PR lto/40902 * lto-symtab.c (lto_compatible_attributes_p): Remove. (external_aggregate_decl_p): Likewise. (lto_symtab_compatible): Re-structure. Remove dead code. For variables ignore toplevel qualifiers when comparing types. Issue warnings, not errors for mismatched user-alignment. * gcc.dg/lto/20091005-1_0.c: New testcase. * gcc.dg/lto/20091005-1_1.c: Likewise. Added: trunk/gcc/testsuite/gcc.dg/lto/20091005-1_0.c trunk/gcc/testsuite/gcc.dg/lto/20091005-1_1.c Modified: trunk/gcc/ChangeLog trunk/gcc/lto-symtab.c trunk/gcc/testsuite/ChangeLog
Fixed.