From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28937 invoked by alias); 16 Dec 2002 23:10:04 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 28918 invoked from network); 16 Dec 2002 23:10:02 -0000 Received: from unknown (HELO nikam.ms.mff.cuni.cz) (195.113.18.106) by 209.249.29.67 with SMTP; 16 Dec 2002 23:10:02 -0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 5556B4EC12; Tue, 17 Dec 2002 00:09:04 +0100 (CET) Date: Mon, 16 Dec 2002 15:38:00 -0000 From: Jan Hubicka To: Toon Moene Cc: Richard Henderson , gcc@gcc.gnu.org Subject: Re: possible gcse failure: not able to eliminate redundant loads Message-ID: <20021216230904.GL3138@kam.mff.cuni.cz> References: <20021213093054.GA29293@redhat.com> <3DFA4252.3060309@moene.indiv.nluug.nl> <20021216180441.C3953@redhat.com> <3DFE3FC1.9020802@moene.indiv.nluug.nl> <20021216211245.F4851@redhat.com> <3DFE5562.6030608@moene.indiv.nluug.nl> <3DFE57E1.7020909@moene.indiv.nluug.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3DFE57E1.7020909@moene.indiv.nluug.nl> User-Agent: Mutt/1.3.28i X-SW-Source: 2002-12/txt/msg00963.txt.bz2 > Toon Moene wrote: > > >Richard Henderson wrote: > > > >>On Mon, Dec 16, 2002 at 10:04:01PM +0100, Toon Moene wrote: > >> > >>>BTW, I wasn't aware it's legal to dereference NULL C pointers. > > >>It isn't, of course. But that's the whole point. You've > >>got code that says > >> > >> x = (condition ? *p : 0); > >> > >>i.e. the dereference is protected by a conditional. > > Oh, wait, I see what you mean: > > x = (p ? *p : 0); > > Yes, that's impossible to express in Fortran (90/95/F2K), hence we don't > have to worry about it. I think you can write the for loop. The loop computes pointer past the array boundary that is invisible to fortran but happens in generated code. GCC beleiving that the memory refrence does not trap would move the load ahead in unrolled version of the loop causing program to read past the end. Honza > > [ The way to do this in Fortran is to write: > > IF (ASSOCIATED(P)) THEN > .... USE P > ELSE > .... BETTER KEEP YOUR PAWS OFF .... > ENDIF > ] > > -- > Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290 > Saturnushof 14, 3738 XG Maartensdijk, The Netherlands > Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html > Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)