aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1992-10-08 08:30:25 +0000
committerRichard Stallman <rms@gnu.org>1992-10-08 08:30:25 +0000
commit3f78332988a7f8beb96dee105a46828fbb7950fe (patch)
tree694a20b3d6aafc8dba4c76769dc210d48777008a /gcc/fold-const.c
parentabd09f97059f60d60ee20fa4b212a073b97a9710 (diff)
downloadgcc-3f78332988a7f8beb96dee105a46828fbb7950fe.zip
gcc-3f78332988a7f8beb96dee105a46828fbb7950fe.tar.gz
gcc-3f78332988a7f8beb96dee105a46828fbb7950fe.tar.bz2
(invert_truthvalue): Never alter ARG.
From-SVN: r2365
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index e5d735c..9cb107e 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -1979,8 +1979,8 @@ omit_one_operand (type, result, omitted)
return t;
}
-/* Return a simplified tree node for the truth-negation of ARG
- (perhaps by altering ARG). It is known that ARG is an operation that
+/* Return a simplified tree node for the truth-negation of ARG. This
+ never alters ARG itself. We assume that ARG is an operation that
returns a truth value (0 or 1). */
tree
@@ -2000,10 +2000,8 @@ invert_truthvalue (arg)
&& code != NE_EXPR && code != EQ_EXPR)
return build1 (TRUTH_NOT_EXPR, type, arg);
else
- {
- TREE_SET_CODE (arg, invert_tree_comparison (code));
- return arg;
- }
+ return build (invert_tree_comparison (code),
+ TREE_OPERAND (arg, 0), TREE_OPERAND (arg, 1));
}
switch (code)