From 05ca5990713469bc7ca0b473c10d9698d688cf6b Mon Sep 17 00:00:00 2001 From: Gavin Romig-Koch Date: Fri, 17 Sep 1999 19:06:50 +0000 Subject: [PATCH] * fold-const.c (operand_equal_p): Pay attention to side effects. From-SVN: r29483 --- gcc/ChangeLog | 4 ++++ gcc/fold-const.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fcf41bdc79f..4d0035dfc8f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +Fri Sep 17 15:05:27 1999 Gavin Romig-Koch + + * fold-const.c (operand_equal_p): Pay attention to side effects. + Fri Sep 17 11:14:17 1999 Jason Merrill * libgcc2.c (L_exit): Check for ON_EXIT, not HAVE_ON_EXIT. 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: -- 2.30.2