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
This commit is contained in:
Lee Millward 2007-07-21 17:59:39 +00:00 committed by Lee Millward
parent 3c7471ff79
commit ffd82975cf
4 changed files with 54 additions and 9 deletions

View File

@ -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

View File

@ -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);
}
}

View File

@ -1,3 +1,8 @@
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>
* gcc.dg/inline-23.c: Use pointer sized type for cast from pointer.

View File

@ -0,0 +1,28 @@
! 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