From: Kazu Hirata Date: Wed, 22 Sep 2004 18:02:08 +0000 (+0000) Subject: re PR tree-optimization/17512 (ICE in regex.c) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a338ab5a5a0f6421a4ce6823451784de6b724424;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4ebfab5e835..4ee9eda85e9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-09-22 Kazu Hirata + + PR tree-optimization/17512 + * convert.c (convert_to_integer): Don't handle TRUTH_*_EXPR as + special cases. + 2004-09-22 David Edelsohn * dbxout.c (get_lang_number): Do not define if diff --git a/gcc/convert.c b/gcc/convert.c index d9c0c129d7c..005d3e2089b 100644 --- a/gcc/convert.c +++ b/gcc/convert.c @@ -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. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fb20f329643..d6226d5f85d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-09-22 Kazu Hirata + + PR tree-optimization/17512 + * gcc.c-torture/compile/20040916-1.c. + 2004-09-21 Mark Mitchell * gcc.dg/pragma-re-3.c: New test. diff --git a/gcc/testsuite/gcc.c-torture/compile/20040916-1.c b/gcc/testsuite/gcc.c-torture/compile/20040916-1.c new file mode 100644 index 00000000000..1a6a9f47fe8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040916-1.c @@ -0,0 +1,12 @@ +/* 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); +}