This is the mail archive of the gcc-help@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]

how to disable optimization for particular assignment statements?


Hello,

I have a C code like this:

int foo(void)
{     int phase;
      . . .
      phase = 1;
      phase = 2;
      phase = 3;
      . . .
}

In case of -O0 gcc generates machine instructions for every
assignment 'phase = ...'. But in case of -O2 gcc does not generate
instructions for some assigments. Of course, this is correct. However,
is there any way to tell gcc that 'phase' object is inspected by another
thread, so it should not remove such statements?

Thank you,

Andrew Makhorin



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