Mail Archives: djgpp/1997/08/29/08:34:29
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 -