https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79674

--- Comment #2 from etienne_lorrain at yahoo dot fr ---
Well, I did not really want to link to the store-merging optimisation in
particular, I wanted to point out that order of evaluation inside the function
call are not defined by the standard, so argument evaluation could be changed
to increase optimisation.

Here is an example without using volatile:
------>o--o<---------
static inline void parallel (int c_compliant, ...) {}
struct { unsigned char r, g, b, t; } vol_str;
int external_fct(void);

void fct1 (void)
{
  vol_str.r = 1,
  vol_str.g = 2,
  external_fct(),
  vol_str.b = 3,
  vol_str.t = 0;
}

void fct2 (void)
{
  parallel (vol_str.r = 1, vol_str.g = 2, external_fct(), vol_str.b = 3,
vol_str.t = 0);
}

unsigned fct_use(void) { return vol_str.r; } // do not remove, anonymous
struct!
------>o--o<---------

fct2() could write a 32 bit value and call external_fct() either before or
after, unlike fct1().

Reply via email to