On 09/10/2015 10:38 AM, Florian Weimer wrote:
On 09/10/2015 06:30 PM, Martin Sebor wrote:
On 09/09/2015 09:58 AM, Florian Weimer wrote:
On 09/08/2015 05:45 PM, Jonathan Wakely wrote:
I doubt we can achieve the complexity goals in all cases. I expect
that
for (int i = 0; i < 10000; ++i) {
vector[i];
}
is optimized away in default mode, but with _GLIBCXX_ASSERTIONS, it is
not.
The last time I looked at this, GCC was unable to move bounds checks
out
of loops.
Maybe we don't want to make _FORTIFY_SOURCE imply _GLIBCXX_ASSERTIONS
then, so they can be enabled independently. We don't have to make that
decision right away.
I think we should try with _FORTIFY_SOURCE first. The above case looks
rather artificial. If there is a visible performance impact, maybe we
can get the compiler to eliminate the vector bounds checks in many cases.
There is quite a bit of documentation of _FORTIFY_SOURCE that explains
its effect on user code.
I think there are only random blog articles discussing aspects of it,
most of them slightly incorrect or outdated.
_FORTIFY_SOURCE is a GLIBC feature test macro. It's documented
in <features.h> and mentioned in some of its online manuals.
For example:
http://man7.org/linux/man-pages/man7/feature_test_macros.7.html
or here:
http://manpages.ubuntu.com/manpages/hardy/man7/feature_test_macros.7.html
Martin