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

Aaron Ballman aaron at aaronballman.com
Mon Aug 13 14:29:31 PDT 2012


I'd like to ping this thread to see if we can get an consensus or not.
 I'm proposing we allow this feature to be controlled by a flag that's
turned on by default for debug builds, even if it's not on Darwin.

~Aaron

On Wed, Aug 8, 2012 at 7:46 AM, Aaron Ballman <aaron at aaronballman.com> wrote:
> 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