Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable bogus -Wstringop-overflow on GCC 11 #3054

Merged
merged 1 commit into from
Aug 24, 2022

Conversation

phprus
Copy link
Contributor

@phprus phprus commented Aug 23, 2022

gcc version 11.3.0 (SUSE Linux)

Warning:

[ 43%] Building CXX object test/CMakeFiles/unicode-test.dir/test-main.cc.o
cd /home/phprus/devel/tmp/fmt/fmt-git/build/cxx20r-asan/test && /usr/bin/g++-11 -DFMT_HEADER_ONLY=1 -DGTEST_HAS_STD_WSTRING=1 -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING=1 -I/home/phprus/devel/tmp/fmt/fmt-git/include -isystem /home/phprus/devel/tmp/fmt/fmt-git/test/gtest/. -fsanitize=address -O3 -DNDEBUG -fvisibility=hidden -fvisibility-inlines-hidden -pedantic-errors -Wall -Wextra -pedantic -Wold-style-cast -Wundef -Wredundant-decls -Wwrite-strings -Wpointer-arith -Wcast-qual -Wformat=2 -Wmissing-include-dirs -Wcast-align -Wctor-dtor-privacy -Wdisabled-optimization -Winvalid-pch -Woverloaded-virtual -Wconversion -Wno-ctor-dtor-privacy -Wno-format-nonliteral -Wno-dangling-else -Wno-unused-local-typedefs -Wdouble-promotion -Wtrampolines -Wzero-as-null-pointer-constant -Wuseless-cast -Wvector-operation-performance -Wsized-deallocation -Wshadow -Wshift-overflow=2 -Wnull-dereference -Wduplicated-cond -Werror -fno-delete-null-pointer-checks -std=gnu++20 -MD -MT test/CMakeFiles/unicode-test.dir/test-main.cc.o -MF CMakeFiles/unicode-test.dir/test-main.cc.o.d -o CMakeFiles/unicode-test.dir/test-main.cc.o -c /home/phprus/devel/tmp/fmt/fmt-git/test/test-main.cc
In file included from /home/phprus/devel/tmp/fmt/fmt-git/include/fmt/format.h:48,
                 from /home/phprus/devel/tmp/fmt/fmt-git/test/format-impl-test.cc:15:
In member function ‘constexpr void fmt::v9::detail::fill_t<Char>::operator=(fmt::v9::basic_string_view<Char>) [with Char = char]’,
    inlined from ‘constexpr void fmt::v9::detail::specs_setter<Char>::on_fill(fmt::v9::basic_string_view<Char>) [with Char = char]’ at /home/phprus/devel/tmp/fmt/fmt-git/include/fmt/core.h:2209:17,
    inlined from ‘constexpr const Char* fmt::v9::detail::parse_align(const Char*, const Char*, Handler&&) [with Char = char; Handler = fmt::v9::detail::specs_checker<fmt::v9::detail::specs_handler<char> >&]’ at /home/phprus/devel/tmp/fmt/fmt-git/include/fmt/core.h:2381:24,
    inlined from ‘constexpr const Char* fmt::v9::detail::parse_format_specs(const Char*, const Char*, SpecHandler&&) [with Char = char; SpecHandler = fmt::v9::detail::specs_checker<fmt::v9::detail::specs_handler<char> >&]’ at /home/phprus/devel/tmp/fmt/fmt-git/include/fmt/core.h:2572:22,
    inlined from ‘const Char* fmt::v9::detail::vformat_to(fmt::v9::detail::buffer<T>&, fmt::v9::basic_string_view<Char>, fmt::v9::basic_format_args<fmt::v9::basic_format_context<typename std::conditional<std::is_same<typename fmt::v9::type_identity<T>::type, char>::value, fmt::v9::appender, std::back_insert_iterator<fmt::v9::detail::buffer<typename fmt::v9::type_identity<T>::type> > >::type, typename fmt::v9::type_identity<T>::type> >, fmt::v9::detail::locale_ref)::format_handler::on_format_specs(int, const Char*, const Char*) [with Char = char]’ at /home/phprus/devel/tmp/fmt/fmt-git/include/fmt/format.h:4123:33:
/home/phprus/devel/tmp/fmt/fmt-git/include/fmt/core.h:2095:48: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
 2095 |     for (size_t i = 0; i < size; ++i) data_[i] = s[i];
      |                                       ~~~~~~~~~^~~~
/home/phprus/devel/tmp/fmt/fmt-git/include/fmt/core.h: In member function ‘const Char* fmt::v9::detail::vformat_to(fmt::v9::detail::buffer<T>&, fmt::v9::basic_string_view<Char>, fmt::v9::basic_format_args<fmt::v9::basic_format_context<typename std::conditional<std::is_same<typename fmt::v9::type_identity<T>::type, char>::value, fmt::v9::appender, std::back_insert_iterator<fmt::v9::detail::buffer<typename fmt::v9::type_identity<T>::type> > >::type, typename fmt::v9::type_identity<T>::type> >, fmt::v9::detail::locale_ref)::format_handler::on_format_specs(int, const Char*, const Char*) [with Char = char]’:
/home/phprus/devel/tmp/fmt/fmt-git/include/fmt/core.h:2088:8: note: at offset 4 into destination object ‘fmt::v9::detail::fill_t<char>::data_’ of size 4
 2088 |   Char data_[max_size] = {Char(' '), Char(0), Char(0), Char(0)};
      |        ^~~~~

Previous discussion in PR #2442.

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
@vitaut vitaut merged commit 3a3b070 into fmtlib:master Aug 24, 2022
@vitaut
Copy link
Contributor

vitaut commented Aug 24, 2022

Thank you!

