diff options
author | Jakub Jelinek <jakub@redhat.com> | 2016-11-09 16:37:28 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-11-09 16:37:28 +0100 |
commit | 2e955d50a928eac736c1e4a6eddc932d3400200a (patch) | |
tree | 03880b28e03c433d65f4c40b64eec608dd81fdb0 /gcc/doc | |
parent | 14e7281244ddf777d822f1e99518f0e15b0bfea6 (diff) | |
download | gcc-2e955d50a928eac736c1e4a6eddc932d3400200a.zip gcc-2e955d50a928eac736c1e4a6eddc932d3400200a.tar.gz gcc-2e955d50a928eac736c1e4a6eddc932d3400200a.tar.bz2 |
flag-types.h (enum sanitize_code): Add SANITIZE_SHIFT_BASE and SANITIZE_SHIFT_EXPONENT...
* flag-types.h (enum sanitize_code): Add SANITIZE_SHIFT_BASE
and SANITIZE_SHIFT_EXPONENT, change SANITIZE_SHIFT to bitwise
or of them, renumber other enumerators.
* opts.c (sanitizer_opts): Add shift-base and shift-exponent.
* doc/invoke.texi: Document -fsanitize=shift-base and
-fsanitize-shift-exponent, document -fsanitize=shift as
having those 2 suboptions.
c-family/
* c-ubsan.c (ubsan_instrument_shift): Handle split
-fsanitize=shift-base and -fsanitize=shift-exponent.
testsuite/
* gcc.dg/ubsan/c99-shift-3.c: New test.
* gcc.dg/ubsan/c99-shift-4.c: New test.
* gcc.dg/ubsan/c99-shift-5.c: New test.
* gcc.dg/ubsan/c99-shift-6.c: New test.
From-SVN: r242005
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/invoke.texi | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 17c5c22..76b8540 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -10560,6 +10560,21 @@ at runtime. Current suboptions are: This option enables checking that the result of a shift operation is not undefined. Note that what exactly is considered undefined differs slightly between C and C++, as well as between ISO C90 and C99, etc. +This option has two suboptions, @option{-fsanitize=shift-base} and +@option{-fsanitize=shift-exponent}. + +@item -fsanitize=shift-exponent +@opindex fsanitize=shift-exponent +This option enables checking that the second argument of a shift operation +is not negative and is smaller than the precision of the promoted first +argument. + +@item -fsanitize=shift-base +@opindex fsanitize=shift-base +If the second argument of a shift operation is within range, check that the +result of a shift operation is not undefined. Note that what exactly is +considered undefined differs slightly between C and C++, as well as between +ISO C90 and C99, etc. @item -fsanitize=integer-divide-by-zero @opindex fsanitize=integer-divide-by-zero |