public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* AW: gcc 3.3 / i386 / -O2 question
@ 2004-11-17 16:41 Beschorner Daniel
  0 siblings, 0 replies; only message in thread
From: Beschorner Daniel @ 2004-11-17 16:41 UTC (permalink / raw)
  To: 'Robert Dewar', Steven Bosscher, 'matz@suse.de'
  Cc: Luca Benini, Dave Korn, 'Gerald Pfeifer', gcc, gcc-help

Now I'm nearly glad to have sent this "illegal" code to list, because this
discussion was very interesting to me.
But as Michael said, if you put "#include <stdio.h>" above it and turn "int"
to "unsigned int" you will have nice deterministic C code and it does still
miscompile.
FYI, the code is developed from a orginal MD4 hash routine of the Samba 3
suite that miscompiles on my machine and during making it little and easy to
see whether there is a compiler bug or not lazyness made me use "int" from
the original "uint32" type.
But the compilers of all people tested it with "int" seem to take the same
path through "undefined chaos" even with O2 :-)

Thanks to all
Daniel

-----Ursprüngliche Nachricht-----
Von: Robert Dewar [mailto:dewar@gnat.com]
Gesendet: Mittwoch, 17. November 2004 14:07
An: Steven Bosscher
Cc: Luca Benini; Dave Korn; 'Gerald Pfeifer'; 'Beschorner Daniel';
gcc@gcc.gnu.org; gcc-help@gcc.gnu.org
Betreff: Re: gcc 3.3 / i386 / -O2 question


Steven Bosscher wrote:

> Hah, but there you are.  Define "non-altering-semantic-option"
> for something that according to the standard does not *have* 
> semantics. 

Reminds me of a famous exchange in the discussion of Algol-68
semantics at one meeting. Someone asked Charles Lindsay what
undefined meant. He replied that it could mean anything, up
to and including "unimaginable chaos". Geerhardt Goos then
enquired (in a rather emphatic manner) "But how can I implement
unimaginable chaos in my compiler?") :-)

One interesting paragraph in the Algol-68 report specifies that
at any point in the execution of the program, further elaboration
of the program can be "interrupted", and that if such an
interrupt occurs, further semantics are undefined.

Sounds a bit drastic, until you learn that the paragraph derived
from a discussion of what the situation was if an earthquake
occurred during the execution of a program, causing the
computer to be destroyed. Operating in a formal mode, the
committee decided that they could not have a specification
that would require conforming compilers to ensure against
the possibility of earthquakes :-)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-11-17 16:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-17 16:41 AW: gcc 3.3 / i386 / -O2 question Beschorner Daniel

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