diff options
author | Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2010-09-02 22:29:53 +0000 |
---|---|---|
committer | François-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2010-09-02 22:29:53 +0000 |
commit | 36d9e52fff7f2bf5efff6c9e56b7bcd40b7d7963 (patch) | |
tree | 10b30bedfdd9903621bc39b34ee04a0aa7c85f73 /gcc/fortran/trans-intrinsic.c | |
parent | 184866c501bce726b5d01349036e43d7090d40dd (diff) | |
download | gcc-36d9e52fff7f2bf5efff6c9e56b7bcd40b7d7963.zip gcc-36d9e52fff7f2bf5efff6c9e56b7bcd40b7d7963.tar.gz gcc-36d9e52fff7f2bf5efff6c9e56b7bcd40b7d7963.tar.bz2 |
trans-intrinsic.c (gfc_conv_intrinsic_aint): Fix whitespace.
* trans-intrinsic.c (gfc_conv_intrinsic_aint): Fix whitespace.
(gfc_conv_intrinsic_ishft): Only evaluate arguments once.
(gfc_conv_intrinsic_ishftc): Only evaluate arguments once.
* intrinsic.texi (RSHIFT): Fix documentation.
* gfortran.dg/ishft_4.f90: New test.
From-SVN: r163792
Diffstat (limited to 'gcc/fortran/trans-intrinsic.c')
-rw-r--r-- | gcc/fortran/trans-intrinsic.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 3f18883..8f50e6d 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -456,7 +456,7 @@ gfc_conv_intrinsic_aint (gfc_se * se, gfc_expr * expr, enum rounding_mode op) int kind; kind = expr->ts.kind; - nargs = gfc_intrinsic_argument_list_length (expr); + nargs = gfc_intrinsic_argument_list_length (expr); decl = NULL_TREE; /* We have builtin functions for some cases. */ @@ -3235,6 +3235,10 @@ gfc_conv_intrinsic_ishft (gfc_se * se, gfc_expr * expr) tree rshift; gfc_conv_intrinsic_function_args (se, expr, args, 2); + + args[0] = gfc_evaluate_now (args[0], &se->pre); + args[1] = gfc_evaluate_now (args[1], &se->pre); + type = TREE_TYPE (args[0]); utype = unsigned_type_for (type); @@ -3320,7 +3324,7 @@ gfc_conv_intrinsic_ishftc (gfc_se * se, gfc_expr * expr) gcc_unreachable (); } se->expr = build_call_expr_loc (input_location, - tmp, 3, args[0], args[1], args[2]); + tmp, 3, args[0], args[1], args[2]); /* Convert the result back to the original type, if we extended the first argument's width above. */ if (expr->ts.kind < 4) @@ -3330,6 +3334,10 @@ gfc_conv_intrinsic_ishftc (gfc_se * se, gfc_expr * expr) } type = TREE_TYPE (args[0]); + /* Evaluate arguments only once. */ + args[0] = gfc_evaluate_now (args[0], &se->pre); + args[1] = gfc_evaluate_now (args[1], &se->pre); + /* Rotate left if positive. */ lrot = fold_build2 (LROTATE_EXPR, type, args[0], args[1]); |