Unexpected optimizer behavior

me22 me22.ca@gmail.com
Fri Jun 26 23:17:00 GMT 2009


2009/6/26 Frank Neuhaus <dtag00@gmail.com>:
>
> Yes I agree that since resize is not inlined, the way pixels changes
> during the resize call is unknown to the optimizer operating on main.
> But _after_ this call to resize, all changes to pixels _have_ to be
> caused by main, and thus are known to the optimizer of the main
> function. That means it should be able to tell that pixels cannot
> possibly change after the execution of resize(*). And more
> specificially that it cannot possibly change during the execution of
> the loop.
>

What if resize spawns a thread that wakes up periodically to change
the value?  The compiler can't assume "well-behaved" functions.



More information about the Gcc-help mailing list