From: roy@mchip00.med.nyu.edu (Roy Smith)
Subject: Re: horrible "cc -O" bug (DU 3.2c)
Date: 1997/05/11 [thread overview]
Message-ID: <5l5i98$hbk$1@news.nyu.edu> (raw)
In-Reply-To: 33763487.7250953E@highway1.com
"Gerald A. Feldman" <gaf@highway1.com> writes:
>First of all, from looking at the code, it does not appear to be a code
>generation bug at all. It is only a bug if the code beyond the && would
>cause a side effect, such as invoke a function, modify a variable, or
>cause an exception.
That's like saying that if the code generated for "x = 3" actually assigns
the value 4 to x, it's only a bug if the value of x is used later in the
program.
The language semantics say that in "x && y", y is not evaluated unless x is
true. This lets you do things like "xp && *xp". Or "is_valid(foo) &&
get_value(foo)". Or "x < 3 && x++". Some of those may be ugly, but they
are legal, and all require that the part after the && not be evaluated if
the part before the && is false.
Maybe I just misunderstood what is going on, but if the compiler doesn't
guarantee that behavior, it's broken (and I can start having nightmares).
If the compiler does indeed guarantee it, then I guess I just misunderstood
the original post.
> The newer Alpha chips quad issue instructions, which means that the chip
> can execute 4 instructions in parallel. All Digital compilers and
> assemblers schedule the generated code for optimal execution. The
> instructions are rearranged based on latencies and other interactions. The
> scheduler knows the issue rules, and tries to schedule the instructions to
> take advantage of this.
Multiple instruction scheduling is a kind of black magic invented to give
the hardware guys nightmares. As long as they did their job right (i.e.
invested a sufficient number of sleepless nights sitting bolt upright in bed
at 3AM in a cold sweat), us software types can sleep nights knowing that the
language semantics are being obeyed, no matter how ugly it may get inside
that funny looking chip with the cooling fins.
--
Roy Smith <roy@popmail.med.nyu.edu>
New York University School of Medicine
Copyright 1997 Roy Smith
For-profit redistribution prohibited
next prev parent reply other threads:[~1997-05-11 4:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-05-09 4:00 horrible "cc -O" bug (DU 3.2c) Mark Bartelt
1997-05-09 4:00 ` John Hascall
1997-05-10 4:00 ` Gerald Feldman
1997-05-11 4:00 ` Roy Smith
1997-05-11 4:00 ` Michael C. Grant
1997-05-11 4:00 ` Gerald A. Feldman
1997-05-11 4:00 ` Roy Smith [this message]
1997-05-12 4:00 ` Jeff Sullivan USG
1997-05-12 4:00 ` Gerald A. Feldman
1997-05-12 4:00 ` Mark Bartelt
1997-05-12 4:00 ` Andy Isaacson
1997-05-12 4:00 ` John Reinitz
1997-05-13 4:00 ` Mark Bartelt
1997-05-12 4:00 ` Jeff Sullivan USG
1997-05-12 4:00 ` Peter Kocourek
1997-05-12 4:00 ` Bob Vickers
1997-05-09 4:00 ` Jonathan Rozes
[not found] ` <5l7hap$7la@usenet.pa.dec.com>
1997-05-12 4:00 ` Gerald A. Feldman
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox