[Fortran-dev][Patch] Add "rank" field and use it

Tobias Burnus burnus@net-b.de
Sun Mar 31 18:06:00 GMT 2013


This patch adds a "rank" field to the descriptor and uses it. Before the 
information was in the dtype. At the same time, it bumps the maximal 
rank from 7 to 15 as required by Fortran 2008.

RFC: Should the rank be an "int" or some other variable like int8_t, 
int16_t, int32_t or some other data type, signed or unsigned?

Currently, the descriptor is as follows, where CFI_rank_t is an "int"; 
"offset" is specific to gfortran and will have to go, "dtype" will 
become CFI_type_t and attribute of type CFI_attribute_t will have to be 
added.

#define CFI_GFC_CDESC_T(r, type) \
struct {\
   type *base_addr;\
   size_t elem_len;\
   int version; \
   CFI_rank_t rank; \
   size_t offset;\
   CFI_index_t dtype;\
   CFI_dim_t dim[r];\
}


For the required fields (there can be more), see TS29113. "void *", 
"size_t" and "int" are the required types for the first three fields. 
See section 8.3.3 of ftp://ftp.nag.co.uk/sc22wg5/N1901-N1950/N1942.pdf


The patch builds and regtestes without new failures.
I would be happy if someone could glance at the patch and tell me 
whether it is okay.


Future plans: Split off the element length (size) from dtype and set 
"elem_len" instead; additionally, "version" has to be set. Offset has to 
be removed, and the remaining test-case failures have to be fixed. The 
type, version, and elem_len can be moved directly after the declaration 
(instead of setting it at allocatation time); except for BT_CLASS and 
deferred-length chars/DT - for them elem_len and type can only be set at 
ptr assignment and realloc. Some more cleanup should be done for the 
algorithms. And probably we should also change how static arrays are 
handled and how DWARF symbols are generated (extend instead of ubound).
When that all works, we have to think about additional field, whether 
the vptr has to be in the descriptor, and about merging to the 4.9 
trunk. As follow up, the ABI cleanup, TS29113 additions and other things 
should be done. - Assuming, the array-descriptor will be ready early 
enough during stage 1 of GCC 4.9.

Tobiash
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rank.diff
Type: text/x-patch
Size: 36096 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20130331/d1d4ace8/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rank-gen.diff
Type: text/x-patch
Size: 241080 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20130331/d1d4ace8/attachment-0001.bin>


More information about the Gcc-patches mailing list