This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Assignment to volatile objects


Now that the new C standard is out, is there any chance that gcc's behaviour
regarding to volatile lhs in an assignment changes?

This is what it does today:

volatile int a, b;

  a = b = 0;

translates to

  b = 0;
  a = b;

because the standard (up to and including C99) stated that the value of the
assignment operator is the value of the lhs after the assignment.

The C11 standard says the same but then it explicitely states that the
compiler does not have to read back the value of the lhs, not even when the
lhs is volatile.

So it is actually legal now not to read back the lhs. Is there a chance for
the compiler to get a switch which would tell it explicitely not to read the
value back?

Zoltan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]