This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Disallow COMPOUND_EXPR in set_rhs
On Tue, Sep 21, 2004 at 07:33:50AM -0400, Diego Novillo wrote:
> On Tue, 2004-09-21 at 00:44, Richard Henderson wrote:
>
> > > + if (!set_rhs (stmtp, result))
> >
> > Although really set_rhs is not a particularly good check for whether
> > or not the substitution is valid.
> >
> Indeed. set_rhs should check expressions other than unary and binary.
At least COMPOUND_EXPR which fold_builtin will return in several occassions,
e.g. when optimizing sprintf (x, "%s", "string").
I saw an ICE today where tree-ssa-dom.c (optimize_stmt) called fold_stmt
and created non-gimple statement.
2004-09-23 Jakub Jelinek <jakub@redhat.com>
* tree-ssa-propagate.c (set_rhs): Fail if EXPR is COMPOUND_EXPR.
--- gcc/tree-ssa-propagate.c.jj 2004-09-18 13:49:35.000000000 +0200
+++ gcc/tree-ssa-propagate.c 2004-09-23 17:02:41.483400229 +0200
@@ -575,6 +575,8 @@ set_rhs (tree *stmt_p, tree expr)
if (!is_gimple_val (TREE_OPERAND (expr, 0)))
return false;
}
+ else if (TREE_CODE_CLASS (code) == COMPOUND_EXPR)
+ return false;
switch (TREE_CODE (stmt))
{
Jakub