From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21599 invoked by alias); 5 Feb 2010 14:24:04 -0000 Received: (qmail 21522 invoked by uid 48); 5 Feb 2010 14:23:48 -0000 Date: Fri, 05 Feb 2010 14:24:00 -0000 Message-ID: <20100205142348.21521.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/42958] Weird temporary array allocation In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rguenth 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/msg00392.txt.bz2 ------- Comment #4 from rguenth at gcc dot gnu dot org 2010-02-05 14:23 ------- (In reply to comment #3) > Subject: Re: Weird temporary array allocation > > On Fri, 5 Feb 2010, pault at gcc dot gnu dot org wrote: > > > ------- Comment #2 from pault at gcc dot gnu dot org 2010-02-05 05:36 ------- > > (In reply to comment #1) > > > > > Why there is a negative check? Well, I do not know. I also can speculate about > > > a poor man's overflow check, which sometimes indeed works, but often fails. > > > > I suspect that you are being generous and that this is rather a sin of omission > > rather than commission. > > > > > > > Paul, what do you think? > > > > I think that your arguments are correct. > > > > > > > > (PS: POSIX Allows "ptr = malloc(0); free(ptr)", where "malloc(0)" returns > > > either NULL or a unique pointer.) > > > > Indeed. > > Btw, should there be the same error reporting or if (allocated) behavior > on Frontend-generated temporaries? I see this from the temporaries > generated by the scalarizer and the introduced control-flow makes it > very hard to remove unnecessary temporaries in the middle-end later. Thus, basically adding an argument to gfc_call_malloc () specifying whether we want to do checking at all and shortcut it from at least gfc_trans_allocate_array_storage (). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42958