From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6F7923858D35; Tue, 4 Jul 2023 07:53:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6F7923858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688457223; bh=cK24Tw0W9VeNbGqCppevH8vSC0qmBLHrVe8IU6Y1gzk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=VgzpWGhLDAtYg8uiGjtD2tRATpCG9avqwBWrZvT+aS/Ogb6VvaILuQ/amQBoDqgJr WouFSKOmkuOYqXW3Bpnr2q3X+e940CKm5siSI4uP4WVwllLx9y6ossKXEt7kugaXgT 6Cs/WVO0T2Rp6NF0ydrJ/gptVmIi+w/0YD+OAe5g= From: "sbouchex at infovista dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107004] [12 Regression] GCC12 warning in OOB access: array subscript is partly outside array bounds Date: Tue, 04 Jul 2023 07:53:43 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: sbouchex at infovista dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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=3D107004 --- Comment #7 from sbouchex --- (In reply to sbouchex from comment #6) > The same testcase is failing on : >=20 > [...] > g++ --version > g++ (GCC) 13.1.1 20230614 (Red Hat 13.1.1-4) > [...] >=20 > [...] > [root@dev-sbo-eva-ol8 CorrCommon]# g++ -std=3Dc++20 -Wall -Wextra -Werror > -pedantic -Warray-bounds -O3 -o /tmp/toto /tmp/toto.cpp > In file included from /usr/include/c++/13/bits/stl_iterator.h:85, > from /usr/include/c++/13/bits/stl_algobase.h:67, > from /usr/include/c++/13/vector:62, > from /tmp/toto.cpp:1: > In function 'constexpr void std::_Construct(_Tp*, _Args&& ...) [with _Tp = =3D > int*; _Args =3D {}]', > inlined from 'static constexpr _ForwardIterator > std::__uninitialized_default_n_1::__uninit_default_n(_ForwardIterat= or, > _Size) [with _ForwardIterator =3D int**; _Size =3D long unsigned int]' at > /usr/include/c++/13/bits/stl_uninitialized.h:666:23, > inlined from 'static constexpr _ForwardIterator > std::__uninitialized_default_n_1::__uninit_default_n(_ForwardIterat= or, > _Size) [with _ForwardIterator =3D int**; _Size =3D long unsigned int]' at > /usr/include/c++/13/bits/stl_uninitialized.h:660:9, > inlined from 'constexpr _ForwardIterator > std::__uninitialized_default_n(_ForwardIterator, _Size) [with > _ForwardIterator =3D int**; _Size =3D long unsigned int]' at > /usr/include/c++/13/bits/stl_uninitialized.h:706:20, > inlined from 'constexpr _ForwardIterator > std::__uninitialized_default_n_a(_ForwardIterator, _Size, allocator<_Tp>&) > [with _ForwardIterator =3D int**; _Size =3D long unsigned int; _Tp =3D in= t*]' at > /usr/include/c++/13/bits/stl_uninitialized.h:773:44, > inlined from 'constexpr void std::vector<_Tp, > _Alloc>::_M_default_append(size_type) [with _Tp =3D int*; _Alloc =3D > std::allocator]' at /usr/include/c++/13/bits/vector.tcc:668:41, > inlined from 'constexpr void std::vector<_Tp, _Alloc>::resize(size_ty= pe) > [with _Tp =3D int*; _Alloc =3D std::allocator]' at > /usr/include/c++/13/bits/stl_vector.h:1013:21, > inlined from 'void foo(std::vector&)' at /tmp/toto.cpp:7:13: > /usr/include/c++/13/bits/stl_construct.h:119:7: error: array subscript > 'int*[0]' is partly outside array bounds of 'unsigned char [8]' > [-Werror=3Darray-bounds=3D] > 119 | ::new((void*)__p) _Tp(std::forward<_Args>(__args)...); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > In file included from > /usr/include/c++/13/x86_64-redhat-linux/bits/c++allocator.h:33, > from /usr/include/c++/13/bits/allocator.h:46, > from /usr/include/c++/13/vector:63: > In member function '_Tp* std::__new_allocator<_Tp>::allocate(size_type, > const void*) [with _Tp =3D int*]', > inlined from 'constexpr _Tp* std::allocator< > >::allocate(std::size_t) [with _Tp =3D int*]' at > /usr/include/c++/13/bits/allocator.h:198:40, > inlined from 'static constexpr _Tp* > std::allocator_traits >::allocate(allocator_type&, > size_type) [with _Tp =3D int*]' at > /usr/include/c++/13/bits/alloc_traits.h:482:28, > inlined from 'constexpr std::_Vector_base<_Tp, _Alloc>::pointer > std::_Vector_base<_Tp, _Alloc>::_M_allocate(std::size_t) [with _Tp =3D in= t*; > _Alloc =3D std::allocator]' at > /usr/include/c++/13/bits/stl_vector.h:378:33, > inlined from 'constexpr void std::vector<_Tp, > _Alloc>::_M_default_append(size_type) [with _Tp =3D int*; _Alloc =3D > std::allocator]' at /usr/include/c++/13/bits/vector.tcc:663:45, > inlined from 'constexpr void std::vector<_Tp, _Alloc>::resize(size_ty= pe) > [with _Tp =3D int*; _Alloc =3D std::allocator]' at > /usr/include/c++/13/bits/stl_vector.h:1013:21, > inlined from 'void foo(std::vector&)' at /tmp/toto.cpp:7:13: > /usr/include/c++/13/bits/new_allocator.h:147:55: note: at offset [1, 8] i= nto > object of size 8 allocated by 'operator new' > 147 | return static_cast<_Tp*>(_GLIBCXX_OPERATOR_NEW(__n * > sizeof(_Tp))); > | ^ > cc1plus: all warnings being treated as errors > [...] But no warning with -O2=