Fix various compilation errors when compiled -O3 vs. an optimized LLVM