From f87f88974b9b8b1b8b3b06dfb64179b23e5a5bf6 Mon Sep 17 00:00:00 2001 From: Dominique d'Humieres Date: Mon, 26 Feb 2018 10:55:39 +0100 Subject: [PATCH] re PR fortran/32957 (C/Fortran interoperability and -fdefault-integer-8) 2018-02-26 Dominique d'Humieres PR fortran/32957 * gfortran.dg/c_f_pointer_shape_tests_2.f03: Use explicit KIND c_int. * gfortran.dg/c_f_pointer_shape_tests_4.f03: Likewise. * gfortran.dg/c_funloc_tests_3.f03: Likewise. * gfortran.dg/c_loc_test.f90: Likewise. * gfortran.dg/c_loc_tests_2.f03: Likewise. * gfortran.dg/proc_decl_17.f90: Likewise. * gfortran.dg/proc_ptr_8.f90: Likewise. From-SVN: r257985 --- gcc/testsuite/ChangeLog | 11 +++++++++++ .../gfortran.dg/c_f_pointer_shape_tests_2.f03 | 12 ++++++------ .../gfortran.dg/c_f_pointer_shape_tests_4.f03 | 12 ++++++------ gcc/testsuite/gfortran.dg/c_funloc_tests_3.f03 | 8 ++++---- gcc/testsuite/gfortran.dg/c_loc_test.f90 | 6 +++--- gcc/testsuite/gfortran.dg/c_loc_tests_2.f03 | 6 +++--- gcc/testsuite/gfortran.dg/proc_decl_17.f90 | 5 +++-- gcc/testsuite/gfortran.dg/proc_ptr_8.f90 | 4 ++-- 8 files changed, 38 insertions(+), 26 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 37ae7517e32..3e0299c2f69 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2018-02-26 Dominique d'Humieres + + PR fortran/32957 + * gfortran.dg/c_f_pointer_shape_tests_2.f03: Use explicit KIND c_int. + * gfortran.dg/c_f_pointer_shape_tests_4.f03: Likewise. + * gfortran.dg/c_funloc_tests_3.f03: Likewise. + * gfortran.dg/c_loc_test.f90: Likewise. + * gfortran.dg/c_loc_tests_2.f03: Likewise. + * gfortran.dg/proc_decl_17.f90: Likewise. + * gfortran.dg/proc_ptr_8.f90: Likewise. + 2018-02-26 Ramana Radhakrishnan PR target/84521 diff --git a/gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_2.f03 b/gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_2.f03 index 5ba1cb640e1..79cf2c1bae3 100644 --- a/gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_2.f03 +++ b/gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_2.f03 @@ -12,7 +12,7 @@ contains use, intrinsic :: iso_c_binding type(c_ptr), value :: cPtr integer(c_int), value :: num_elems - integer, dimension(:), pointer :: myArrayPtr + integer(c_int), dimension(:), pointer :: myArrayPtr integer(c_long_long), dimension(1) :: shape integer :: i @@ -28,7 +28,7 @@ contains type(c_ptr), value :: cPtr integer(c_int), value :: num_rows integer(c_int), value :: num_cols - integer, dimension(:,:), pointer :: myArrayPtr + integer(c_int), dimension(:,:), pointer :: myArrayPtr integer(c_long_long), dimension(2) :: shape integer :: i,j @@ -46,7 +46,7 @@ contains use, intrinsic :: iso_c_binding type(c_ptr), value :: cPtr integer(c_int), value :: num_elems - integer, dimension(:), pointer :: myArrayPtr + integer(c_int), dimension(:), pointer :: myArrayPtr integer(c_long), dimension(1) :: shape integer :: i @@ -61,7 +61,7 @@ contains use, intrinsic :: iso_c_binding type(c_ptr), value :: cPtr integer(c_int), value :: num_elems - integer, dimension(:), pointer :: myArrayPtr + integer(c_int), dimension(:), pointer :: myArrayPtr integer(c_int), dimension(1) :: shape integer :: i @@ -76,7 +76,7 @@ contains use, intrinsic :: iso_c_binding type(c_ptr), value :: cPtr integer(c_int), value :: num_elems - integer, dimension(:), pointer :: myArrayPtr + integer(c_int), dimension(:), pointer :: myArrayPtr integer(c_short), dimension(1) :: shape integer :: i @@ -91,7 +91,7 @@ contains use, intrinsic :: iso_c_binding type(c_ptr), value :: cPtr integer(c_int), value :: num_elems - integer, dimension(:), pointer :: myArrayPtr + integer(c_int), dimension(:), pointer :: myArrayPtr integer(c_int), dimension(1) :: shape1 integer(c_long_long), dimension(1) :: shape2 integer :: i diff --git a/gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_4.f03 b/gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_4.f03 index 8ee79a3b7ea..3f60f17e4bb 100644 --- a/gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_4.f03 +++ b/gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_4.f03 @@ -12,7 +12,7 @@ contains use, intrinsic :: iso_c_binding type(c_ptr), value :: cPtr integer(c_int), value :: num_elems - integer, dimension(:), pointer :: myArrayPtr + integer(c_int), dimension(:), pointer :: myArrayPtr integer(c_long_long), dimension(1) :: shape integer :: i @@ -28,7 +28,7 @@ contains type(c_ptr), value :: cPtr integer(c_int), value :: num_rows integer(c_int), value :: num_cols - integer, dimension(:,:), pointer :: myArrayPtr + integer(c_int), dimension(:,:), pointer :: myArrayPtr integer(c_long_long), dimension(3) :: shape integer :: i,j @@ -47,7 +47,7 @@ contains use, intrinsic :: iso_c_binding type(c_ptr), value :: cPtr integer(c_int), value :: num_elems - integer, dimension(:), pointer :: myArrayPtr + integer(c_int), dimension(:), pointer :: myArrayPtr integer(c_long), dimension(1) :: shape integer :: i @@ -62,7 +62,7 @@ contains use, intrinsic :: iso_c_binding type(c_ptr), value :: cPtr integer(c_int), value :: num_elems - integer, dimension(:), pointer :: myArrayPtr + integer(c_int), dimension(:), pointer :: myArrayPtr integer(c_int), dimension(1) :: shape integer :: i @@ -77,7 +77,7 @@ contains use, intrinsic :: iso_c_binding type(c_ptr), value :: cPtr integer(c_int), value :: num_elems - integer, dimension(:), pointer :: myArrayPtr + integer(c_int), dimension(:), pointer :: myArrayPtr integer(c_short), dimension(1) :: shape integer :: i @@ -92,7 +92,7 @@ contains use, intrinsic :: iso_c_binding type(c_ptr), value :: cPtr integer(c_int), value :: num_elems - integer, dimension(:), pointer :: myArrayPtr + integer(c_int), dimension(:), pointer :: myArrayPtr integer(c_int), dimension(1) :: shape1 integer(c_long_long), dimension(1) :: shape2 integer :: i diff --git a/gcc/testsuite/gfortran.dg/c_funloc_tests_3.f03 b/gcc/testsuite/gfortran.dg/c_funloc_tests_3.f03 index b08d35187f4..2b688582552 100644 --- a/gcc/testsuite/gfortran.dg/c_funloc_tests_3.f03 +++ b/gcc/testsuite/gfortran.dg/c_funloc_tests_3.f03 @@ -9,11 +9,11 @@ contains use iso_c_binding, only: c_funptr, c_int integer(c_int) :: ffunc integer(c_int), value :: j - ffunc = -17*j + ffunc = -17_c_int*j end function ffunc end module c_funloc_tests_3 program main - use iso_c_binding, only: c_funptr, c_funloc + use iso_c_binding, only: c_funptr, c_funloc, c_int use c_funloc_tests_3, only: ffunc implicit none interface @@ -29,7 +29,7 @@ program main end interface type(c_funptr) :: p p = returnFunc() - call callFunc(p, 13,3*13) + call callFunc(p, 13_c_int, 3_c_int*13_c_int) p = c_funloc(ffunc) - call callFunc(p, 21,-17*21) + call callFunc(p, 21_c_int, -17_c_int*21_c_int) end program main diff --git a/gcc/testsuite/gfortran.dg/c_loc_test.f90 b/gcc/testsuite/gfortran.dg/c_loc_test.f90 index 9b120dc9cd2..598a426abfd 100644 --- a/gcc/testsuite/gfortran.dg/c_loc_test.f90 +++ b/gcc/testsuite/gfortran.dg/c_loc_test.f90 @@ -7,7 +7,7 @@ contains subroutine test0() bind(c) use, intrinsic :: iso_c_binding implicit none - integer, target :: x + integer(c_int), target :: x type(c_ptr) :: my_c_ptr interface subroutine test_address(x, expected_value) bind(c) @@ -16,8 +16,8 @@ contains integer(c_int), value :: expected_value end subroutine test_address end interface - x = 100 + x = 100_c_int my_c_ptr = c_loc(x) - call test_address(my_c_ptr, 100) + call test_address(my_c_ptr, 100_c_int) end subroutine test0 end module c_loc_test diff --git a/gcc/testsuite/gfortran.dg/c_loc_tests_2.f03 b/gcc/testsuite/gfortran.dg/c_loc_tests_2.f03 index 8a2911e3d9f..289b6eb97a9 100644 --- a/gcc/testsuite/gfortran.dg/c_loc_tests_2.f03 +++ b/gcc/testsuite/gfortran.dg/c_loc_tests_2.f03 @@ -44,13 +44,13 @@ contains end subroutine test0 subroutine test1() bind(c) - integer, target, dimension(100) :: int_array_tar + integer(c_int), target, dimension(100) :: int_array_tar type(c_ptr) :: my_c_ptr_1 = c_null_ptr type(c_ptr) :: my_c_ptr_2 = c_null_ptr - int_array_tar = 100 + int_array_tar = 100_c_int my_c_ptr_1 = c_loc(int_array_tar) - if(test_array_address(my_c_ptr_1, 100) .ne. 1) then + if(test_array_address(my_c_ptr_1, 100_c_int) .ne. 1) then STOP 3 end if end subroutine test1 diff --git a/gcc/testsuite/gfortran.dg/proc_decl_17.f90 b/gcc/testsuite/gfortran.dg/proc_decl_17.f90 index 36e0f29c6a2..8c897cf24f0 100644 --- a/gcc/testsuite/gfortran.dg/proc_decl_17.f90 +++ b/gcc/testsuite/gfortran.dg/proc_decl_17.f90 @@ -35,7 +35,8 @@ contains end function subroutine check(p,a) - integer a(:) + use ISO_C_BINDING + integer(C_INT) a(:) procedure(abs_fun) :: p character(size(my_message),C_CHAR) :: c(size(a)) integer k,l,m @@ -55,7 +56,7 @@ program prog use m -integer :: i(4) = (/0,6,12,18/) +integer(C_INT) :: i(4) = (/0,6,12,18/) allocate(my_message(1:6)) diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_8.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_8.f90 index c1d69246faf..2e7a3779722 100644 --- a/gcc/testsuite/gfortran.dg/proc_ptr_8.f90 +++ b/gcc/testsuite/gfortran.dg/proc_ptr_8.f90 @@ -27,11 +27,11 @@ PROCEDURE(mytype), POINTER :: ptype,ptype2 CALL init() CALL C_F_PROCPOINTER(funpointer,ptype) -if (ptype(3) /= 9) STOP 1 +if (ptype(3_c_int) /= 9) STOP 1 ! the stuff below was added with PR 42072 call setpointer(ptype2) -if (ptype2(4) /= 12) STOP 2 +if (ptype2(4_c_int) /= 12) STOP 2 contains -- 2.30.2