[Bug tree-optimization/36666] [4.4 Regression] ICE in process_constraint, at tree-ssa-structalias.c:2573

rguenther at suse dot de gcc-bugzilla@gcc.gnu.org
Sun Jun 29 15:32:00 GMT 2008



------- Comment #3 from rguenther at suse dot de  2008-06-29 15:31 -------
Subject: Re:  [4.4 Regression] ICE in
 process_constraint, at tree-ssa-structalias.c:2573

On Sun, 29 Jun 2008, dberlin at gcc dot gnu dot org wrote:

> ------- Comment #2 from dberlin at gcc dot gnu dot org  2008-06-29 15:23 -------
> You can't remove the assert, the assert is there because things will be broken
> if it hasn't been handed off to do_structure_copy.

Well...  not.  1) we don't have subfields here, 2) the constraint is
supposed to do what it says - what the lhs points to should point to
what the rhs points to.

The remaining bug, in the case we have subfields, is that 
get_constraint_for for struct-valued references gets us just a single
constraint for the first field it finds.

The bug is from handle_const_call:

   /* May return arguments.  */
   FOR_EACH_CALL_EXPR_ARG (arg, iter, call)
     if (could_have_pointers (arg))
       {
         VEC(ce_s, heap) *argc = NULL;
         struct constraint_expr *argp;
         int i;
         get_constraint_for (arg, &argc);
         for (i = 0; VEC_iterate (ce_s, argc, i, argp); i++)
           for (j = 0; VEC_iterate (ce_s, lhsc, j, lhsp); j++)
             process_constraint (new_constraint (*lhsp, *argp));
         VEC_free (ce_s, heap, argc);
       }

for subfields I expected that (for example for two) we end up with
the following constraints generated in this loop

  x->a = y->a
  x->b = y->a
  x->a = y->b
  x->b = y->b

which is _not_ a structure copy!  But of course in the end it only generates

  x->a = y->a

oops.

IMHO get_constraint_for for a struct-valued reference needs to fill the
array with all subvars the reference touches.  The do_structure_copy
handling is a special case that handles "real" assignments.

In the above light the assert is bogus, because it expects all
(struct) assignments coming from real instructions.

But maybe I'm missing sth? ;)

Richard.


-- 


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



More information about the Gcc-bugs mailing list