Refactor array descriptor field access
authorRichard Biener <rguenther@suse.de>
Fri, 16 Oct 2020 08:32:26 +0000 (10:32 +0200)
committerRichard Biener <rguenther@suse.de>
Tue, 27 Oct 2020 13:24:57 +0000 (14:24 +0100)
commit6d65ddca42f296b7e4413aac49497698415abce6
tree1762603b173defc33724605271a70aea05876457
parent4a369d199bf2f34e037030b18d0da923e8a24997
Refactor array descriptor field access

This refactors the array descriptor component access tree building
to commonize code into new helpers to provide a single place to
fix correctness issues with respect to TBAA.

The only interesting part is the gfc_conv_descriptor_data_get change
to drop broken special-casing of REFERENCE_TYPE desc which, when hit,
would build invalid GENERIC trees, missing an INDIRECT_REF before
subsetting the descriptor with a COMPONENT_REF.

2020-10-16  Richard Biener  <rguenther@suse.de>

gcc/fortran/ChangeLog:
* trans-array.c (gfc_get_descriptor_field): New helper.
(gfc_conv_descriptor_data_get): Use it - drop strange
REFERENCE_TYPE handling and make sure we don't trigger it.
(gfc_conv_descriptor_data_addr): Use gfc_get_descriptor_field.
(gfc_conv_descriptor_data_set): Likewise.
(gfc_conv_descriptor_offset): Likewise.
(gfc_conv_descriptor_dtype): Likewise.
(gfc_conv_descriptor_span): Likewise.
(gfc_get_descriptor_dimension): Likewise.
(gfc_conv_descriptor_token): Likewise.
(gfc_conv_descriptor_subfield): New helper.
(gfc_conv_descriptor_stride): Use it.
(gfc_conv_descriptor_lbound): Likewise.
(gfc_conv_descriptor_ubound): Likewise.
gcc/fortran/trans-array.c