------- Comment #4 from burnus at gcc dot gnu dot org  2009-06-25 15:43 -------
(In reply to comment #3)
> Another example.

Which is invalid. Mea culpa:
"A procedure ... shall have an explicit interface if ... (3) The procedure has
a result that (a) is an array"

(That is something, -fwhole-file should be able to catch; currently it just
gives an ICE. I failed to find the restriction to specify dimension in F77, but
presumably I simply looked at the wrong place.)


I see three possibilities:

a) Returning a pointer instead of passing by the _result array descriptor by
reference. (As g95 does. Fix in caller+callee)
b) Doing the copy-in/copy-out in the called function (fix in callee)
c) Passing an array descriptor, but one which is contiguous (fix in caller)
d) Variant of A+C: Just pass a pointer and not an array descriptor the function

Notes:
(a) Means that there is only a single copy out. It will break the ABI, but
that's anyway planned.
(b) Means potentially many copy-in/copy-out. This might not be intended (some
people use automatic arrays vs. assumed-shape arrays on purpose to decide
whether a contiguous array or strides should be used - depending on the size
and what the function does, either is faster).
(c) Is a compromise - there is also only a single copy out.
(d) Is a variant of (a) and (c); it save some space but I think only for little
gain.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40551

Reply via email to