aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2008-03-30 14:56:28 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2008-03-30 14:56:28 +0000
commit9664860331e02d839e4cb38e750d7027846524d8 (patch)
tree9d8e77bcbffd0b674ab6dd53b854bc1de6bab194 /gcc/fold-const.c
parent23d1b451d0d02e953eaffadd977fca12d93a780a (diff)
downloadgcc-9664860331e02d839e4cb38e750d7027846524d8.zip
gcc-9664860331e02d839e4cb38e750d7027846524d8.tar.gz
gcc-9664860331e02d839e4cb38e750d7027846524d8.tar.bz2
re PR middle-end/31023 (Fold is agnostic of integer sub-types)
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
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 5d5d7cf..c420b79 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -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)