[llvm-commits] [llvm] r161446 - /llvm/trunk/lib/CodeGen/StackProtector.cpp

Aaron Ballman aaron at aaronballman.com
Wed Aug 8 04:46:05 PDT 2012


On Wed, Aug 8, 2012 at 1:23 AM, Chris Lattner <clattner at apple.com> wrote:
>
> On Aug 7, 2012, at 2:20 PM, Aaron Ballman <aaron at aaronballman.com> wrote:
>
>> Do we know why gcc does this?  I'm all for compatibility, but it seems
>> like it's taking away a fairly nice safety feature so I am hoping
>> there's some more logic here.
>
> The logic here was that char arrays are the most likely to be overflowed (because people use poor functions like strcat on them), so we get the most bang for the performance buck by instrumenting them.  Instrumenting other arrays (e.g. float arrays) adds overhead that is less likely to find a bug.

Performance makes sense as to why it's off by default, but it seems
like this would make a fairly sensible option that could be turned on
in debug mode by default to help catch people who overwrite
non-character arrays.

~Aaron




More information about the llvm-commits mailing list