http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48814
--- Comment #10 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-02-09 13:03:25 UTC --- For extern void abort (void); struct S { int i; }; struct S arr[32]; volatile int count = 0; struct S __attribute__((noinline)) incr (void) { ++count; } int main() { arr[count++] = incr (); if (count != 2) abort (); return 0; } we can only avoid reading 'count' too many times (once to get at the index for the store and once for updating its value) if we can insert a statement inbetween the call and the store to arr[]. Which we can do only if we are introducing an aggregate temporary - which might work in C, but does not work in C++ when we require return-slot-optimization. Thus, in the face of volatiles and required RSO this is unfixable.