This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: criteria.html open issues
- To: "Albert D. Cahalan" <acahalan at cs dot uml dot edu>
- Subject: Re: criteria.html open issues
- From: "Zack Weinberg" <zackw at Stanford dot EDU>
- Date: Tue, 29 May 2001 00:22:25 -0700
- Cc: dewar at gnat dot com, gcc at gcc dot gnu dot org
On Mon, May 28, 2001 at 11:08:40PM -0400, Albert D. Cahalan wrote:
I'm going to skip the parts of the message that Daniel answered
already. I don't have anything to add to what he said.
> Adding "volatile" didn't work, and there was too much code
> to switch over to unions.
>
> I think there is/was a pretty clear bug here in fact, even if you
> do love the strict aliasing behavior. Here:
>
> void foo(volatile float f){
> volatile unsigned *u = (volatile unsigned *)&f;
> if(u&WHATEVER){
Volatile means one thing only: the compiler may not assume that the
only thing which can modify this variable is the code it's compiling.
It has zero effect on aliasing rules. In fact, I bet you there's an
(almost) strictly conforming program that breaks if volatile affects
the aliasing rules.
I have to stick an "almost" in there because any use of volatile
automatically makes a program not strictly conforming. But if we take
the last sentence of C99 6.7.3 para 6 out and shoot it (does anyone
have the slightest clue what they _intended_ that sentence to mean?
'cos they can't possibly have intended the literal meaning) then its
effect is quite clearly defined.
--
zw This is, no doubt, the rational strategy; quite possibly the
only one that will work. But it ignores the exigiencies of
the tenure system and is therefore impractical.
-- Jerry Fodor, _The Mind Doesn't Work That Way_