Fortran LTO and array descriptors.

Richard Biener rguenther@suse.de
Sun Feb 4 12:36:00 GMT 2018


On February 3, 2018 6:09:41 PM GMT+01:00, Thomas Koenig <tkoenig@netcologne.de> wrote:
>I have been looking at PR 68649 and 68717. They are the
>same bug, really (and there are quite a few more).
>
>Jakub has written a good analysis of the problem at
>https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68649#c12 .
>
>To sum it up, we create different types for each rank of
>array, and then call the library. When we call the
>same function with different ranks, lto complains, with
>good reason.
>
>The last comment, by Richard, ends with the rather
>pessimistic "Thus even the proposed fix won't end up working."
>
>This problem prevents users from a lot of LTO use cases. It also
>prevents us from using LTO with the library (although I
>strongly suspect that there are also other stumbling blocks).
>
>So, what to do?  On the libfortran side, I tried out the patch
>
>Index: libgfortran.h
>===================================================================
>--- libgfortran.h       (Revision 257347)
>+++ libgfortran.h       (Arbeitskopie)
>@@ -345,7 +345,7 @@ struct {\
>    size_t offset;\
>    dtype_type dtype;\
>    index_type span;\
>-  descriptor_dimension dim[r];\
>+  descriptor_dimension dim[];\
>  }
>
>which works well, but that only solves the lesser half of the problem.

Note that using this type on the library side is a good thing in any case. Maybe your problem with this is that you change the macroized version that is eventually used in sizeof expressions rather than only for function argument declarations? 

Richard. 

>Would it be possible and useful, when passing a pointer to an
>array descriptor, to cast this to a type with a flexible array
>member?
>
>Formally, this should still be OK for stage 4, because several
>of the bugs associated with this problems are regressions.
>
>Comments?  Good/bad idea?  Anybody volunteer to do it (I don't have
>the trans-* fu for it)?
>
>Regards
>
>	Thomas



More information about the Fortran mailing list