Re: Unexpected optimizer behavior

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 29, 2009 at 11:42 AM, Andrew Haley<aph@xxxxxxxxxx> wrote:
> This assumption is wrong.  main() is called by another function, usually
> something in crtn, and gcc has no way to know that the calling function
> will not access pixels when main() exits.

Of course - what happens _after_ main() cannot be anlayzed by the
optimizer, because pixels could have been passed around to somewhere
else by resize(). But this is also completely irrelevant to optimizing
this loop. That was what I was saying: After the call to resize
resize(), there is nothing else apart from main itself that can
possibly change pixels until main() exits!

Oh and by the way: I have tested this in Visual Studio as well and it
is able to analyze this situation correctly. There is essentially no
difference in the loop-code it generates, no matter whether resize is
inlined or not. IMHO gcc is being very clever in this situation....

Cheers
   Frank


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux