Frank Neuhaus <dtag00@xxxxxxxxx> writes: > 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. You are looking for flow-sensitive alias analysis. gcc gets better at that with each release, but there is still a long way to go. At least the last time I looked closely at alias analysis, around gcc 4.3, if a pointer escaped, it escaped. There was no ability to track that a pointer only escaped during part of a function. This is the point where I say that gcc is free software, and contributions are always welcome. Ian