This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

AW: gcc 3.3 / i386 / -O2 question


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]