aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2008-08-14 11:02:46 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2008-08-14 11:02:46 +0200
commit2e1d24744be9f2f3a5d0d80c86c4405805daefb5 (patch)
tree65c0b5cf2b817a03b7725cd5e98a885f98659330 /gcc/fold-const.c
parentcf04a1931a4274158f329da3052b7cbb54e48e8e (diff)
downloadgcc-2e1d24744be9f2f3a5d0d80c86c4405805daefb5.zip
gcc-2e1d24744be9f2f3a5d0d80c86c4405805daefb5.tar.gz
gcc-2e1d24744be9f2f3a5d0d80c86c4405805daefb5.tar.bz2
re PR middle-end/37103 (possible integer codegen bug)
PR middle-end/37103 * fold-const.c (fold_widened_comparison): Do not allow sign changes that change the result even if shorter type is wider than arg1_unw's type. * gcc.c-torture/execute/20080813-1.c: New test. From-SVN: r139093
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index cae45b5..eac31ef 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -6733,10 +6733,8 @@ fold_widened_comparison (enum tree_code code, tree type, tree arg0, tree arg1)
if ((code == EQ_EXPR || code == NE_EXPR
|| TYPE_UNSIGNED (TREE_TYPE (arg0)) == TYPE_UNSIGNED (shorter_type))
&& (TREE_TYPE (arg1_unw) == shorter_type
- || (TYPE_PRECISION (shorter_type)
- > TYPE_PRECISION (TREE_TYPE (arg1_unw)))
|| ((TYPE_PRECISION (shorter_type)
- == TYPE_PRECISION (TREE_TYPE (arg1_unw)))
+ >= TYPE_PRECISION (TREE_TYPE (arg1_unw)))
&& (TYPE_UNSIGNED (shorter_type)
== TYPE_UNSIGNED (TREE_TYPE (arg1_unw))))
|| (TREE_CODE (arg1_unw) == INTEGER_CST