------- Comment #3 from burnus at gcc dot gnu dot org 2009-08-04 16:09 ------- Thomas, as you know a bit about the array descriptor, can you have a look? The problem seems to be in libgfortran/intrinsics/iso_c_binding.c's c_f_pointer*
Simplified test case: One: 1 2 -1 -2 Two: 1 2 2 -1 ^^^^^ The dump is trival: D.1581 = (void *) &table; D.1582 = D.1581; set_table (&D.1582); and c_f_pointer_i4 (*cptr, &table_tmp, &parm.1); Thus the issue must be in c_f_pointer_i4 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/)) ! print '(a,12i3)', "One:", table 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/)) ! print '(a,12i3)', "Two:", table_tmp end subroutine set_table end program main -- burnus at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |burnus at gcc dot gnu dot | |org, tkoenig at gcc dot gnu | |dot org Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 GCC build triplet|4.5.0 Ref. svn r150253 | GCC host triplet|Linux 32bit, 64bit, MAC OS X| GCC target triplet|gcc, gfortran 4.3.2, 4.4.0, | |4.5.0 | Keywords| |wrong-code Known to fail| |4.5.0 4.4.0 4.3.2 Last reconfirmed|0000-00-00 00:00:00 |2009-08-04 16:09:45 date| | Summary|[4.5.0,4.4.0,4.3.2] |Conversion problem for f- |conversion problem for f- |allocatable -> cptr -> fptr |allocatable -> cptr -> fptr |-> f-allocatable |-> f-allocatable | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40962