------- Comment #3 from rguenth at gcc dot gnu dot org  2009-07-17 15:40 -------
confvar.i:

struct variable {
    const char *string;
};
struct variable table[] = { };


getconf.i:

struct variable {
    const char *string;
};
extern struct variable table[];
int main(int argc, char *argv[]) 
{
    struct variable *p;
    for(p = table; p->string; p++) 
      ;
}

> ./xgcc -B.  confvar.3.i getconf.3.i -flto -O
In function 'main':
lto1: error: address taken, but ADDRESSABLE bit not set
PHI argument
&table[0];
for PHI node
p_1 = PHI <&table[0](2), p_4(3)>
lto1: internal compiler error: verify_ssa failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

as table is a global variable this is likely just a verifier issue - the
TREE_ADDRESSABLE state of non-static variables is not relevant (still it
seems it's not properly merged).  With -fwhole-program table should be
promoted to static, thus TREE_ADDRESSABLE should be merged here.

Like the following, which fixes the testcase:

Index: lto-symtab.c
===================================================================
--- lto-symtab.c        (revision 149739)
+++ lto-symtab.c        (working copy)
@@ -572,6 +572,9 @@ lto_symtab_merge_decl (tree new_decl,
   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


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2009-07-15 15:15:34         |2009-07-17 15:40:25
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40765

Reply via email to