delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/29/08:34:29

Message-Id: <1.5.4.32.19970829123149.006ad1a4@dce03.ipt.br>
Mime-Version: 1.0
Date: Fri, 29 Aug 1997 09:31:49 -0300
To: ksharrel AT mindspring DOT com, djgpp AT delorie DOT com
From: Cesar Scarpini Rabak <csrabak AT dce03 DOT ipt DOT br>
Subject: Re: OmniBasic benchmark

At 03:59 29/08/97 GMT, Kelly Shane Harrelson wrote:
[funny dicussion snipped]

>
>With the -O3 optimization turned on, it really is a "do nothing loop".
>GCC will detect that the result stored in x is never used and thus
>will never calculate it.  Since that is the only instruction in the
>loop, it willremove the loop.  The program should run instaneously.
>-Shane
>
>

GCC is a bit smarter... it will calculate the last assignment, to maintain
the semantics of the loop. At the exit of this code snippet there should be
a x variable assigned with the value of 1000000000 - 1.

I'm not sure if this is the way -O3 works though. Curious hackers could
compile this with assembly output and check the resulting code.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Cesar Scarpini Rabak                      E-mail: csrabak AT ipt DOT br
DME/ASC                                   Phone: 55-11-268-3522 Ext.350
IPT - Instituto de Pesquisas Tecnologicas Fax:   55-11-268-5996
Av. Prof. Almeida Prado, 532.  Sao Paulo - SP 05508-901 BRAZIL
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019