It's fine to mix different optimization levels and if that
makes the problem go away thats nice. My experience though
is that if behavior changes in a C program based on different
optimization flags is almost always due to a memory bug; maybe
someone can try running purify on aolserver/nsxml?
Anyway, I do -g -O2 on everything and have not had any problems either.
As for debugging things compiled -g -O2, usually it's pretty
easy to do. Your life is easier when you have debugable
executables and with gcc allowing optimization together with
debug symbols there aren't too many reasons not to always
have the symbols.