Commit a338ab5a by Kazu Hirata Committed by Kazu Hirata

re PR tree-optimization/17512 (ICE in regex.c)

	PR tree-optimization/17512
	* convert.c (convert_to_integer): Don't handle TRUTH_*_EXPR as
	special cases.

	* testsuite/gcc.c-torture/compile/20040916-1.c.

From-SVN: r87870
parent 39cf49a1
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
......
......@@ -397,9 +397,7 @@ convert_to_integer (tree type, tree expr)
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)
{
......@@ -408,25 +406,6 @@ convert_to_integer (tree type, tree expr)
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.
......
/* 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);
}
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