From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31637 invoked by alias); 25 Feb 2010 23:51:34 -0000 Received: (qmail 31447 invoked by uid 48); 25 Feb 2010 23:51:16 -0000 Date: Thu, 25 Feb 2010 23:51:00 -0000 Message-ID: <20100225235116.31446.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/43178] Pointless resetting to NULL for local ALLOCATABLEs 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: 2010-02/txt/msg02625.txt.bz2 ------- Comment #1 from burnus at gcc dot gnu dot org 2010-02-25 23:51 ------- Created an attachment (id=19962) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19962&action=view) Draft patch - regtests, but needs some audit The attached patch drastically reduces the generated code (-fdump-tree-original) for initializations. a) For variables in PROGRAM which are static (note: variables in PROGRAM are implicitly SAVE). b) For all kind of derived types with default initializer, especially those which have allocatable components I am quite confident that the code is correct, however, one should check whether the "dealloc" argument is correct. If it is wrong, there will be either unnecessarily a if(var != NULL) { free } or the program will leak memory. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43178