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

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-04-26 
11:17:59 UTC ---
The following fixes it (partially, global vars need similar treatment) at the
cost of extra decls and points-to bits.
We have to give what we point to a name, not only rely in the nonlocal glob.

Index: gcc/tree-ssa-structalias.c
===================================================================
--- gcc/tree-ssa-structalias.c  (revision 172817)
+++ gcc/tree-ssa-structalias.c  (working copy)
@@ -4727,8 +4727,27 @@ intra_create_variable_infos (void)
        }

       for (p = get_vi_for_tree (t); p; p = p->next)
-       if (p->may_have_pointers)
-         make_constraint_from (p, nonlocal_id);
+       {
+         if (p->may_have_pointers)
+           {
+             struct constraint_expr lhsc, rhsc;
+             tree heapvar;
+             heapvar = create_tmp_var_raw (TREE_TYPE (TREE_TYPE (t)),
+                                           "PARM_PT");
+             DECL_EXTERNAL (heapvar) = 1;
+             get_var_ann (heapvar)->is_heapvar = 1;
+             add_referenced_var (heapvar);
+             lhsc.var = p->id;
+             lhsc.type = SCALAR;
+             lhsc.offset = 0;
+             rhsc.var = get_vi_for_tree (heapvar)->id;
+             rhsc.type = ADDRESSOF;
+             rhsc.offset = 0;
+             process_constraint (new_constraint (lhsc, rhsc));
+
+             make_constraint_from (p, nonlocal_id);
+           }
+       }
       if (POINTER_TYPE_P (TREE_TYPE (t))
          && TYPE_RESTRICT (TREE_TYPE (t)))
        make_constraint_from_restrict (get_vi_for_tree (t), "PARM_RESTRICT");

it would be nice if we could avoid allocating decls for such things
(in principle we could simply allocate a DECL_UID only).

Reply via email to