From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 210043864877; Fri, 30 Jun 2023 12:21:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 210043864877 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688127672; bh=RTpmEpF6jVO8D+rNwkkfl9pCTQxhlvZmfgGhDRkXGHU=; h=From:To:Subject:Date:From; b=sR92nrOoH8I473XVeRyj2AMANXr7r7z0DEq9vAP83K69nzDnnNuI9zhkuo3vbTdDT nDeLrBy9BaDj1QqurvJ7Afwjn8jJeVBsIbJ2X5n7ahU8jkn/oL8qJDQbgtiL72i+Y4 Zr6X1eNm6pSAkWEoDhPM5qO5fkWjm5NFyeAamvkw= From: "rogerio.souza at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/110498] New: Spurious warnings stringop-overflow and array-bounds copying data as bytes into vector::reserve Date: Fri, 30 Jun 2023 12:21:11 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 13.1.0 X-Bugzilla-Keywords: diagnostic, missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rogerio.souza at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110498 Bug ID: 110498 Summary: Spurious warnings stringop-overflow and array-bounds copying data as bytes into vector::reserve Product: gcc Version: 13.1.0 Status: UNCONFIRMED Keywords: diagnostic, missed-optimization Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: rogerio.souza at gmail dot com Target Milestone: --- Created attachment 55432 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D55432&action=3Dedit This is the preprocessed file (*.i*) that triggers the warning reported her= e. The warning issue happens when using GCC v13.1.0 on Red Hat 7.9 3.10.0-1160.90.1.el7.x86_64. The compiler configuration settings are: /grid/common/test/gcc-v13.1.0d1rh74_lnx86/bin/gcc -v Using built-in specs. COLLECT_GCC=3D/grid/common/test/gcc-v13.1.0d1rh74_lnx86/bin/gcc COLLECT_LTO_WRAPPER=3D/grid/common/test/gcc-v13.1.0d1rh74_lnx86/libexec/gcc= /x86_64-redhat-linux/13.1.0/lto-wrapper Target: x86_64-redhat-linux Configured with: /tmp/gcc-v13.1.0d1rh74_lnx86/gcc.source/configure --prefix=3D/grid/common/test/gcc-v13.1.0d1rh74_lnx86 --with-pkgversion=3DCa= dence --disable-libgcj --enable-threads=3Dposix --enable-shared --with-system-zlib --enable-checking=3Drelease --enable-__cxa_atexit --disable-libunwind-excep= tions --enable-languages=3Dc,c++,fortran --disable-nls --enable-gnu-unique-object --enable-bootstrap --enable-plugin --enable-linker-build-id --enable-gnu-indirect-function --enable-install-libiberty --with-tune=3Dgen= eric --enable-initfini-array --enable-multiarch --with-linker-hash-style=3Dgnu --with-ld=3D/grid/common/test/gcc-v13.1.0d1rh74_lnx86/bin/ld --with-as=3D/grid/common/test/gcc-v13.1.0d1rh74_lnx86/bin/as --build=3Dx86_64-redhat-linux --host=3Dx86_64-redhat-linux Thread model: posix Supported LTO compression algorithms: zlib gcc version 13.1.0 (Cadence) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D The command line to reproduce the warning and the compiler output: /opt/gcc-v13.1.0d1rh74_lnx86/bin/gcc -c -fpic -std=3Dc++2b -pthread -D_GLIBCXX_USE_CXX11_ABI=3D1 -Wstrict-aliasing=3D3 -O3 -Wall -Werror -DNDEB= UG -Wstrict-aliasing=3D3 -Wextra -DET7 -DETX=3D7 -DCMG_QT_VERSION=3D'"MAIN_WXE_23.05.539.d000-Z2, VEngineering"' -DLINUX2= =20=20=20 -I/opt/ua/3party/capnproto -I/opt/ua/Framework -I. -I.. -I/opt/ap/include -I/grid/cva/p4/eugene/gcc_wxe/ua/include -I/opt/ua/3party/xlm_inst/include= =20 -MMD ../radbSerializer.C In file included from /opt/gcc-v13.1.0d1rh74_lnx86/include/c++/13.1.0/string:51, from /opt/gcc-v13.1.0d1rh74_lnx86/include/c++/13.1.0/stdexcept:39, from ../radbSerializer.C:9: In static member function 'static constexpr _Up* std::__copy_move<_IsMove, true, std::random_access_iterator_tag>::__copy_m(_Tp*, _Tp*, _Up*) [with _T= p =3D long unsigned int; _Up =3D long unsigned int; bool _IsMove =3D false]', inlined from 'constexpr _OI std::__copy_move_a2(_II, _II, _OI) [with bo= ol _IsMove =3D false; _II =3D long unsigned int*; _OI =3D long unsigned int*]'= at /opt/gcc-v13.1.0d1rh74_lnx86/include/c++/13.1.0/bits/stl_algobase.h:506:3 , inlined from 'constexpr _OI std::__copy_move_a1(_II, _II, _OI) [with bo= ol _IsMove =3D false; _II =3D long unsigned int*; _OI =3D long unsigned int*]'= at /opt/gcc-v13.1.0d1rh74_lnx86/include/c++/13.1.0/bits/stl_algobase.h:533:4 , inlined from 'constexpr _OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove =3D false; _II =3D long unsigned int*; _OI =3D long unsigned int*]'= at /opt/gcc-v13.1.0d1rh74_lnx86/include/c++/13.1.0/bits/stl_algobase.h:540:31,= =20=20=20 inlined from 'constexpr _OI std::copy(_II, _II, _OI) [with _II =3D long uns= igned int*; _OI =3D long unsigned int*]' at /opt/gcc-v13.1.0d1rh74_lnx86/include/c++/13.1.0/bits/stl_algobase.h:633:7, inlined from 'constexpr std::vector::iterator std::vector::_M_copy_aligned(const_iterator, const_iterator, iterator) [with _Alloc =3D std::allocator]' at /opt/gcc-v13.1.0d1rh74_lnx86/include/c++/13.1.0/bits/stl_bvector.h:1303:28, inlined from 'constexpr void std::vector::_M_reallocate(size_type) [with _Alloc =3D std::allocator]' at /opt/gcc-v13.1.0d1rh74_lnx86/include/c++/13.1.0/bits/vector.tcc:851:40, inlined from 'constexpr void std::vector::reserve(size_ty= pe) [with _Alloc =3D std::allocator]' at /opt/gcc-v13.1.0d1rh74_lnx86/include/c++/13.1.0/bits/stl_bvector.h:1091:17, inlined from 'radb::ScopesSerializer::ScopesSerializer()' at ../radbSerializer.C:25:24: /opt/gcc-v13.1.0d1rh74_lnx86/include/c++/13.1.0/bits/stl_algobase.h:437:30: error: 'void* __builtin_memmove(void*, const void*, long unsigned int)' for= ming offset 8 is out of the bounds [0, 8] [-Werror=3Darray-bounds=3D] 437 | __builtin_memmove(__result, __first, sizeof(_Tp) * _Num= ); | ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In static member function 'static constexpr _Up* std::__copy_move<_IsMove, true, std::random_access_iterator_tag>::__copy_m(_Tp*, _Tp*, _Up*) [with _T= p =3D long unsigned int; _Up =3D long unsigned int; bool _IsMove =3D false]', inlined from 'constexpr _OI std::__copy_move_a2(_II, _II, _OI) [with bo= ol _IsMove =3D false; _II =3D long unsigned int*; _OI =3D long unsigned int*]'= at /opt/gcc-v13.1.0d1rh74_lnx86/include/c++/13.1.0/bits/stl_algobase.h:506:3 , inlined from 'constexpr _OI std::__copy_move_a1(_II, _II, _OI) [with bo= ol _IsMove =3D false; _II =3D long unsigned int*; _OI =3D long unsigned int*]'= at /opt/gcc-v13.1.0d1rh74_lnx86/include/c++/13.1.0/bits/stl_algobase.h:533:4 , inlined from 'constexpr _OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove =3D false; _II =3D long unsigned int*; _OI =3D long unsigned int*]'= at /opt/gcc-v13.1.0d1rh74_lnx86/include/c++/13.1.0/bits/stl_algobase.h:540:31,= =20=20=20 inlined from 'constexpr _OI std::copy(_II, _II, _OI) [with _II =3D long uns= igned int*; _OI =3D long unsigned int*]' at /opt/gcc-v13.1.0d1rh74_lnx86/include/c++/13.1.0/bits/stl_algobase.h:633:7, inlined from 'constexpr std::vector::iterator std::vector::_M_copy_aligned(const_iterator, const_iterator, iterator) [with _Alloc =3D std::allocator]' at /opt/gcc-v13.1.0d1rh74_lnx86/include/c++/13.1.0/bits/stl_bvector.h:1303:28, inlined from 'constexpr void std::vector::_M_reallocate(size_type) [with _Alloc =3D std::allocator]' at /opt/gcc-v13.1.0d1rh74_lnx86/include/c++/13.1.0/bits/vector.tcc:851:40, inlined from 'constexpr void std::vector::reserve(size_ty= pe) [with _Alloc =3D std::allocator]' at /opt/gcc-v13.1.0d1rh74_lnx86/include/c++/13.1.0/bits/stl_bvector.h:1091:17, inlined from 'radb::VarsSerializer::VarsSerializer()' at ../radbSerializer.C:93:27: /opt/gcc-v13.1.0d1rh74_lnx86/include/c++/13.1.0/bits/stl_algobase.h:437:30: error: 'void* __builtin_memmove(void*, const void*, long unsigned int)' for= ming offset 8 is out of the bounds [0, 8] [-Werror=3Darray-bounds=3D] 437 | __builtin_memmove(__result, __first, sizeof(_Tp) * _Num= ); | ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1plus: all warnings being treated as errors =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D The the preprocessed file "radbSerializer.ii" is attached. This might means that this issue was still not totally fixed on GCC v13.1.0 Regards, Rogerio=