aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1992-06-04 02:12:28 +0000
committerRichard Stallman <rms@gnu.org>1992-06-04 02:12:28 +0000
commit68d884911e5d330965258f5ee34005ec7ef83022 (patch)
tree582ed9089a32b015ed6df64bada7119b852c7443 /gcc/fold-const.c
parent454f2ef20efb456f6e550bba8482627f7021e283 (diff)
downloadgcc-68d884911e5d330965258f5ee34005ec7ef83022.zip
gcc-68d884911e5d330965258f5ee34005ec7ef83022.tar.gz
gcc-68d884911e5d330965258f5ee34005ec7ef83022.tar.bz2
*** empty log message ***
From-SVN: r1153
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index ba44e20..0bc6db3 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -2733,6 +2733,8 @@ fold (expr)
/* Other kinds of FIX are not handled properly by fold_convert. */
/* Two conversions in a row are not needed unless:
- the intermediate type is narrower than both initial and final, or
+ - the intermediate type and innermost type differ in signedness,
+ and the outermost type is wider than the intermediate, or
- the initial type is a pointer type and the precisions of the
intermediate and final types differ, or
- the final type is a pointer type and the precisions of the
@@ -2744,6 +2746,14 @@ fold (expr)
||
TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (t, 0)))
> TYPE_PRECISION (TREE_TYPE (t)))
+ && ! ((TREE_CODE (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (t, 0), 0)))
+ == INTEGER_TYPE)
+ && (TREE_CODE (TREE_TYPE (TREE_OPERAND (t, 0)))
+ == INTEGER_TYPE)
+ && (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (t, 0)))
+ != TREE_UNSIGNED (TREE_OPERAND (TREE_OPERAND (t, 0), 0)))
+ && (TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (t, 0)))
+ < TYPE_PRECISION (TREE_TYPE (t))))
&& ((TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (t, 0)))
&& (TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (t, 0)))
> TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (t, 0), 0)))))