[fortran, patch] Fix pow op.
Feng Wang
wf_cs@yahoo.com
Thu Aug 4 04:12:00 GMT 2005
--- Feng Wang <wf_cs@yahoo.com> wrote:
> This patch fixed pow operation. We should evaluate the first operator.
>
> Index: trans-expr.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/fortran/trans-expr.c,v
> retrieving revision 1.55
> diff -c -3 -p -r1.55 trans-expr.c
> *** trans-expr.c 4 Aug 2005 03:06:12 -0000 1.55
> --- trans-expr.c 4 Aug 2005 03:37:41 -0000
> *************** gfc_conv_power_op (gfc_se * se, gfc_expr
> *** 654,659 ****
> --- 654,660 ----
>
> gfc_init_se (&lse, se);
> gfc_conv_expr_val (&lse, expr->value.op.op1);
But I am not sure we should use gfc_conv_expr_val or gfc_conv_expr here. Since
the assignment to a temporary variable has side effect, we should do carefully.
> + lse.expr = gfc_evaluate_now (lse.expr, &lse.pre);
> gfc_add_block_to_block (&se->pre, &lse.pre);
>
> gfc_init_se (&rse, se);
> > ! { dg-do run }
> integer i
> i=0
> if (a(i) ** 5 .ne. 1) call abort()
> contains
> function a (i)
> integer a, i
> i = i + 1
> a = i
> end function
> end
>
Best Regards,
Feng Wang
--
Creative Compiler Research Group,
National University of Defense Technology, China.
_________________________________________________________
Yahoo! Mail - now with Autocomplete that helps fill email addresses.
http://mail.yahoo.com.sg
More information about the Gcc-patches
mailing list