Hello,

this patch handles for canonicalize_cond_expr_cond the case, that we have an
type-cast from boolean-type.

ChangeLog

2011-07-27  Kai Tietz  <kti...@redhat.com>

        * gimple.c (canonicalize_cond_expr_cond): Handle cast
        from boolean-type case.

Bootstrapped and regression tested on x86_64-pc-linux-gnu.  Ok for apply?

Regards,
Kai

Index: gcc-head/gcc/gimple.c
===================================================================
--- gcc-head.orig/gcc/gimple.c
+++ gcc-head/gcc/gimple.c
@@ -3160,7 +3160,9 @@ canonicalize_cond_expr_cond (tree t)
 {
   /* Strip conversions around boolean operations.  */
   if (CONVERT_EXPR_P (t)
-      && truth_value_p (TREE_CODE (TREE_OPERAND (t, 0))))
+      && (truth_value_p (TREE_CODE (TREE_OPERAND (t, 0)))
+         || TREE_CODE (TREE_TYPE (TREE_OPERAND (t, 0)))
+            == BOOLEAN_TYPE))
     t = TREE_OPERAND (t, 0);

   /* For !x use x == 0.  */

Reply via email to