------- Comment #2 from burnus at gcc dot gnu dot org 2009-08-19 13:30 ------- Created an attachment (id=18401) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18401&action=view) Draft patch - first steps but incomplete & will not work
The problem is: CALL S1(d%data) We have the variable "d" which contains first the component reference "data" and then the array reference whole-array. The current check in trans-array.c's gfc_conv_array_parameter is, however: full_array_var = (expr->expr_type == EXPR_VARIABLE && expr->ref->type == REF_ARRAY && expr->ref->u.ar.type == AR_FULL); which returns "false". It gets quite complicated if we want to handle: foo(1)%bar(1:1)%variable(:)(sub:string) Attached patch does the first steps, but it needs some improvements to handle "sym" and "comp" correctly. "sym->" appears all over the place in the rest of the function and it needs to be properly handled. (NOTE: The attached patch will not work!) Cross reference: a) Related PR 41117. Here, one has the same problem as for (1:1) or (j:j) one does not have an element or a whole array but a known-to-be contiguous section. (j:j) is a challenge but one should be able to handle it, (1*i,i) would be more complicated). In the PR one has (:,1:1), i.e. whole-section access on the left followed by an array-element or size-one array-section reference on the right. Caveat: For (1:1), whole array and (:,1:1) - that does not work for assumed-shape arrays - unless the dummy is allocatable. Otherwise they are not contiguous. b) PR 36933. At least some of the examples are identical to the one in comment 0. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41113