This article: http://lwn.net/Articles/278137/ talks about how optimization by GCC (and other C compilers) can eliminate some overrun checks. Of course that can reduce security. The article also talks about how to work around the inconvenient optimization.