summaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorGavin Romig-Koch <gavin@cygnus.com>1999-09-17 19:06:50 +0000
committerGavin Romig-Koch <gavin@gcc.gnu.org>1999-09-17 19:06:50 +0000
commit05ca5990713469bc7ca0b473c10d9698d688cf6b (patch)
tree93d7e32f7fd22847ca013e3c9145338887370baf /gcc/fold-const.c
parent3f94eee6850c59300cf57e0fe154c8eacefadab1 (diff)
downloadgcc-05ca5990713469bc7ca0b473c10d9698d688cf6b.tar.gz
* fold-const.c (operand_equal_p): Pay attention to side effects.
From-SVN: r29483
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index cddcded25ee..c13b6908c43 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -2183,6 +2183,12 @@ operand_equal_p (arg0, arg1, only_const)
TREE_OPERAND (arg1, 0), 0));
case 'r':
+ /* If either of the pointer (or reference) expressions we are dereferencing
+ contain a side effect, these cannot be equal. */
+ if (TREE_SIDE_EFFECTS (arg0)
+ || TREE_SIDE_EFFECTS (arg1))
+ return 0;
+
switch (TREE_CODE (arg0))
{
case INDIRECT_REF: