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]

Re: -O2 and volatile


On Thursday 02 October 2003 01:46 pm, Marcus Binny wrote:
> We sometimes find that our code doesn't work after
> using -O2 GCC optimization.  This is usually because
> the compiler decides it can eliminate variables that
> it shouldn't. These variables often reside in ISRs or
> depend on multi-processor interactions.

Try using __volatile__

> Is there a way to find out which variables GCC decided
> to eliminate?

Compile the code with  -pg -fprofile-arcs -ftest-coverage

Then use gcov or gprof.
http://gcc.gnu.org/onlinedocs/gcc-3.3.1/gcc/Gcov.html


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