Commit ffd82975 by Lee Millward Committed by Lee Millward

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
parent 3c7471ff
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> 2007-07-19 Christopher D. Rickett <crickett@lanl.gov>
PR fortran/32600 PR fortran/32600
......
...@@ -479,32 +479,37 @@ static void ...@@ -479,32 +479,37 @@ static void
gfc_conv_intrinsic_int (gfc_se * se, gfc_expr * expr, enum rounding_mode op) gfc_conv_intrinsic_int (gfc_se * se, gfc_expr * expr, enum rounding_mode op)
{ {
tree type; 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); type = gfc_typenode_for_spec (&expr->ts);
gcc_assert (expr->value.function.actual->expr); 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. */ /* Conversion to a different integer kind. */
se->expr = convert (type, arg); se->expr = convert (type, args[0]);
} }
else else
{ {
/* Conversion from complex to non-complex involves taking the real /* Conversion from complex to non-complex involves taking the real
component of the value. */ 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) && expr->ts.type != BT_COMPLEX)
{ {
tree artype; tree artype;
artype = TREE_TYPE (TREE_TYPE (arg)); artype = TREE_TYPE (TREE_TYPE (args[0]));
arg = build1 (REALPART_EXPR, artype, arg); 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);
} }
} }
......
2007-07-21 Lee Millward <lee.millward@gmail.com>
PR fortran/32823
* gfortran.dg/int_2.f90: New test.
2007-07-21 Rask Ingemann Lambertsen <rask@sygehus.dk> 2007-07-21 Rask Ingemann Lambertsen <rask@sygehus.dk>
* gcc.dg/inline-23.c: Use pointer sized type for cast from pointer. * gcc.dg/inline-23.c: Use pointer sized type for cast from pointer.
! PR fortran/32823
! { dg-do compile }
! { dg-final { cleanup-modules "token_module" } }
module token_module
integer, parameter :: INT8 = SELECTED_INT_KIND(16)
integer, parameter :: REAL8 = SELECTED_REAL_KIND(12)
contains
subroutine token_allreduce_i8_v(dowhat, array, result, length)
character(*), intent(in) :: dowhat
integer, intent(in) :: length
integer(INT8), intent(in) :: array(*)
integer(INT8), intent(inout) :: result(*)
real(REAL8) :: copy_r8(length), result_r8(length)
result(1:length) = int(result_r8(1:length), INT8)
end subroutine token_allreduce_i8_v
end module token_module
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment