summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>2002-11-05 14:32:24 +0000
committeraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>2002-11-05 14:32:24 +0000
commit0a50b321eb84214d8062df61370330c19f927c10 (patch)
tree186141225e3e26e2247c4d66e3760aa63e53a38c
parent0bf0dbac6e182b27379502f06c07d2ac53cd73e1 (diff)
downloadppe42-gcc-0a50b321eb84214d8062df61370330c19f927c10.tar.gz
ppe42-gcc-0a50b321eb84214d8062df61370330c19f927c10.zip
2002-11-05 Andrew Haley <aph@redhat.com>
* fold-const.c (fold): Don't transform (a0 op compound(a1,a2)) to (compound(a1,a0 op a2)) if a0 or a1 have side effects. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@58822 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/fold-const.c4
2 files changed, 8 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ff854be4332..31010abd3db 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2002-11-05 Andrew Haley <aph@redhat.com>
+
+ * fold-const.c (fold): Don't transform (a0 op compound(a1,a2))
+ to (compound(a1,a0 op a2)) if a0 or a1 have side effects.
+
2002-11-05 Richard Sandiford <rsandifo@redhat.com>
* config/mips/mips.h (CANNOT_CHANGE_MODE_CLASS): Move comment to...
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index c08d44e1e3e..c4095e4dd32 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -4783,7 +4783,9 @@ fold (expr)
else if (TREE_CODE_CLASS (code) == '2'
|| TREE_CODE_CLASS (code) == '<')
{
- if (TREE_CODE (arg1) == COMPOUND_EXPR)
+ if (TREE_CODE (arg1) == COMPOUND_EXPR
+ && ! TREE_SIDE_EFFECTS (TREE_OPERAND (arg1, 0))
+ && ! TREE_SIDE_EFFECTS (arg0))
return build (COMPOUND_EXPR, type, TREE_OPERAND (arg1, 0),
fold (build (code, type,
arg0, TREE_OPERAND (arg1, 1))));
OpenPOWER on IntegriCloud