Fortran LTO and array descriptors.
Thomas Koenig
tkoenig@netcologne.de
Sat Feb 3 17:09:00 GMT 2018
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.
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