[PATCH] libstdc++ Disable bogus -fsanitize=integer errors from Clang

Jonathan Wakely jwakely@redhat.com
Tue Nov 17 00:14:31 GMT 2020


Clang's "unsigned integer overflow" sanitizer can't tell the difference
between expected unsigned wraparound and a bug, and its developers tell
users to report bugs against libstdc++.

This disables the sanitizer where we are intentionally relying on
wraparound working as defined by the standard.

libstdc++-v3/ChangeLog:

	PR libstdc++/91547
	PR libstdc++/97844
	* include/bits/c++config (_GLIBCXX_NO_UNSIGNED_OVERFLOW): Define
	new macro for Clang's no_sanitize("unsigned-integer-overflow")
	attribute.
	* include/bits/basic_string.h (basic_string::_S_compare): Add
	_GLIBCXX_NO_UNSIGNED_OVERFLOW.
	* include/bits/basic_string.tcc (basic_string::find_last_of)
	(basic_string::find_last_not_of): Likewise.
	* include/bits/string_view.tcc
	(basic_string_view::find_last_not_of): Likewise.
	* include/std/string_view (basic_string_view::_S_compare):
	Likewise.

Should we make this change? It won't stop bogus bug reports unless we
also do it on the branches, or wait until nobody is using older
libstdc++ headers with recent Clang releases. But it might help
eventually.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 5167 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20201117/43900e2a/attachment.bin>


More information about the Libstdc++ mailing list