On Fri, 26 Oct 2007, Andrew Haley wrote:Note that doing so is perfectly fine. But only for local variables that haven't had their addresses taken. The fact is, those kinds of variables really *are* special. They are provably not accessible from any other context, and re-ordering them (or doing anything AT ALL to them - the most basic and very important optimization is caching them in registers, of course) is always purely an internal compiler issue. But if gcc re-orders functions calls with *other* memory accesses, gcc is totally broken. I doubt it does that. It would break on all but the most trivial programs, and it would be a clear violation of even standard C. HOWEVER: the bug that started this thread isn't even "reordering accesses", it's *adding* accesses that weren't there (and please don't mix this up with "volatile", since volatile is a totally unrelated issue and has nothing what-so-ever to do with anything). Linus -
| H. Peter Anvin | Re: [RFC 00/15] x86_64: Optimize percpu accesses |
| Linus Torvalds | Linux 2.6.27-rc5 |
| Ingo Molnar | [announce] "kill the Big Kernel Lock (BKL)" tree |
| Greg KH | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
git: | |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| Ben Hutchings | Re: [GIT]: Networking |
| Jarek Poplawski | [PATCH iproute2] Re: HTB accuracy for high speed |
