Commit c9869b75 by Richard Kenner Committed by Richard Kenner

fold-const.c (fold): Fix a few cases when the returned result is not of the same type as the input.

	* fold-const.c (fold): Fix a few cases when the returned result
	is not of the same type as the input.

From-SVN: r32597
parent b1801c02
Thu Mar 16 18:52:32 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* fold-const.c (fold): Fix a few cases when the returned result
is not of the same type as the input.
2000-03-16 Nick Clifton <nickc@cygnus.com> 2000-03-16 Nick Clifton <nickc@cygnus.com>
* config/arm/arm.h (ASM_OUTPUT_MI_THUNK): Fix compile time * config/arm/arm.h (ASM_OUTPUT_MI_THUNK): Fix compile time
......
...@@ -5226,7 +5226,7 @@ fold (expr) ...@@ -5226,7 +5226,7 @@ fold (expr)
if (TREE_CODE (TREE_TYPE (arg0)) != COMPLEX_TYPE) if (TREE_CODE (TREE_TYPE (arg0)) != COMPLEX_TYPE)
return arg0; return arg0;
else if (TREE_CODE (arg0) == COMPLEX_EXPR) else if (TREE_CODE (arg0) == COMPLEX_EXPR)
return build (COMPLEX_EXPR, TREE_TYPE (arg0), return build (COMPLEX_EXPR, type,
TREE_OPERAND (arg0, 0), TREE_OPERAND (arg0, 0),
negate_expr (TREE_OPERAND (arg0, 1))); negate_expr (TREE_OPERAND (arg0, 1)));
else if (TREE_CODE (arg0) == COMPLEX_CST) else if (TREE_CODE (arg0) == COMPLEX_CST)
...@@ -5525,7 +5525,7 @@ fold (expr) ...@@ -5525,7 +5525,7 @@ fold (expr)
if (! FLOAT_TYPE_P (type)) if (! FLOAT_TYPE_P (type))
{ {
if (! wins && integer_zerop (arg0)) if (! wins && integer_zerop (arg0))
return negate_expr (arg1); return convert (type, negate_expr (arg1));
if (integer_zerop (arg1)) if (integer_zerop (arg1))
return non_lvalue (convert (type, arg0)); return non_lvalue (convert (type, arg0));
...@@ -5548,7 +5548,7 @@ fold (expr) ...@@ -5548,7 +5548,7 @@ fold (expr)
{ {
/* Except with IEEE floating point, 0-x equals -x. */ /* Except with IEEE floating point, 0-x equals -x. */
if (! wins && real_zerop (arg0)) if (! wins && real_zerop (arg0))
return negate_expr (arg1); return convert (type, negate_expr (arg1));
/* Except with IEEE floating point, x-0 equals x. */ /* Except with IEEE floating point, x-0 equals x. */
if (real_zerop (arg1)) if (real_zerop (arg1))
return non_lvalue (convert (type, arg0)); return non_lvalue (convert (type, arg0));
...@@ -6819,7 +6819,8 @@ fold (expr) ...@@ -6819,7 +6819,8 @@ fold (expr)
switch (comp_code) switch (comp_code)
{ {
case EQ_EXPR: case EQ_EXPR:
return pedantic_non_lvalue (negate_expr (arg1)); return
pedantic_non_lvalue (convert (type, negate_expr (arg1)));
case NE_EXPR: case NE_EXPR:
return pedantic_non_lvalue (convert (type, arg1)); return pedantic_non_lvalue (convert (type, arg1));
case GE_EXPR: case GE_EXPR:
......
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