diff options
author | mpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-10-19 16:53:39 +0000 |
---|---|---|
committer | mpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-10-19 16:53:39 +0000 |
commit | 601366b73e5a34848c54fe3fa5e50ad555434164 (patch) | |
tree | fedc0eb01fed59fdb431827502037cab4085b813 | |
parent | 64f55ea10637a58214a11dc2b630ffc0d6b87b11 (diff) | |
download | gcc-601366b73e5a34848c54fe3fa5e50ad555434164.tar.gz |
PR54945
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192617 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fold-const.c | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f599d1e9ebb..6e87fadae85 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 diff --git a/gcc/fold-const.c b/gcc/fold-const.c index b1d811d3548..053b3f524c5 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -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)); |