This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [PR22319] Ada broken with ICE in tree-ssa-structalias...
Try the attached patch.
On Wed, 2005-07-06 at 06:54 -0400, Geert Bosch wrote:
> This is http://gcc.gnu.org/PR22319.
>
> On Jul 6, 2005, at 06:17, Andreas Schwab wrote:
> > Andreas Jaeger <aj@suse.de> writes:
> >
> >
> >> Building ada with the patch for flag_wrapv fails now with a new
> >> error:
> >>
> >> +===========================GNAT BUG
> >> DETECTED==============================+
> >> | 4.1.0 20050706 (experimental) (x86_64-suse-linux-gnu) GCC
> >> error: |
> >> | tree check: expected integer_cst, have cond_expr
> >> in |
> >> | do_structure_copy, at tree-ssa-structalias.c:
> >> 2410 |
> >>
> >
> > Also on ia64 (without -fwrapv).
> >
> > Andreas.
> >
> > --
> > Andreas Schwab, SuSE Labs, schwab@suse.de
> > SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
> > Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
> > "And now for something completely different."
> >
>
Index: tree-ssa-structalias.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-structalias.c,v
retrieving revision 2.12
diff -u -p -r2.12 tree-ssa-structalias.c
--- tree-ssa-structalias.c 5 Jul 2005 15:31:16 -0000 2.12
+++ tree-ssa-structalias.c 6 Jul 2005 03:21:38 -0000
@@ -2396,18 +2396,39 @@ do_structure_copy (tree lhsop, tree rhso
}
else
{
+ tree rhstype = TREE_TYPE (rhsop);
+ tree lhstype = TREE_TYPE (lhsop);
+ tree rhstypesize = TYPE_SIZE (rhstype);
+ tree lhstypesize = TYPE_SIZE (lhstype);
+
+ /* If we have a variably sized types on the rhs or lhs, and a deref
+ constraint, add the constraint, lhsconstraint = &ANYTHING.
+ This is conservatively correct because either the lhs is an unknown
+ sized var (if the constraint is SCALAR), or the lhs is a DEREF
+ constraint, and every variable it can point to must be unknown sized
+ anyway, so we don't need to worry about fields at all. */
+ if ((rhs.type == DEREF && TREE_CODE (rhstypesize) != INTEGER_CST)
+ || (lhs.type == DEREF && TREE_CODE (lhstypesize) != INTEGER_CST))
+ {
+ rhs.var = anything_id;
+ rhs.type = ADDRESSOF;
+ rhs.offset = 0;
+ process_constraint (new_constraint (lhs, rhs));
+ return;
+ }
+
/* The size only really matters insofar as we don't set more or less of
the variable. If we hit an unknown size var, the size should be the
whole darn thing. */
if (get_varinfo (rhs.var)->is_unknown_size_var)
rhssize = ~0;
else
- rhssize = TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (rhsop)));
+ rhssize = TREE_INT_CST_LOW (rhstypesize);
if (get_varinfo (lhs.var)->is_unknown_size_var)
lhssize = ~0;
else
- lhssize = TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (lhsop)));
+ lhssize = TREE_INT_CST_LOW (lhstypesize);
if (rhs.type == SCALAR && lhs.type == SCALAR)
@@ -2418,9 +2439,7 @@ do_structure_copy (tree lhsop, tree rhso
do_lhs_deref_structure_copy (lhs, rhs, MIN (lhssize, rhssize));
else
{
- tree rhsdecl = get_varinfo (rhs.var)->decl;
- tree pointertype = TREE_TYPE (rhsdecl);
- tree pointedtotype = TREE_TYPE (pointertype);
+ tree pointedtotype = lhstype;
tree tmpvar;
gcc_assert (rhs.type == DEREF && lhs.type == DEREF);