This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][LTO] Fix PR40765
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Diego Novillo <dnovillo at google dot com>
- Date: Fri, 17 Jul 2009 18:02:10 +0200 (CEST)
- Subject: [PATCH][LTO] Fix PR40765
This fixes PR40765 where the SSA verifier gets confused because LTO
doesn't merge decl attributes like TREE_ADDRESSABLE properly on read-in.
Fixed like the following, ok if it passes bootstrap & test?
Thanks,
Richard.
2009-07-17 Richard Guenther <rguenther@suse.de>
PR lto/40765
* lto-symtab.c (lto_symtab_merge_decl): Merge TREE_ADDRESSABLE
state.
* gcc.dg/lto/20090717_0.c: New testcase.
* gcc.dg/lto/20090717_1.c: Likewise.
Index: gcc/lto-symtab.c
===================================================================
*** gcc/lto-symtab.c (revision 149748)
--- gcc/lto-symtab.c (working copy)
*************** lto_symtab_merge_decl (tree new_decl,
*** 572,577 ****
--- 572,580 ----
if (!lto_symtab_compatible (old_decl, new_decl))
return;
+ /* Merge decl state. */
+ TREE_ADDRESSABLE (old_decl) |= TREE_ADDRESSABLE (new_decl);
+
old_resolution = lto_symtab_get_resolution (old_decl);
gcc_assert (resolution != LDPR_UNKNOWN
&& resolution != LDPR_UNDEF
Index: gcc/testsuite/gcc.dg/lto/20090717_0.c
===================================================================
*** gcc/testsuite/gcc.dg/lto/20090717_0.c (revision 0)
--- gcc/testsuite/gcc.dg/lto/20090717_0.c (revision 0)
***************
*** 0 ****
--- 1,4 ----
+ struct variable {
+ const char *string;
+ };
+ struct variable table[] = { };
Index: gcc/testsuite/gcc.dg/lto/20090717_1.c
===================================================================
*** gcc/testsuite/gcc.dg/lto/20090717_1.c (revision 0)
--- gcc/testsuite/gcc.dg/lto/20090717_1.c (revision 0)
***************
*** 0 ****
--- 1,11 ----
+ struct variable {
+ const char *string;
+ };
+ extern struct variable table[];
+ int main(int argc, char *argv[])
+ {
+ struct variable *p;
+ for(p = table; p->string; p++)
+ ;
+ return 0;
+ }