re PR middle-end/54945 (Too strong non-aliasing analysis?)
authorMarek Polacek <polacek@redhat.com>
Fri, 19 Oct 2012 16:53:39 +0000 (16:53 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Fri, 19 Oct 2012 16:53:39 +0000 (16:53 +0000)
PR54945

From-SVN: r192617

gcc/ChangeLog
gcc/fold-const.c

index f599d1e9ebb75949e763f6b99f81049193a8a440..6e87fadae853f642349d731d5651068c7d2c6d53 100644 (file)
@@ -1,3 +1,9 @@
+2012-10-19  Marek Polacek  <polacek@redhat.com>
+
+       PR middle-end/54945
+       * fold-const.c (fold_sign_changed_comparison):  Punt if folding
+       pointer/non-pointer comparison.
+
 2012-10-19  Greta Yorsh  <Greta.Yorsh@arm.com>
 
        * doc/sourcebuild.texi (Effective-Target Keywords): Document
index b1d811d3548fa4fcb8c90492b23d6a197ea14964..053b3f524c5779ef331e046de748b6a47ce17d69 100644 (file)
@@ -6731,12 +6731,14 @@ fold_sign_changed_comparison (location_t loc, enum tree_code code, tree type,
           && TREE_TYPE (TREE_OPERAND (arg1, 0)) == inner_type))
     return NULL_TREE;
 
-  if ((TYPE_UNSIGNED (inner_type) != TYPE_UNSIGNED (outer_type)
-       || POINTER_TYPE_P (inner_type) != POINTER_TYPE_P (outer_type))
+  if (TYPE_UNSIGNED (inner_type) != TYPE_UNSIGNED (outer_type)
       && code != NE_EXPR
       && code != EQ_EXPR)
     return NULL_TREE;
 
+  if (POINTER_TYPE_P (inner_type) != POINTER_TYPE_P (outer_type))
+    return NULL_TREE;
+
   if (TREE_CODE (arg1) == INTEGER_CST)
     arg1 = force_fit_type_double (inner_type, tree_to_double_int (arg1),
                                  0, TREE_OVERFLOW (arg1));