Your .2 euros turned into high value , i got the point. And yes, gcc got the hidden talent. Cedric Roux-4 wrote: > > rohitgeek wrote: >> mentioned by Ian too, i get what i expect. But why does optimizer does >> so? > > because it can with respect to the semantics of the compiled language. > Your statements assign values to local variables. > There is no side effect. > The values you assign are not used later on. > So they are completely useless. Computing them or not won't change > the semantics of your program. At all. > It's cool that gcc finds that out for cases where your code actually > does something, where optimization is useful. No? > >> Where is the assembly or data gone when doing the earlier way, because if >> we > > You write programs in C, not in assembly language. The C compiler > can compile the way it wants as long as the C semantics is > respected. > >> put some data into registers and done some manipulations, then where are > > This is what you don't understand I guess. Your program doesn't "put some > data into > registers and [does] some manipulations." Your program assigns values to C > variables. > This is another world. > C is not assembly language. > > So in short, as others said, if you want the code to stay there > after optimization, be sure it does real stuff, like returning > the computed value. The computed value has to "escape" the local > scope for it to be "respected" by the optimization. > > My .2 euros. > > -- View this message in context: http://old.nabble.com/optimization-options-not-working-tp27637400p27755423.html Sent from the gcc - Help mailing list archive at Nabble.com.