aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorAndrew Haley <aph@redhat.com>2002-11-05 14:32:24 +0000
committerAndrew Haley <aph@gcc.gnu.org>2002-11-05 14:32:24 +0000
commit5c7cd6636da2ffa19df7094f396362b6c8b35153 (patch)
tree186141225e3e26e2247c4d66e3760aa63e53a38c /gcc/fold-const.c
parent97ab11755d8d6d19e35bbf0b50e25a543722d8f4 (diff)
downloadgcc-5c7cd6636da2ffa19df7094f396362b6c8b35153.zip
gcc-5c7cd6636da2ffa19df7094f396362b6c8b35153.tar.gz
gcc-5c7cd6636da2ffa19df7094f396362b6c8b35153.tar.bz2
fold-const.c (fold): Don't transform (a0 op compound(a1,a2)) to (compound(a1,a0 op a2)) if...
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. From-SVN: r58822
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index c08d44e..c4095e4 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))));