From f0b8d9aab46ec64cd1a42ac2bc6d3c47df52a513 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Fri, 19 Jun 1998 01:46:50 +0000 Subject: 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 --- gcc/fold-const.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'gcc/fold-const.c') 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), -- cgit v1.1