[Patch,Fortran] PR 40632 - Add CONTIGUOUS attribute (part 1)

Tobias Burnus burnus@net-b.de
Sun Jun 20 10:00:00 GMT 2010


Dear all, hi Mikael,

here comes an updated patch.

On 19.06.2010 09:45, Mikael Morin wrote:
> The error message is a bit cryptic to me.

Since there were no better suggestion, I kept it. Hopefully, no one will
run into this message.

>> +  for (ref = expr->ref; ref; ref = ref->next)
>> +    {
>> +      if (ref->type == REF_COMPONENT)
>> +    part_ref  = ref;
>> +      else if (ref->type == REF_SUBSTRING)
>> +      return false;
>> +      else
>> +    {
>> +      if (ar)
>> +        return false; /* Array shall be last part-ref. */
> I think this should be outside the else block. For array(:)%component
> cases.

I have moved it before REF_COMPONENT.

>> +  gcc_assert (ar->type != AR_UNKNOWN);
> You can even assert that ar->type == AR_SECTION.
Done.

> I think you are not rejecting the case array(:,1,:)
Fixed - and added a test case.


Additional fixes in trans-array.c's gfc_conv_array_parameter:

* I now use gfc_is_simply_contiguous for no_pack, which is shorter and
more correct

* I had completely forgotten about passing "array(::2)" to " ...,
contiguous :: dummy(:)". The standard says (slightly hidden) that this
is valid and that a copy-in/copy-out can happen if the variable is not
simply contiguous (cf. 12.5.2.13 and 12.3.3 [paragraph 9 and 10]). Well,
that's what the patch now does: It (un)packs the array if needed. (+
test case added)


Build and regtested on x86-64-linux.
OK for the trunk?

Tobias

PS: I think one can clean up a bit the contiguity checks in
gfc_conv_array_parameter as gfc_is_simply_contiguous covers a lot -
though it does not cover all items.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: contiguous3.diff
Type: text/x-patch
Size: 35519 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100620/03a46fe1/attachment.bin>


More information about the Gcc-patches mailing list