aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorLee Millward <lee.millward@gmail.com>2007-07-21 17:59:39 +0000
committerLee Millward <lmillward@gcc.gnu.org>2007-07-21 17:59:39 +0000
commitffd82975cfd8e70620b85e376d11b0169cf7d3b7 (patch)
treef11e36af4903dff7483270fdca24458ec6221d96 /gcc/fortran
parent3c7471ff79b86d7a8992c641b3f93f2cc37ee059 (diff)
downloadgcc-ffd82975cfd8e70620b85e376d11b0169cf7d3b7.zip
gcc-ffd82975cfd8e70620b85e376d11b0169cf7d3b7.tar.gz
gcc-ffd82975cfd8e70620b85e376d11b0169cf7d3b7.tar.bz2
re PR fortran/32823 (internal compiler error: in gfc_trans_assignment_1)
PR fortran/32823 * trans-intrinsic.c (gfc_conv_intrinsic_int): Evaluate all arguments passed, not just the first one. Adjust code to refer to "args[0]" instead of "arg" as a result. * gfortran.dg/int_2.f90: New test. From-SVN: r126810
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog7
-rw-r--r--gcc/fortran/trans-intrinsic.c23
2 files changed, 21 insertions, 9 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 476b73e..575e1e9 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+2007-07-21 Lee Millward <lee.millward@gmail.com>
+
+ PR fortran/32823
+ * trans-intrinsic.c (gfc_conv_intrinsic_int): Evaluate all
+ arguments passed, not just the first one. Adjust code to
+ refer to "args[0]" instead of "arg" as a result.
+
2007-07-19 Christopher D. Rickett <crickett@lanl.gov>
PR fortran/32600
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index e1383f6..02a64e5 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -479,32 +479,37 @@ static void
gfc_conv_intrinsic_int (gfc_se * se, gfc_expr * expr, enum rounding_mode op)
{
tree type;
- tree arg;
+ tree *args;
+ int nargs;
- /* Evaluate the argument. */
+ nargs = gfc_intrinsic_argument_list_length (expr);
+ args = alloca (sizeof (tree) * nargs);
+
+ /* Evaluate the argument, we process all arguments even though we only
+ use the first one for code generation purposes. */
type = gfc_typenode_for_spec (&expr->ts);
gcc_assert (expr->value.function.actual->expr);
- gfc_conv_intrinsic_function_args (se, expr, &arg, 1);
+ gfc_conv_intrinsic_function_args (se, expr, args, nargs);
- if (TREE_CODE (TREE_TYPE (arg)) == INTEGER_TYPE)
+ if (TREE_CODE (TREE_TYPE (args[0])) == INTEGER_TYPE)
{
/* Conversion to a different integer kind. */
- se->expr = convert (type, arg);
+ se->expr = convert (type, args[0]);
}
else
{
/* Conversion from complex to non-complex involves taking the real
component of the value. */
- if (TREE_CODE (TREE_TYPE (arg)) == COMPLEX_TYPE
+ if (TREE_CODE (TREE_TYPE (args[0])) == COMPLEX_TYPE
&& expr->ts.type != BT_COMPLEX)
{
tree artype;
- artype = TREE_TYPE (TREE_TYPE (arg));
- arg = build1 (REALPART_EXPR, artype, arg);
+ artype = TREE_TYPE (TREE_TYPE (args[0]));
+ args[0] = build1 (REALPART_EXPR, artype, args[0]);
}
- se->expr = build_fix_expr (&se->pre, arg, type, op);
+ se->expr = build_fix_expr (&se->pre, args[0], type, op);
}
}