From 795dc5872724ddea1e559b0477f5e5cfb96f0fce Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Tue, 27 May 2008 21:22:01 +0200 Subject: [PATCH] re PR fortran/36316 (type mismatch in binary expression caught by verify_gimple) 2008-05-27 Tobias Burnus PR fortran/36316 * trans-array.c (gfc_set_loop_bounds_from_array_spec): Add missing fold_convert. 2008-05-27 Tobias Burnus PR fortran/36316 * gfortran.dg/assignment_3.f90: New. From-SVN: r136052 --- gcc/fortran/ChangeLog | 6 +++ gcc/fortran/trans-array.c | 4 +- gcc/testsuite/ChangeLog | 5 ++ gcc/testsuite/gfortran.dg/assignment_3.f90 | 61 ++++++++++++++++++++++ 4 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/assignment_3.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 073f5428a16..d879a4c4ec7 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2008-05-27 Tobias Burnus + + PR fortran/36316 + * trans-array.c (gfc_set_loop_bounds_from_array_spec): + Add missing fold_convert. + 2008-05-26 Daniel Franke * fortran/cpp.c (cpp_define_builtins): Remove usage of TARGET_* macros, diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index a691ad5ffef..bc6d13a7fa8 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -472,14 +472,14 @@ gfc_set_loop_bounds_from_array_spec (gfc_interface_mapping * mapping, gfc_apply_interface_mapping (mapping, &tmpse, as->lower[dim]); gfc_add_block_to_block (&se->pre, &tmpse.pre); gfc_add_block_to_block (&se->post, &tmpse.post); - lower = tmpse.expr; + lower = fold_convert (gfc_array_index_type, tmpse.expr); /* ...and the upper bound. */ gfc_init_se (&tmpse, NULL); gfc_apply_interface_mapping (mapping, &tmpse, as->upper[dim]); gfc_add_block_to_block (&se->pre, &tmpse.pre); gfc_add_block_to_block (&se->post, &tmpse.post); - upper = tmpse.expr; + upper = fold_convert (gfc_array_index_type, tmpse.expr); /* Set the upper bound of the loop to UPPER - LOWER. */ tmp = fold_build2 (MINUS_EXPR, gfc_array_index_type, upper, lower); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b94e9d92f9c..556d76eae02 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-05-27 Tobias Burnus + + PR fortran/36316 + * gfortran.dg/assignment_3.f90: New. + 2008-05-27 Richard Sandiford * lib/fortran-torture.exp (get-fortran-torture-options): diff --git a/gcc/testsuite/gfortran.dg/assignment_3.f90 b/gcc/testsuite/gfortran.dg/assignment_3.f90 new file mode 100644 index 00000000000..d843c3200cb --- /dev/null +++ b/gcc/testsuite/gfortran.dg/assignment_3.f90 @@ -0,0 +1,61 @@ +! { dg-do compile } +! PR fortran/36316 +! +! gfortran generated a mismatching tree ("type mismatch in binary expression") +! for array bounds (mixing integer kind=4/kind=8 without fold_convert). +! +MODULE YOMCAIN + +IMPLICIT NONE +SAVE + +TYPE distributed_vector +REAL, pointer :: local(:) +INTEGER(4) :: global_length,local_start +INTEGER(8) :: local_end +END TYPE distributed_vector + +INTERFACE ASSIGNMENT (=) +MODULE PROCEDURE assign_ar_dv +END INTERFACE + +INTERFACE OPERATOR (*) +MODULE PROCEDURE multiply_dv_dv +END INTERFACE + +CONTAINS + +SUBROUTINE assign_ar_dv (handle,pvec) + +! copy array to the distributed_vector + +REAL, INTENT(IN) :: pvec(:) +TYPE (distributed_vector), INTENT(INOUT) :: handle + +handle%local(:) = pvec(:) + +RETURN +END SUBROUTINE assign_ar_dv + +FUNCTION multiply_dv_dv (handle1,handle2) + +! multiply two distributed_vectors + +TYPE (distributed_vector), INTENT(IN) :: handle2 +TYPE (distributed_vector), INTENT(IN) :: handle1 +REAL :: multiply_dv_dv(handle1%local_start:handle1%local_end) + +multiply_dv_dv = handle1%local(:) * handle2%local(:) + +RETURN +END FUNCTION multiply_dv_dv + + +SUBROUTINE CAININAD_SCALE_DISTVEC () +TYPE (distributed_vector) :: PVAZG +TYPE (distributed_vector) :: ZTEMP +TYPE (distributed_vector) :: SCALP_DV + +ZTEMP = PVAZG * SCALP_DV +END SUBROUTINE CAININAD_SCALE_DISTVEC +END MODULE YOMCAIN -- 2.30.2