Difference between -Os and -O2
David Favro
gcc-ml@meta-dynamic.com
Mon Apr 27 12:25:00 GMT 2009
Chao Hieu,
I don't know if this is possible for your target environment, but if
possible, try running valgrind or similar memory-debugging tool. If
not, examine your code carefully for possible access of uninitialized
memory, etc. I have found that very often (but not always), what at
first seems to us to be compiler generating incorrect code is, in fact,
our own bad code. Code that produces behavior that differs between
optimization options is often the result of access of uninitialized
memory. Otherwise, as others have suggested, look at the assembly, but
this is likely only helpful if your program is small or you can narrow
the problem down to a particular small portion of the code.
Good luck,
-- David Favro
More information about the Gcc-help
mailing list