public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <jh@suse.cz>
To: Toon Moene <toon@moene.indiv.nluug.nl>
Cc: Richard Henderson <rth@redhat.com>, gcc@gcc.gnu.org
Subject: Re: possible gcse failure: not able to eliminate redundant loads
Date: Mon, 16 Dec 2002 15:38:00 -0000	[thread overview]
Message-ID: <20021216230904.GL3138@kam.mff.cuni.cz> (raw)
In-Reply-To: <3DFE57E1.7020909@moene.indiv.nluug.nl>

> 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)

  parent reply	other threads:[~2002-12-16 23:10 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-13  0:39 Sanjiv Kumar Gupta, Noida
2002-12-13  2:42 ` Richard Henderson
2002-12-13 13:10   ` Toon Moene
2002-12-16 10:15     ` Richard Henderson
2002-12-16 11:32       ` Andrew Haley
2002-12-16 13:13       ` Toon Moene
2002-12-16 13:32         ` Richard Henderson
2002-12-16 14:44           ` Toon Moene
2002-12-16 14:48             ` Toon Moene
2002-12-16 15:29               ` Richard Henderson
2002-12-17 15:20                 ` Toon Moene
2002-12-16 15:38               ` Jan Hubicka [this message]
2002-12-16 16:40           ` Alex Rosenberg
  -- strict thread matches above, loose matches on Subject: below --
2002-12-21 20:36 Robert Dewar
2002-12-19  7:08 Richard Kenner
2002-12-18 18:39 Robert Dewar
2002-12-19  3:02 ` Richard Henderson
2002-12-21 19:49 ` Alexandre Oliva
2002-12-12 23:42 Sanjiv Kumar Gupta, Noida
2002-12-12 21:35 Sanjiv Kumar Gupta, Noida
2002-12-12 21:44 ` Dan Nicolaescu
2002-12-11 22:00 Sanjiv Kumar Gupta, Noida
2002-12-11 22:18 ` Daniel Berlin
2002-12-11 20:32 Sanjiv Kumar Gupta, Noida
2002-12-11  3:30 Sanjiv Kumar Gupta, Noida
2002-12-11 14:53 ` Dale Johannesen
2002-12-11 20:02   ` Daniel Berlin
2002-12-11 20:03     ` Daniel Berlin
2002-12-12 12:25     ` Richard Henderson
2002-12-12 12:28       ` Daniel Berlin
2002-12-12 13:03         ` Richard Henderson
2002-12-12 13:04           ` David Edelsohn
2002-12-12 14:32             ` Richard Henderson
2002-12-12 14:42               ` David Edelsohn
2002-12-12 14:58                 ` Richard Henderson
2002-12-12 15:28                   ` Daniel Berlin
2002-12-13  3:41                     ` Richard Henderson
2002-12-12 20:30                   ` David Edelsohn
2002-12-12 15:29               ` Geoff Keating
2002-12-11  3:27 Sanjiv Kumar Gupta, Noida

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021216230904.GL3138@kam.mff.cuni.cz \
    --to=jh@suse.cz \
    --cc=gcc@gcc.gnu.org \
    --cc=rth@redhat.com \
    --cc=toon@moene.indiv.nluug.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).