mtremer pushed a commit to ipfire/ipfire-2.x that referenced this pull request Nov 28, 2022
- Update from version 9.0.0 to 9.1.0
- Update of rootfile
- Changelog
    9.1.0 - 2022-08-27
	* ``fmt::formatted_size`` now works at compile time
		  `#3026 <https://github.com/fmtlib/fmt/pull/3026>`_
			  For example (`godbolt <https://godbolt.org/z/1MW5rMdf8>`__):
			   .. code:: c++
			     #include <fmt/compile.h>
			     int main() {
			       using namespace fmt::literals;
			       constexpr size_t n = fmt::formatted_size("{}"_cf, 42);
			       fmt::print("{}\n", n); // prints 2
			     }
	* Fixed handling of invalid UTF-8
		  `#3038 <https://github.com/fmtlib/fmt/pull/3038>`_,
		  `#3044 <https://github.com/fmtlib/fmt/pull/3044>`_,
		  `#3056 <https://github.com/fmtlib/fmt/pull/3056>`_
	* Improved Unicode support in ``ostream`` overloads of ``print``
		  `#2994 <https://github.com/fmtlib/fmt/pull/2994>`_,
		  `#3001 <https://github.com/fmtlib/fmt/pull/3001>`_,
		  `#3025 <https://github.com/fmtlib/fmt/pull/3025>`_
	* Fixed handling of the sign specifier in localized formatting on systems with
	   32-bit ``wchar_t``
		  `#3041 <https://github.com/fmtlib/fmt/issues/3041>`_).
	* Added support for wide streams to ``fmt::streamed``
		  `#2994 <https://github.com/fmtlib/fmt/pull/2994>`_
	* Added the ``n`` specifier that disables the output of delimiters when
	   formatting ranges
		  `#2981 <https://github.com/fmtlib/fmt/pull/2981>`_,
		  `#2983 <https://github.com/fmtlib/fmt/pull/2983>`_
			  For example (`godbolt <https://godbolt.org/z/roKqGdj8c>`__):
			   .. code:: c++
			     #include <fmt/ranges.h>
			     #include <vector>
			     int main() {
			       auto v = std::vector{1, 2, 3};
			       fmt::print("{:n}\n", v); // prints 1, 2, 3
			     }
	* Worked around problematic ``std::string_view`` constructors introduced in C++23
		  `#3030 <https://github.com/fmtlib/fmt/issues/3030>`_,
		  `#3050 <https://github.com/fmtlib/fmt/issues/3050>`_
	* Improve handling (exclusion) of recursive ranges
		  `#2968 <https://github.com/fmtlib/fmt/issues/2968>`_,
		  `#2974 <https://github.com/fmtlib/fmt/pull/2974>`_
	* Improved error reporting in format string compilation
		  `#3055 <https://github.com/fmtlib/fmt/issues/3055>`_
	* Improved the implementation of
		  `Dragonbox <https://github.com/jk-jeon/dragonbox>`_, the algorithm used for
		   the default floating-point formatting
		  `#2984 <https://github.com/fmtlib/fmt/pull/2984>`_
	* Fixed issues with floating-point formatting on exotic platforms.
	* Improved the implementation of chrono formatting
		  `#3010 <https://github.com/fmtlib/fmt/pull/3010>`_
	* Improved documentation
		  `#2966 <https://github.com/fmtlib/fmt/pull/2966>`_,
		  `#3009 <https://github.com/fmtlib/fmt/pull/3009>`_,
		  `#3020 <https://github.com/fmtlib/fmt/issues/3020>`_,
		  `#3037 <https://github.com/fmtlib/fmt/pull/3037>`_
	* Improved build configuration
		  `#2991 <https://github.com/fmtlib/fmt/pull/2991>`_,
		  `#2995 <https://github.com/fmtlib/fmt/pull/2995>`_,
		  `#3004 <https://github.com/fmtlib/fmt/issues/3004>`_,
		  `#3007 <https://github.com/fmtlib/fmt/pull/3007>`_,
		  `#3040 <https://github.com/fmtlib/fmt/pull/3040>`_
	* Fixed various warnings and compilation issues
		  `#2969 <https://github.com/fmtlib/fmt/issues/2969>`_,
		  `#2971 <https://github.com/fmtlib/fmt/pull/2971>`_,
		  `#2975 <https://github.com/fmtlib/fmt/issues/2975>`_,
		  `#2982 <https://github.com/fmtlib/fmt/pull/2982>`_,
		  `#2985 <https://github.com/fmtlib/fmt/pull/2985>`_,
		  `#2988 <https://github.com/fmtlib/fmt/issues/2988>`_,
		  `#3000 <https://github.com/fmtlib/fmt/issues/3000>`_,
		  `#3006 <https://github.com/fmtlib/fmt/issues/3006>`_,
		  `#3014 <https://github.com/fmtlib/fmt/issues/3014>`_,
		  `#3015 <https://github.com/fmtlib/fmt/issues/3015>`_,
		  `#3021 <https://github.com/fmtlib/fmt/pull/3021>`_,
		  `#3023 <https://github.com/fmtlib/fmt/issues/3023>`_,
		  `#3024 <https://github.com/fmtlib/fmt/pull/3024>`_,
		  `#3029 <https://github.com/fmtlib/fmt/pull/3029>`_,
		  `#3043 <https://github.com/fmtlib/fmt/pull/3043>`_,
		  `#3052 <https://github.com/fmtlib/fmt/issues/3052>`_,
		  `#3053 <https://github.com/fmtlib/fmt/pull/3053>`_,
		  `#3054 <https://github.com/fmtlib/fmt/pull/3054>`_

Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
codeinred added a commit to codeinred/fmt that referenced this pull request Mar 3, 2023
vitaut pushed a commit that referenced this pull request Mar 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants