From 1b81aa149386d6b086c0a55837e9c34331f3bb27 Mon Sep 17 00:00:00 2001 From: Richard Stallman Date: Wed, 26 Aug 1992 06:04:35 +0000 Subject: [PATCH] (fold): Avoid the normal STRIP_NOPS on arg of NOP_EXPR. From-SVN: r1959 --- gcc/fold-const.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 44933bf6869..e23683e2dcb 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -2849,7 +2849,27 @@ fold (expr) } kind = TREE_CODE_CLASS (code); - if (kind == 'e' || kind == '<' || kind == '1' || kind == '2' || kind == 'r') + if (code == NOP_EXPR || code == FLOAT_EXPR || code == CONVERT_EXPR) + { + /* Special case for conversion ops that can have fixed point args. */ + arg0 = TREE_OPERAND (t, 0); + + /* Don't use STRIP_NOPS, because signedness of argument type matters. */ + if (arg0 != 0) + STRIP_TYPE_NOPS (arg0); + + if (arg0 != 0 && TREE_CODE (arg0) != INTEGER_CST +#if ! defined (REAL_IS_NOT_DOUBLE) || defined (REAL_ARITHMETIC) + && TREE_CODE (arg0) != REAL_CST +#endif /* not REAL_IS_NOT_DOUBLE, or REAL_ARITHMETIC */ + ) + /* Note that TREE_CONSTANT isn't enough: + static var addresses are constant but we can't + do arithmetic on them. */ + wins = 0; + } + else if (kind == 'e' || kind == '<' + || kind == '1' || kind == '2' || kind == 'r') { register int len = tree_code_length[(int) code]; register int i; -- 2.30.2