Re: Unexpected optimizer behavior

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

 



me22 wrote:
> 2009/6/26 Frank Neuhaus <dtag00@xxxxxxxxx>:
>> 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.

Yes, it can and it does.  This would be undefined behaviour.

Andrew.


[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