This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Source level suppression of UBsan finding
- From: Jeffrey Walton <noloader at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Sat, 16 Dec 2017 10:28:46 -0500
- Subject: Source level suppression of UBsan finding
- Authentication-results: sourceware.org; auth=none
- Reply-to: noloader at gmail dot com
Hi Everyone,
I'm looking for a source-level method to tell UBsan to ignore a
function that is producing a finding. We are pretty sure it is a false
positive so we want UBsan to skip analysis of the function.
We want source-level because it is a lot easier for us to make the
change in one place and document it. Otherwise, a whitelist using a
separate file will cause a lot of work for us and downstream. Lots of
build systems will need to be modified to accommodate the recipe
changes.
With Memory Sanitizer we can do something like:
#if __has_feature(memory_sanitizer)
# define MSAN_AVAILABLE 1
#endif
# ifdef MSAN_AVAILABLE
__msan_unpoison(&m_readfds, sizeof(m_readfds));
__msan_unpoison(&m_writefds, sizeof(m_writefds));
# endif
How can we do similar with UBSan?
Thanks in advance,
Jeff