diff options
author | Richard Stallman <rms@gnu.org> | 1992-08-26 19:45:07 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1992-08-26 19:45:07 +0000 |
commit | 53d2fb4f5f9e27454c39cfd0dd1d06470b10b79c (patch) | |
tree | 1c6e24cfd1a55e0cfb96e58728e59aca08567b1d /gcc/fold-const.c | |
parent | f95361c8d027d09c645acba94a585c04a2486287 (diff) | |
download | gcc-53d2fb4f5f9e27454c39cfd0dd1d06470b10b79c.zip gcc-53d2fb4f5f9e27454c39cfd0dd1d06470b10b79c.tar.gz gcc-53d2fb4f5f9e27454c39cfd0dd1d06470b10b79c.tar.bz2 |
(fold): Do A op C1 ? A : C2 opt only for INTEGER_TYPEs.
From-SVN: r1965
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index e23683e..069c503 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -4110,9 +4110,11 @@ fold (expr) /* If this is A op C1 ? A : C2 with C1 and C2 constant integers, we might still be able to simplify this. For example, if C1 is one less or one more than C2, this might have started - out as a MIN or MAX and been transformed by this function. */ + out as a MIN or MAX and been transformed by this function. + Only good for INTEGER_TYPE, because we need TYPE_MAX_VALUE. */ - if (TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST + if (TREE_CODE (type) == INTEGER_TYPE + && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST && TREE_CODE (arg2) == INTEGER_CST) switch (comp_code) { |