public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: AW: gcc 3.3 / i386 / -O2 question
       [not found] <BB1F4EFD574E9F409035BDA71C961250023916@exchange.i-bn>
@ 2004-11-16 15:55 ` Luca Benini
  0 siblings, 0 replies; 2+ messages in thread
From: Luca Benini @ 2004-11-16 15:55 UTC (permalink / raw)
  To: Beschorner Daniel; +Cc: gcc

Beschorner Daniel wrote:
lbenini@neuromancer:~$ gcc -O3 test.c
lbenini@neuromancer:~$ ./a.out
-1343238496
lbenini@neuromancer:~$ gcc -O0 test.c
lbenini@neuromancer:~$ ./a.out
-1343238496
lbenini@neuromancer:~$ gcc -v
Reading specs from /usr/lib/gcc-lib/i486-slackware-linux/3.3.4/specs
Configured with: ../gcc-3.3.4/configure --prefix=/usr --enable-shared 
--enable-threads=posix --enable-__cxa_atexit --disable-checking 
--with-gnu-ld --verbose --target=i486-slackware-linux 
--host=i486-slackware-linux
Thread model: posix
gcc version 3.3.4
lbenini@neuromancer:~$ gcc test.s
lbenini@neuromancer:~$ ./a.out
-1474736480

Unable to repeate your problem, with 3.3.4 test.c (see your previuos 
mail) work fine in -O0/-O1/-O2/-O3
your compiler installations has passed check?

Luca Benini

^ permalink raw reply	[flat|nested] 2+ messages in thread

* AW: gcc 3.3 / i386 / -O2 question
@ 2004-11-17 16:45 Beschorner Daniel
  0 siblings, 0 replies; 2+ messages in thread
From: Beschorner Daniel @ 2004-11-17 16:45 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] 2+ messages in thread

end of thread, other threads:[~2004-11-17 16:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <BB1F4EFD574E9F409035BDA71C961250023916@exchange.i-bn>
2004-11-16 15:55 ` AW: gcc 3.3 / i386 / -O2 question Luca Benini
2004-11-17 16:45 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).