Fortran LTO and array descriptors.

Richard Biener rguenther@suse.de
Sun Feb 4 11:48:00 GMT 2018


On February 4, 2018 12:42:11 PM GMT+01:00, Richard Biener <rguenther@suse.de> wrote:
>On February 3, 2018 6:17:15 PM GMT+01:00, Thomas Koenig
><tkoenig@netcologne.de> wrote:
>>I wrote:
>>
>>> -  descriptor_dimension dim[r];\
>>> +  descriptor_dimension dim[];\
>>>   }
>>
>>> which works well
>>
>>... up to a point, there are numerous dtio failures
>>when regression testing this.
>>
>>So, clearly not ready for prime time :-)
>
>As far as I remember libgfortran has function signatures with the array
>descriptor with the maximum number of dimensions and the frontend
>generates aliased function decls with descriptors of the number of
>dimensions of the actual argument? 
>
>I believe the solution to the problem is to have the frontend emit only
>one declaration matching the library one and passing down pointers to
>descriptors that are accessed via the same full dimension type. 
>
>That can be achieved by either making all array descriptor instances
>full size or by doing _all_ actual accesses via that type. Like in
>pseudo C code:
>
>Array2 two_dim;
>((arrayFullDim *) & two_dim) - >data =... ;
>
>The middle end supports this well enough by supporting placement new. I
>understand that really making all descriptors large would be a bigger
>ABI change or even non-conforming? 

There's also the possibility of a middle end feature like __attribute __((alias_set(T))) that would make otherwise unrelated types share the alias set of another one. This is already possible with using variant types but I guess using those would open a rathole of issues. 

An existing big hammer is to make the libgfortran API use may-alias variants of their argument types.

But as Honza noted one of the issues to fix in the frontend is the presence of multiple incompatible decls of the same libgfortran functions. 

>Richard. 
>
>>	Thomas



More information about the Fortran mailing list