From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14417 invoked by alias); 4 Feb 2006 20:52:38 -0000 Received: (qmail 14384 invoked by uid 48); 4 Feb 2006 20:52:33 -0000 Date: Sat, 04 Feb 2006 20:52:00 -0000 Message-ID: <20060204205233.14383.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/25806] problems with functions returning array pointers? In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "eedelman at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-02/txt/msg00336.txt.bz2 List-Id: ------- Comment #4 from eedelman at gcc dot gnu dot org 2006-02-04 20:52 ------- Created an attachment (id=10777) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10777&action=view) Patch to fix the bug. We also get into trouble if we try to pass the result of a pointer-to-array returning funtion as an argument to another procedure (e.g. call a_suborutine (x(5)) ) The problem, both for this case and print *, x(5) is that we try to free the temporary used to hold the result. This we mustn't do, since the temporary will be just a shallow copy of the resulting array. The attached patch fixes these problems, but is not yet well tested. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25806