http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50269
kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargl at gcc dot gnu.org --- Comment #1 from kargl at gcc dot gnu.org 2011-09-01 20:24:42 UTC --- This allows the code to compile, but one then gets a segfault or the right answer depending on memory layout. I think trans-expr.c(conv_isocbinding_procedure) needs to be updated as well, but don't know what needs to be done (yet). Index: resolve.c =================================================================== --- resolve.c (revision 178329) +++ resolve.c (working copy) @@ -2809,7 +2809,8 @@ gfc_iso_c_func_interface (gfc_symbol *sy interoperable. */ if (args_sym && args_sym->attr.dimension) { - if (args_sym->as->type == AS_ASSUMED_SHAPE) + if (args_sym->as->type == AS_ASSUMED_SHAPE + && args->expr->ref->u.ar.type != AR_ELEMENT) { gfc_error ("Assumed-shape array '%s' at %L " "cannot be an argument to the " troutmask:sgk[215] gfc4x -o z foo.f90 && ./z Calling test() c_loc(aa) = 140737488344288 troutmask:sgk[216] gfc4x -o z foo.f90 && ./z Segmentation fault (core dumped) program gf use iso_c_binding real(c_double), dimension(1:10), target :: a ! a = 42 ! print *, 'Calling test()' call test(a) contains subroutine test(aa) real(c_double), dimension(:), target :: aa type(c_ptr), pointer :: b b = c_loc(aa(1)) print '(A,I0)', 'c_loc(aa) = ', b end subroutine test end program gf