re PR middle-end/31023 (Fold is agnostic of integer sub-types)
authorRichard Guenther <rguenther@suse.de>
Sun, 30 Mar 2008 14:56:28 +0000 (14:56 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Sun, 30 Mar 2008 14:56:28 +0000 (14:56 +0000)
2008-03-30  Richard Guenther  <rguenther@suse.de>

PR middle-end/31023
* fold-const.c (fold_sign_changed_comparison): Do leave
conversions to base-types alone.

From-SVN: r133731

gcc/ChangeLog
gcc/fold-const.c

index 94725d93bcc7a186b3bfe854b2f6d5b643c795a3..a008d0dcfed9b8709e88bab3f5179737620fd737 100644 (file)
@@ -1,3 +1,9 @@
+2008-03-30  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/31023
+       * fold-const.c (fold_sign_changed_comparison): Do leave
+       conversions to base-types alone.
+
 2008-03-29  Andrew Pinski  <andrew_pinski@playstation.sony.com>
 
        * config/rs6000/rs6000.c (rs6000_stack_info): Don't force saving of
index 5d5d7cf2b976c370c5f7f3c745d6953dcdc96225..c420b79b75c513c3e77a85cd845e0770454ddccb 100644 (file)
@@ -6807,6 +6807,11 @@ fold_sign_changed_comparison (enum tree_code code, tree type,
   if (TYPE_PRECISION (inner_type) != TYPE_PRECISION (outer_type))
     return NULL_TREE;
 
+  /* If the conversion is from an integral subtype to its basetype
+     leave it alone.  */
+  if (TREE_TYPE (inner_type) == outer_type)
+    return NULL_TREE;
+
   if (TREE_CODE (arg1) != INTEGER_CST
       && !((TREE_CODE (arg1) == NOP_EXPR
            || TREE_CODE (arg1) == CONVERT_EXPR)