diff options
author | Martin Sebor <msebor@redhat.com> | 2016-09-02 02:14:50 +0000 |
---|---|---|
committer | Martin Sebor <msebor@gcc.gnu.org> | 2016-09-01 20:14:50 -0600 |
commit | 05a647564aab92f73fc28631a1bb0311ee8f38f9 (patch) | |
tree | 8330dbb112ec47bbcf763663d1bd7051721bb3a6 /gcc/doc | |
parent | 910f2f3d8a3bccb6f65b9a99e6c36f409829f4f8 (diff) | |
download | gcc-05a647564aab92f73fc28631a1bb0311ee8f38f9.zip gcc-05a647564aab92f73fc28631a1bb0311ee8f38f9.tar.gz gcc-05a647564aab92f73fc28631a1bb0311ee8f38f9.tar.bz2 |
PR tree-optimization/71831 - __builtin_object_size poor results with no
PR tree-optimization/71831 - __builtin_object_size poor results with no
optimization
gcc/testsuite/ChangeLog:
PR tree-optimization/71831
* gcc.dg/builtin-object-size-16.c: New test.
* gcc.dg/builtin-object-size-17.c: New test.
gcc/ChangeLog:
PR tree-optimization/71831
* tree-object-size.h: Return bool instead of the size and add
argument for the size.
* tree-object-size.c (compute_object_offset): Update signature.
(addr_object_size): Same.
(compute_builtin_object_size): Return bool instead of the size
and add argument for the size. Handle POINTER_PLUS_EXPR when
optimization is disabled.
(expr_object_size): Adjust.
(plus_stmt_object_size): Adjust.
(pass_object_sizes::execute): Adjust.
* builtins.c (fold_builtin_object_size): Adjust.
* doc/extend.texi (Object Size Checking): Update.
* ubsan.c (instrument_object_size): Adjust.
From-SVN: r239953
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/extend.texi | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 8cb93ab..aba3b90 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -10030,8 +10030,15 @@ __atomic_store_n(&lockvar, 0, __ATOMIC_RELEASE|__ATOMIC_HLE_RELEASE); @findex __builtin___fprintf_chk @findex __builtin___vfprintf_chk -GCC implements a limited buffer overflow protection mechanism -that can prevent some buffer overflow attacks. +GCC implements a limited buffer overflow protection mechanism that can +prevent some buffer overflow attacks by determining the sizes of objects +into which data is about to be written and preventing the writes when +the size isn't sufficient. The built-in functions described below yield +the best results when used together and when optimization is enabled. +For example, to detect object sizes across function boundaries or to +follow pointer assignments through non-trivial control flow they rely +on various optimization passes enabled with @option{-O2}. However, to +a limited extent, they can be used without optimization as well. @deftypefn {Built-in Function} {size_t} __builtin_object_size (void * @var{ptr}, int @var{type}) is a built-in construct that returns a constant number of bytes from |