From 41e5ee68bc52fc14920c096242e1bec6086d5848 Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Thu, 20 Aug 2009 20:16:15 +0000 Subject: re PR fortran/40962 (Conversion problem for f-allocatable -> cptr -> fptr -> f-allocatable) 2009-08-20 Thomas Koenig PR libfortran/40962 * iso_c_binding.c (c_f_pointer_u0): Multiply stride by previous stride. 2009-08-20 Thomas Koenig PR libfortran/40962 * c_f_pointer_tests_4.f90: New test. From-SVN: r150974 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/c_f_pointer_tests_4.f90 | 15 +++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/c_f_pointer_tests_4.f90 (limited to 'gcc') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c341ae8..b3d1357 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-08-20 Thomas Koenig + + PR libfortran/40962 + * c_f_pointer_tests_4.f90: New test. + 2009-08-20 Eric Botcazou * gnat.dg/slice6.adb: New test. diff --git a/gcc/testsuite/gfortran.dg/c_f_pointer_tests_4.f90 b/gcc/testsuite/gfortran.dg/c_f_pointer_tests_4.f90 new file mode 100644 index 0000000..4f5338d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/c_f_pointer_tests_4.f90 @@ -0,0 +1,15 @@ +! { dg-do run } +program main + use iso_c_binding, only: c_ptr, c_loc, c_f_pointer + implicit none + integer, dimension(2,1,2), target :: table + table = reshape ( (/ 1,2,-1,-2/), (/2,1,2/)) + call set_table (c_loc (table)) +contains + subroutine set_table (cptr) + type(c_ptr), intent(in) :: cptr + integer, dimension(:,:,:), pointer :: table_tmp + call c_f_pointer (cptr, table_tmp, (/2,1,2/)) + if (any(table_tmp /= table)) call abort + end subroutine set_table +end program main -- cgit v1.1