public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* Fortran LTO and array descriptors.
@ 2018-02-03 17:09 Thomas Koenig
  2018-02-03 17:17 ` Thomas Koenig
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Thomas Koenig @ 2018-02-03 17:09 UTC (permalink / raw)
  To: fortran, Richard Guenther, Jakub Jelinek

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-02-05 10:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-03 17:09 Fortran LTO and array descriptors Thomas Koenig
2018-02-03 17:17 ` Thomas Koenig
2018-02-04 11:42   ` Richard Biener
2018-02-04 11:48     ` Richard Biener
2018-02-04 20:15     ` Thomas Koenig
2018-02-05  6:42       ` Richard Biener
2018-02-04 12:36 ` Richard Biener
2018-02-05  7:54 ` Jakub Jelinek
2018-02-05 10:17   ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).