On 11/6/06, Ricardo FERNANDEZ PASCUAL <[EMAIL PROTECTED]> wrote:
Hello,

    I have discovered that volatile expresions can cause the tree-ssa
pre pass to loop forever in "compute_antic". The problem seems to be
that the expresion is assigned a different value number at each
iteration, hence the fixed point required to exit the loop is never reached.

This should not be possible, it would imply that you have SSA names
marked as volatile, or a statement whose operands are marked volatile
but ann->has_volatile_ops is false.


    This can be fixed with the attached patch, which modifies
"can_value_number_operation" to return false for volatile expresions. I
think this makes sense, because you cannot value number volatile
expresions (in the same sense that you cannot value number non pure or
const function calls).

This is wrong.

The only place that can_value_number_operation is used is inside an if
block that says:

else if (TREE_CODE (stmt) == MODIFY_EXPR
             && !ann->has_volatile_ops
             && TREE_CODE (TREE_OPERAND (stmt, 0)) == SSA_NAME
             && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (TREE_OPERAND (stmt, 0)))
{
...
  if (can_value_number_operation (rhs))
      {
      }
}

Any statement which contains volatile operands should have
ann->has_volatile_ops set.
That is your real bug.




    I cannot easily provide a testcase because this problem appears only
with a gcc frontend that I am writting. With this fix, volatile acesses
work correctly (without it they work correctly only if this pass is
disabled).

    Do you think this patch is correct?

Nope, for the reasons above.


Reply via email to