GCC 4.2.0 Status Report (2007-03-22)

Diego Novillo dnovillo@redhat.com
Fri Mar 30 15:32:00 GMT 2007

Mark Mitchell wrote on 03/22/07 22:10:

> PR 29585 (Novillo): ICE-on-valid

This one seems to be a bug in the C++ FE, compounded by alias analysis
papering over the issue.  We are failing to mark DECLs in vtbl
initializers as addressable.  This causes the failure during aliasing
because it is added to a points-to set but not marked for renaming.

Since the variable does not have its address taken, we initially do not
consider it interesting in the setup routines of alias analysis.
However, the variable ends up inside points-to sets and later on we put
it inside may-alias sets.  This causes it to appear in virtual operands,
but since it had not been marked for renaming, we fail.

I traced the problem back to the building of vtables.  I'm simply
calling cxx_mark_addressable after building the ADDR_EXPR (I'm wondering
if building ADDR_EXPR shouldn't just call langhooks.mark_addressable).

Another way of addressing this would be to mark symbols addressable
during referenced var discovery.  But that is a bit hacky.

Mark, does this look OK?  (not tested yet)

Index: cp/class.c
--- cp/class.c  (revision 123332)
+++ cp/class.c  (working copy)
@@ -7102,6 +7102,7 @@
       /* Figure out the position to which the VPTR should point.  */
       vtbl = TREE_PURPOSE (l);
       vtbl = build1 (ADDR_EXPR, vtbl_ptr_type_node, vtbl);
+      cxx_mark_addressable (vtbl);
       index = size_binop (PLUS_EXPR,
                          size_int (non_fn_entries),
                          size_int (list_length (TREE_VALUE (l))));

More information about the Gcc mailing list