This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
-fstack-protector and STL string
- From: "Martin Richtarsky" <s at martinien dot de>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 24 Mar 2016 12:32:33 +0100
- Subject: -fstack-protector and STL string
- Authentication-results: sourceware.org; auth=none
Hi all,
we are using the -fstack-protector compiler option with gcc 5.x to detect
stack smashing. While analyzing a performance regression resulting from
this I found the instrumentation is also done for our STL string
implementation which has an interned buffer for short strings. So
basically a function having an object of that string class on the stack
would incur some performance overhead due to checking, although it can be
argued that the string class is pretty safe.
Is there a way of excluding either a class or a class member from
triggering the instrumentation?
I have noticed that switching to wchar_t (e.g. unsigned short on x86)
already removes the checking, which means that STL wstring is not checked.
However, there is no 1 byte type I could use for string which avoids the
checking.
Any ideas?
Thanks and best regards,
Martin