[Fortran-dev] Implement TS29113 type handling
Tobias Burnus
burnus@net-b.de
Fri Apr 26 20:02:00 GMT 2013
This patch implements the TS29113 type handling. However, there is a
catch: It does not fix any regression but adds two new ones:
gfortran.dg/mvbits_7.f90
gfortran.dg/mvbits_8.f90
The problem with those is that this patch correctly sets the elem_len;
that might cause that elem_len and sm do not agree with another. That
issue shows up with packing:
type t
integer :: i, j
end type t
type(t), pointer :: x(:)
call bar(x(:)%i)
Here, "x(:)%i" has the elem_len=4 (= "integer(4)") while the stride
multiplier is dim[0].sm = 8. Before, the old code used the
TYPE_UNIT_SIZE(element_type(prev-desc)), which was 8. Usually, that
shouldn't cause a problem - except if one doesn't start with the first
element but has a span (possibly with negative strides). In that base,
the code sets: "base_addr[offset]" - and the offset calculation is
based on the element size. It should be "((char*)base_addr) +
byte_offset" instead. Namely, gfc_get_dataptr_offset has to be fixed.
Another issue is that in gfc_trans_create_temp_array, the elem_len
cannot always be set for strings, e.g. the call from TRANSFER where the
string is the result of a function call - in that case, the string
length is not available. I haven't tried to check whether the elem_len
gets properly set later on or not.
But now to the good stuff:
* The type handling now matches TS29113 and in the array functions,
real(10) and real(16) can be distinguished.
* Even more C examples using the TS29113 interop work now (I had to fix
some bugs)
* The used data types in the descriptor has been updated - it is a bit
more compact now
* Some ubound -> extent changes have been done.
Build and regtested on x86-64-gnu-linux.
Do you have comments to that patch? - Or on the general direction/on the
previous patches?
TODO:
* The most obvious candidate is gfc_get_dataptr_offset as that one
caused the new regression. (As follow up: Other code which assumes that
strides are multiples of an element - for the subelement arrays)
* Internally, lower_bound should start with 0 at some cases (see
TS29113) - to fix more of the C interop
* Fix remaining testsuite issues (still 22 test-case files fail), see
also PR56818
* Remove "offset" field
* Other bugs, cleanup, ...
Tobias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: array-desc-type-v2.diff
Type: text/x-patch
Size: 140775 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20130426/ffd3611a/attachment.bin>
More information about the Fortran
mailing list