Dear all, This patch adds support for THIS_IMAGE(coarray[,dim=]), LCOBOUND and UCOBOUND for bounds only known at run time (be it allocatable arrays, explicit arrays with variables in the explicit bounds or a non-constant value for dim=). For the support, the scalarizer had to be modified and the cobounds had to be saved in the descriptor (and in TYPE_LANG_SPECIFIC(node)). Note: For this patch's THIS_IMAGE and UCOBOUND, the assumption is made that there is only one image (-fcoarray=single). This will be fixed in a later patch. Changes compared to the draft patch (http://gcc.gnu.org/ml/fortran/2011-03/msg00242.html): - New subtest "ex5", which was ICEing with the draft patch - Needed changes to avoid the ICE - Small clean-up of the patch - Added ChangeLog Build and regtested on x86-64-linux. OK for the trunk? Tobias PS: I am not sure that all changes to trans-array.c are required or fully correct. The scalarizer should only be applied to codimensions for THIS_IMAGE/LCOBOUND/UCOBOUND - all other usage should not invoke the codimensions. Side remark: "z", "z(:)", "z(1)" all refer to the local coimage (DIMEN_THIS_IMAGE) - only if "[...]" appears (e.g. "z(:)[2]") a remote image is accessed. This will become relevant for -fcoarray=lib. (At that point, one also needs to make sure that for "z(:)[i] = 5", gfortran does not call the coarray communication library size(z) times but only once.)