+2004-09-22 Kazu Hirata <kazu@cs.umass.edu>
+
+ PR tree-optimization/17512
+ * convert.c (convert_to_integer): Don't handle TRUTH_*_EXPR as
+ special cases.
+
2004-09-22 David Edelsohn <edelsohn@gnu.org>
* dbxout.c (get_lang_number): Do not define if
case BOOLEAN_TYPE:
case CHAR_TYPE:
/* If this is a logical operation, which just returns 0 or 1, we can
- change the type of the expression. For some logical operations,
- we must also change the types of the operands to maintain type
- correctness. */
+ change the type of the expression. */
if (TREE_CODE_CLASS (ex_form) == tcc_comparison)
{
return expr;
}
- else if (ex_form == TRUTH_AND_EXPR || ex_form == TRUTH_ANDIF_EXPR
- || ex_form == TRUTH_OR_EXPR || ex_form == TRUTH_ORIF_EXPR
- || ex_form == TRUTH_XOR_EXPR)
- {
- expr = copy_node (expr);
- TREE_OPERAND (expr, 0) = convert (type, TREE_OPERAND (expr, 0));
- TREE_OPERAND (expr, 1) = convert (type, TREE_OPERAND (expr, 1));
- TREE_TYPE (expr) = type;
- return expr;
- }
-
- else if (ex_form == TRUTH_NOT_EXPR)
- {
- expr = copy_node (expr);
- TREE_OPERAND (expr, 0) = convert (type, TREE_OPERAND (expr, 0));
- TREE_TYPE (expr) = type;
- return expr;
- }
-
/* If we are widening the type, put in an explicit conversion.
Similarly if we are not changing the width. After this, we know
we are truncating EXPR. */
+2004-09-22 Kazu Hirata <kazu@cs.umass.edu>
+
+ PR tree-optimization/17512
+ * gcc.c-torture/compile/20040916-1.c.
+
2004-09-21 Mark Mitchell <mark@codesourcery.com>
* gcc.dg/pragma-re-3.c: New test.
--- /dev/null
+/* PR tree-optimization/17512
+
+ We used to try to fold "(char) (X ^ Y)", where '^' is
+ TRUTH_XOR_EXPR into ((char) X ^ (char) Y), creating TRUTH_XOR_EXPR
+ with its operands being of type char, which is invalid. */
+
+char
+foo (int p)
+{
+ int q = p;
+ return (p != 0) == (p == q);
+}