• Home
  • Raw
  • Download

Lines Matching +full:- +full:fsanitize

12 UBSan modifies the program at compile-time to catch various kinds of undefined
17 * Conversion to, from, or between floating-point types which would
20 See the full list of available :ref:`checks <ubsan-checks>` below.
22 UBSan has an optional run-time library which provides better error reporting.
33 Use ``clang++`` to compile and link your program with ``-fsanitize=undefined``
38 .. code-block:: console
46 % clang++ -fsanitize=undefined test.cc
50 You can enable only a subset of :ref:`checks <ubsan-checks>` offered by UBSan,
55 * execute a trap instruction (doesn't require UBSan run-time support).
59 .. code-block:: console
61 …% clang++ -fsanitize=signed-integer-overflow,null,alignment -fno-sanitize-recover=null -fsanitize-
67 .. _ubsan-checks:
74 - ``-fsanitize=alignment``: Use of a misaligned pointer or creation
76 - ``-fsanitize=bool``: Load of a ``bool`` value which is neither
78 - ``-fsanitize=bounds``: Out of bounds array indexing, in cases
80 - ``-fsanitize=enum``: Load of a value of an enumerated type which
83 - ``-fsanitize=float-cast-overflow``: Conversion to, from, or
84 between floating-point types which would overflow the
86 - ``-fsanitize=float-divide-by-zero``: Floating point division by
88 - ``-fsanitize=function``: Indirect call of a function through a
90 - ``-fsanitize=integer-divide-by-zero``: Integer division by zero.
91 - ``-fsanitize=nonnull-attribute``: Passing null pointer as a function
93 - ``-fsanitize=null``: Use of a null pointer or creation of a null
95 - ``-fsanitize=object-size``: An attempt to potentially use bytes which
103 - ``-fsanitize=return``: In C++, reaching the end of a
104 value-returning function without returning a value.
105 - ``-fsanitize=returns-nonnull-attribute``: Returning null pointer
107 - ``-fsanitize=shift``: Shift operators where the amount shifted is
108 greater or equal to the promoted bit-width of the left hand side
111 unsigned overflow in C++. You can use ``-fsanitize=shift-base`` or
112 ``-fsanitize=shift-exponent`` to check only left-hand side or
113 right-hand side of shift operation, respectively.
114 - ``-fsanitize=signed-integer-overflow``: Signed integer overflow,
115 including all the checks added by ``-ftrapv``, and checking for
116 overflow in signed division (``INT_MIN / -1``).
117 - ``-fsanitize=unreachable``: If control flow reaches
119 - ``-fsanitize=unsigned-integer-overflow``: Unsigned integer
121 - ``-fsanitize=vla-bound``: A variable-length array whose bound
123 - ``-fsanitize=vptr``: Use of an object whose vptr indicates that
125 begun or has ended. Incompatible with ``-fno-rtti``. Link must
126 be performed by ``clang++``, not ``clang``, to make sure C++-specific
130 - ``-fsanitize=undefined``: All of the checks listed above other than
131 ``unsigned-integer-overflow``.
132 - ``-fsanitize=undefined-trap``: Deprecated alias of
133 ``-fsanitize=undefined``.
134 - ``-fsanitize=integer``: Checks for undefined or suspicious integer
142 #. Compile with ``-g`` and ``-fno-omit-frame-pointer`` to get proper debug
146 #. Make sure ``llvm-symbolizer`` binary is in ``PATH``.
155 ----------------------------------------------------------------------------
159 ``-fsanitize=`` flag in this attribute, e.g. if your function deliberately
161 ``__attribute__((no_sanitize("signed-integer-overflow")))``.
168 -------------------------------------------------
175 --------------------
181 .. code-block:: bash
185 You need to specify a :ref:`check <ubsan-checks>` you are suppressing and the
188 .. code-block:: bash
190 signed-integer-overflow:file-with-known-overflow.cpp
201 ``-fsanitize-recover=signed-integer-overflow,alignment,vptr``, although
204 fine-grained checks are supported.
229 ``check-ubsan`` command.
236 ``-fsanitize-undefined-strip-path-components=N`` can be used to trim this
242 -------
245 * Default (No flag, or ``-fsanitize-undefined-strip-path-components=0``): ``/code/library/file.cpp``
246 * ``-fsanitize-undefined-strip-path-components=1``: ``code/library/file.cpp``
247 * ``-fsanitize-undefined-strip-path-components=2``: ``library/file.cpp``
248 * ``-fsanitize-undefined-strip-path-components=-1``: ``file.cpp``
249 * ``-fsanitize-undefined-strip-path-components=-2``: ``library/file.cpp``
256 <http://blog.llvm.org/2011/05/what-every-c-programmer-should-know.html>`_