http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46007
--- Comment #1 from Mikael Morin <mikael at gcc dot gnu.org> 2010-10-13 15:30:06 UTC --- (In reply to comment #0) > Interestingly, if one uses: > tmp = shape(int1d_retrieved) > one has: > integer(kind=4) A.1[1]; > atmp.0.dim[0].lbound = 0; > atmp.0.dim[0].ubound = 0; > atmp.0.data = (void * restrict) &A.1; > _gfortran_shape_4 (&atmp.0, D.1525); > > which works. For some reason (scalarizer?) .data is not allocated/associated > and the bounds are not set for the first test case. The difference is probably (I haven't checked) that with the assignment, one uses gfc_trans_arrayfunc_assign, which prevents the creation of a temporary for the return value. But I think it is valid to pass unallocated descriptors. The called function takes care of allocating the array data and filling the descriptor in that case. I have tried with matmul for example and it works basically.