On 08/17/14 09:57, Timo Sintonen via D.gnu wrote:

> What is the purpose of volatile_dummy? Even if it is not used,

Ensuring ordering, w/o it the compiler could reorder operations
on different volatile objects. (Which isn't necessarily a bad thing,
but people expect certain semantics of 'volatile', so it would be
a bad and dangerous default)

> the address for it is calculated in several places.

It's completely optimized away for me (I'm testing on x86). Can you
show the emitted code?

> The struct members are defined saparately. This means the address
> of every member is stored and fetched separately. The compiler
> seems to remove some of these and use the pointer, but I am not
> sure what happens when the structs are bigger.

Yes, the compiler does not to generate optimal code, but so far I've
only seen dead immediate-constant->register loads; so it's not a
huge problem.

artur

Reply via email to