On 03/28/2014 10:46 AM, Hannes Frederic Sowa wrote: > On Fri, Mar 28, 2014 at 09:41:41AM +0000, Andrew Haley wrote: >> On 03/28/2014 09:30 AM, Hannes Frederic Sowa wrote: >>> On Fri, Mar 28, 2014 at 09:10:11AM +0000, Andrew Haley wrote: >>>> On 03/28/2014 06:20 AM, dw wrote: >>>>> Using this clobber causes the compiler to flush all (modified) registers >>>>> being used to store memory-based values to memory before executing the >>>>> @code{asm} statement. >>>> >>>> I don't know what a "memory-based" value is. This phrase doesn't help >>>> at all. In addition, it isn't true. Modified registers are not >>>> flushed to memory unless they are clobbered or their address is taken. >>>> This sentence should be deleted. >>> >>> i and sum form your example are not allocated in memory. If you make >>> one of them static you should be able to see the effect. >> >> I know. That's not the point. "memory-based" is not a well-defined >> term. In order to write clear documentation it is necessary either to >> define terms or to use terms that are already well-defined. > > Ok, I see the problem. Maybe something like this by avoiding the term? > > Using this clobber causes the compiler to flush all (modified) registers > being used to store values which gcc decided to originally allocate in > memory before executing the @code{asm} statement.
Not really, no: that's not true. >> What is true here is that all registers used to cache variables that >> are reachable from pointers in the program are flushed. Anything that >> is statically allocated is reachable, as is anything dynamically >> allocated by malloc; auto variables are not reachable unless their >> address is taken. > > One would have to go into detail of various optimizations which could > remove the address taking One would not: any such optimization would be incorrect. Any memory reachable from an inline asm statement with a memory clobber must be flushed to memory. > e.g. IMHO the last sentence of the paragraph already > deals with this. Which last sentence of what paragraph? Andrew.