diff options
author | Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> | 1998-06-19 01:46:50 +0000 |
---|---|---|
committer | Andreas Schwab <schwab@gcc.gnu.org> | 1998-06-19 01:46:50 +0000 |
commit | f0b8d9aab46ec64cd1a42ac2bc6d3c47df52a513 (patch) | |
tree | 511e2ebe6a5a9b3cd70413e4381c906b737049fb /gcc/fold-const.c | |
parent | c4137c50396559f083f9b618725917022baecbf1 (diff) | |
download | gcc-f0b8d9aab46ec64cd1a42ac2bc6d3c47df52a513.zip gcc-f0b8d9aab46ec64cd1a42ac2bc6d3c47df52a513.tar.gz gcc-f0b8d9aab46ec64cd1a42ac2bc6d3c47df52a513.tar.bz2 |
c-common.c (truthvalue_conversion): Protect side effects in the expression when splitting a complex value.
* c-common.c (truthvalue_conversion): Protect side effects in the
expression when splitting a complex value.
* fold-const.c (fold): Likewise.
From-SVN: r20580
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 73b0189..30499a1 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -5656,10 +5656,14 @@ fold (expr) || TREE_CODE (arg1) == COMPLEX_EXPR)) { tree subtype = TREE_TYPE (TREE_TYPE (arg0)); - tree real0 = fold (build1 (REALPART_EXPR, subtype, arg0)); - tree imag0 = fold (build1 (IMAGPART_EXPR, subtype, arg0)); - tree real1 = fold (build1 (REALPART_EXPR, subtype, arg1)); - tree imag1 = fold (build1 (IMAGPART_EXPR, subtype, arg1)); + tree real0, imag0, real1, imag1; + + arg0 = save_expr (arg0); + arg1 = save_expr (arg1); + real0 = fold (build1 (REALPART_EXPR, subtype, arg0)); + imag0 = fold (build1 (IMAGPART_EXPR, subtype, arg0)); + real1 = fold (build1 (REALPART_EXPR, subtype, arg1)); + imag1 = fold (build1 (IMAGPART_EXPR, subtype, arg1)); return fold (build ((code == EQ_EXPR ? TRUTH_ANDIF_EXPR : TRUTH_ORIF_EXPR), |