GCC fixes and optimizations