[Patch, fortran] [14/14] Support coarray subreferences: fix gfc_build_array_ref

Mikael Morin mikael.morin@sfr.fr
Fri Oct 7 14:47:00 GMT 2011

This fixes a failing assertion in gfc_build_array_ref.

While array(x,:) still refers to an array, array(x,y) is a single element, 
and thus coarray(x,y) is a descriptor whose data component points to something
that is not an array.
gfc_conv_expr_descriptor, to update data pointer with subreferences, calls
gfc_get_dataptr_offset which in turn calls gfc_build_array_ref, which expects
an array.
In the non-array case, as there is no extra offset corresponding to array
element, there is nothing to do here.
This patch returns early in that case.


PS: I'm not very confident with the span stuff this function is about, so
I wouldn't mind Paul having a look.
-------------- next part --------------
2011-10-06  Mikael Morin  <mikael.morin@sfr.fr>

	PR fortran/50420
	* trans.c (gfc_build_array_ref): If type is not an array, check that
	there is nothing to do, and do nothing.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr50420-14.diff
Type: text/x-diff
Size: 544 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20111007/50873128/attachment.bin>

More information about the Gcc-patches mailing list