http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56378
--- Comment #8 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-02-18 20:08:36 UTC --- (In reply to comment #5) ... > function int_fvec2vec (f_vec, n) result (c_vec) > integer f_vec(:) ... > subroutine lat_to_c (Fp, C) bind(c) ... > call lat_to_c2 (c_loc(fvec2vec(ic, n1_ic))) I get – with my half-working patch http://gcc.gnu.org/ml/fortran/2013-02/msg00085.html: call lat_to_c2 (c_loc(fvec2vec(ic, n1_ic))) 1 Error: Argument X at (1) to C_LOC shall be either a POINTER or have the TARGET attribute And I believe that the error is valid. The function result of "fvec2vec" (alias int_fvec2vec) ceases to exist immediately after the function returned – and is thus not suitable for C_LOC. In that case, not even TARGET would help, only POINTER. The example in comment 6 and the original example (for "c_loc(fvec2vec" and "c_loc(tensor2vec") give the same error. Thus, it is merely an ICE-on-invalid code/diagnostic bug. To add some quotes from the standard (F2008, "15.2.3.6 C LOC (X)" – unchanged with TS29113): "Argument. X shall have either the POINTER or TARGET attribute."