------- Comment #12 from J-A dot Martin at sympatico dot ca 2009-09-12 16:17 ------- (In reply to comment #11) > (In reply to comment #10) > > > It doesn't work if the 3rd dimension is > 2 > > The test case only shows the array shape. > > It should fill the sample arrays and > > compares. > > The test case is: > > ! { 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 > ! ^^^^^^^^^^^^^^^^^^^^^^ > ! comparison happens here > end subroutine set_table > end program main > > Output for the original test case is: > > $ gfortran original.f90 > $ ./a.out > In: 1 2 3 4 5 6 -1 -2 -3 -4 -5 -6 > Tmp: 1 2 3 4 5 6 -1 -2 -3 -4 -5 -6 > Out: 1 2 3 4 5 6 -1 -2 -3 -4 -5 -6 > > > Do you have a failing test case? If so, please > post it. Are you using the wrong libraries, possibly? >
I was using the wrong libraries. Thank you. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40962