From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13135 invoked by alias); 25 Jun 2009 15:43:16 -0000 Received: (qmail 13065 invoked by uid 48); 25 Jun 2009 15:43:02 -0000 Date: Thu, 25 Jun 2009 15:43:00 -0000 Message-ID: <20090625154302.13064.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/40551] Wrong code due to missing copy-in/copy-out stried array to assumed-size dummy In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "burnus at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-06/txt/msg01863.txt.bz2 ------- 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