Commit f0b996c5 by Richard Stallman

(truthvalue_conversion): Fix handling of COMPLEX_EXPR.

Handle all complex values specially.

From-SVN: r3645
parent a333b79f
......@@ -967,9 +967,10 @@ truthvalue_conversion (expr)
return integer_one_node;
case COMPLEX_EXPR:
return build_binary_op (TRUTH_ANDIF_EXPR,
truthvalue_conversion (TREE_REALPART (expr)),
truthvalue_conversion (TREE_IMAGPART (expr)),
return build_binary_op ((TREE_SIDE_EFFECTS (TREE_OPERAND (expr, 1))
? TRUTH_AND_EXPR : TRUTH_ANDIF_EXPR),
truthvalue_conversion (TREE_OPERAND (expr, 0)),
truthvalue_conversion (TREE_OPERAND (expr, 1)),
0);
case NEGATE_EXPR:
......@@ -1027,6 +1028,14 @@ truthvalue_conversion (expr)
break;
}
if (TREE_CODE (TREE_TYPE (expr)) == COMPLEX_TYPE)
return (build_binary_op
((TREE_SIDE_EFFECTS (expr)
? TRUTH_AND_EXPR : TRUTH_ANDIF_EXPR),
truthvalue_conversion (build_unary_op (REALPART_EXPR, expr, 0)),
truthvalue_conversion (build_unary_op (IMAGPART_EXPR, expr, 0)),
0));
return build_binary_op (NE_EXPR, expr, integer_zero_node, 1);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment