On Fri, 1 Jun 2012, Eric Botcazou wrote:

> > Well, it would rather be
> >
> >   TYPE_UNSIGNED (type) == TYPE_UNSIGNED (TREE_TYPE (arg0))
> >   && TYPE_UNSIGNED (type) == TYPE_UNSIGNED (TREE_TYPE (arg1))
> >
> > but only in the !FLOAT_TYPE_P path.
> 
> That works in all cases I think, see existing cases in the folder.

(*)

> > We could even compare 
> > TYPE_OVERFLOW_UNDEFINED I think.  Or even just make sure
> > that when TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (arg0)) also
> > TYPE_OVERFLOW_UNDEFINED (type), thus
> >
> >   !TYPE_OVERFLOW_UNDEFINED (type)
> >
> >   || ((TREE_CODE (arg0) != MULT_EXPR
> >   ||
> >        || TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (arg0)))
> >
> >       && (TREE_CODE (arg1) != MULT_EXPR
> >
> >           || TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (arg1))))
> >
> > That is, the newly created multiplication in type TYPE should
> > either not have undefined overflow or the inner multiplications
> > all should already have.  Best done with a comment in
> > fold_plusminus_mult_expr.
> 
> I'm a little lost here. :-)  I don't really care about the mainline at this 
> point, but the fix on the branches should be the minimal working one.

Ok ... the (*) fix is ok then on both branch and trunk.

We can leave improving trunk for a followup.

Richard.

Reply via email to