From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by sourceware.org (Postfix) with ESMTPS id 4F86E3858D20 for ; Fri, 31 Mar 2023 06:08:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4F86E3858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pj1-x102e.google.com with SMTP id om3-20020a17090b3a8300b0023efab0e3bfso24372758pjb.3 for ; Thu, 30 Mar 2023 23:08:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680242919; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=YXGTNqq+7tiuWsLDQcb3HxSqbHuVmZRwmNAUQf9Nvqc=; b=lQr7+el1u5mnBH8kh9D4CDHJC82roQHqusu4IjWYymsm2wKOnglZQXofqZCP0GJMxW 0LmDS0+QRmdRA3lwAKBXJABZT7JZi23sGQkMFVqC/6oK5zk6p7/l0hhJ7SiHAUWfK6qn V5SdudTTxxRt6pPXkb6WFq81M4M9zEQKNvGk+3ByonZASQV69Sn1sZJd+c6sAMmX75dV yWVYnXqckcZ6q+BFixK5sM8GEQcQujDHJoMRh/CV+tpA2tfz/iTubdcYMaCKeaQPbagy 3MUsruec97bAe0p81k/ajzcHdCpeNJOA2GsdarSpE9hPPCWNikMUzwtzE/BVNAkktXH4 FBVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680242919; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YXGTNqq+7tiuWsLDQcb3HxSqbHuVmZRwmNAUQf9Nvqc=; b=lEnL146bM8Tkph3vNl1HwJdPz3b30AYcz6xno4OEepK+YII1Il7UlPBcyZnkWXpNz4 cHSonzkaTonipijy5AU9cKrWkSLk2IHY4HFLK2DiAEG/TCgsPVpU26PWtT4nM5/mkkZc D78SOuQ31V1HUaP48Asjln5odkwDj3+Mb7xmxKXA4u5MjxYKa1Uo+HeHZ3Ut8+vO5y1F HngLdenfiOwBJZdit7f0UR4W2wkvhclTVGfBXVanfxD/M1td9RfP57MpqneDOWXuzR4/ I/s+zNpL1e2YKXbW2+EobRYf9oZfryzWvK2vbfyTKwQ1Zp4d8C12KhazsLuum8J4zyeL 0fDA== X-Gm-Message-State: AAQBX9fRd8KGXZONaCcKGxRTyxhE+Qb41t3E9g+yASmUupry0XjyL+eu UmCnpugijyaFJN/HexuTcs5TSZXhHh3e8+4Y9pc= X-Google-Smtp-Source: AKy350bofGzLfl4zyA1U8MQg7BmLTUcW+KlDYm+h6sGcMAVWsMc/8LwTuAe/PIDYrtZpDWBiE8l7q0xEWujMiGc61+s= X-Received: by 2002:a17:902:ce83:b0:1a0:4321:920e with SMTP id f3-20020a170902ce8300b001a04321920emr9612099plg.12.1680242918569; Thu, 30 Mar 2023 23:08:38 -0700 (PDT) MIME-Version: 1.0 References: <54bb3bc9-e0c1-b5ab-4447-5908b09fd19f@redhat.com> <983ac32b-3637-da59-882c-6099f6ac8f79@redhat.com> In-Reply-To: <983ac32b-3637-da59-882c-6099f6ac8f79@redhat.com> From: Andrew Pinski Date: Thu, 30 Mar 2023 23:08:25 -0700 Message-ID: Subject: Re: recomputation and PR 109154 To: Andrew MacLeod Cc: Jakub Jelinek , gcc-patches , Richard Biener , "hernandez, aldy" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, Mar 30, 2023 at 1:40=E2=80=AFPM Andrew MacLeod via Gcc-patches wrote: > > I committed it. ran it again for fun. sigh. Looks like its also > triggering another issue now in g++.dg/warn/Wstringop-overflow-4.C > where its issuing: libstdc++v3's 23_containers/vector/bool/allocator/copy.cc fails most likely in a similar way. In file included from /home/apinski/src/upstream-gcc/gcc/objdir/x86_64-pc-linux-gnu/libstdc++-v3/= include/algorithm:60,^M from /home/apinski/src/upstream-gcc/gcc/objdir/x86_64-pc-linux-gnu/libstdc++-v3/= include/x86_64-pc-linux-gnu/bits/stdc++.h:51,^M from :^M In static member function 'static _Up* std::__copy_move<_IsMove, true, std::random_access_iterator_tag>::__copy_m(_Tp*, _Tp*, _Up*) [with _Tp =3D long unsigned int; _Up =3D long unsigned int; bool _IsMove =3D false]',^M inlined from '_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove =3D false; _II =3D long unsigned int*; _OI =3D long unsigned int*]' at /home/apinski/src/upstream-gcc/gcc/objdir/x86_64-pc-linux-gnu/libstdc++-= v3/include/bits/stl_algobase.h:506,^M inlined from '_OI std::__copy_move_a1(_II, _II, _OI) [with bool _IsMove =3D false; _II =3D long unsigned int*; _OI =3D long unsigned int*]' at /home/apinski/src/upstream-gcc/gcc/objdir/x86_64-pc-linux-gnu/libstdc++-= v3/include/bits/stl_algobase.h:533,^M inlined from '_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove =3D false; _II =3D long unsigned int*; _OI =3D long unsigned int*]' at /home/apinski/src/upstream-gcc/gcc/objdir/x86_64-pc-linux-gnu/libstdc++-= v3/include/bits/stl_algobase.h:540,^M inlined from '_OI std::copy(_II, _II, _OI) [with _II =3D long unsigned int*; _OI =3D long unsigned int*]' at /home/apinski/src/upstream-gcc/gcc/objdir/x86_64-pc-linux-gnu/libstdc++-v3/= include/bits/stl_algobase.h:633,^M inlined from 'std::vector::iterator std::vector::_M_copy_aligned(const_iterator, const_iterator, iterator) [with _Alloc =3D __gnu_test::propagating_allocator]' at /home/apinski/src/upstream-gcc/gcc/objdir/x86_64-pc-linux-gnu/libstdc++-v3/= include/bits/stl_bvector.h:1303,^M inlined from 'void std::vector::_M_insert_aux(iterator, bool) [with _Alloc =3D __gnu_test::propagating_allocator]' at /home/apinski/src/upstream-gcc/gcc/objdir/x86_64-pc-linux-gnu/libstdc++-v3/= include/bits/vector.tcc:945,^M inlined from 'void std::vector::push_back(bool) [with _Alloc =3D __gnu_test::propagating_allocator]' at /home/apinski/src/upstream-gcc/gcc/objdir/x86_64-pc-linux-gnu/libstdc++-v3/= include/bits/stl_bvector.h:1121,^M inlined from 'void test01()' at /home/apinski/src/upstream-gcc/gcc/libstdc++-v3/testsuite/23_containers/vec= tor/bool/allocator/copy.cc:33:^M /home/apinski/src/upstream-gcc/gcc/objdir/x86_64-pc-linux-gnu/libstdc++-v3/= include/bits/stl_algobase.h:437: warning: 'void* __builtin_memmove(void*, const void*, long unsigned int)' writing between 9 and 9223372036854775807 bytes into a region of size 8 overflows the destination [-Wstringop-overflow=3D]^M In file included from /home/apinski/src/upstream-gcc/gcc/objdir/x86_64-pc-linux-gnu/libstdc++-v3/= include/x86_64-pc-linux-gnu/bits/c++allocator.h:33,^M from /home/apinski/src/upstream-gcc/gcc/objdir/x86_64-pc-linux-gnu/libstdc++-v3/= include/bits/allocator.h:46,^M from /home/apinski/src/upstream-gcc/gcc/objdir/x86_64-pc-linux-gnu/libstdc++-v3/= include/string:43,^M from /home/apinski/src/upstream-gcc/gcc/objdir/x86_64-pc-linux-gnu/libstdc++-v3/= include/bitset:52,^M from /home/apinski/src/upstream-gcc/gcc/objdir/x86_64-pc-linux-gnu/libstdc++-v3/= include/x86_64-pc-linux-gnu/bits/stdc++.h:52:^M In member function '_Tp* std::__new_allocator<_Tp>::allocate(size_type, const void*) [with _Tp =3D long unsigned int]',^M inlined from 'static _Tp* std::allocator_traits >::allocate(allocator_type&, size_type) [with _Tp =3D long unsigned int]' at /home/apinski/src/upstream-gcc/gcc/objdir/x86_64-pc-linux-gnu/libs= tdc++-v3/include/bits/alloc_traits.h:482,^M inlined from '__gnu_test::uneq_allocator::pointer __gnu_test::uneq_allocator::allocate(size_type, const void*) [with Tp =3D long unsigned int; Alloc =3D std::allocator]' at /home/apinski/src/upstream-gcc/gcc/libstdc++-v3/testsuite/util/testsuite_al= locator.h:360,^M inlined from 'static std::allocator_traits< >::pointer std::allocator_traits< >::allocate(_Alloc&, size_type) [with _Alloc =3D __gnu_test::propagating_allocator >]' at /home/apinski/src/upstream-gcc/gcc/objdir/x86_64-pc-linux-gnu/libstdc++-v3/= include/bits/alloc_traits.h:333,^M inlined from 'std::_Bvector_base<_Alloc>::_Bit_pointer std::_Bvector_base<_Alloc>::_M_allocate(std::size_t) [with _Alloc =3D __gnu_test::propagating_allocator]' at /home/apinski/src/upstream-gcc/gcc/objdir/x86_64-pc-linux-gnu/libstdc++-v3/= include/bits/stl_bvector.h:643,^M inlined from 'void std::vector::_M_insert_aux(iterator, bool) [with _Alloc =3D __gnu_test::propagating_allocator]' at /home/apinski/src/upstream-gcc/gcc/objdir/x86_64-pc-linux-gnu/libstdc++-v3/= include/bits/vector.tcc:943,^M inlined from 'void std::vector::push_back(bool) [with _Alloc =3D __gnu_test::propagating_allocator]' at /home/apinski/src/upstream-gcc/gcc/objdir/x86_64-pc-linux-gnu/libstdc++-v3/= include/bits/stl_bvector.h:1121,^M inlined from 'void test01()' at /home/apinski/src/upstream-gcc/gcc/libstdc++-v3/testsuite/23_containers/vec= tor/bool/allocator/copy.cc:33:^M /home/apinski/src/upstream-gcc/gcc/objdir/x86_64-pc-linux-gnu/libstdc++-v3/= include/bits/new_allocator.h:147: note: destination object of size 8 allocated by 'operator new'^M Thanks, Andrew Pinski Thanks, Andrew Pinski > > b.C: In function =E2=80=98void test_strcpy_new_int16_t(size_t, const size= _t*)=E2=80=99: > b.C:76:12: warning: =E2=80=98void* __builtin_memcpy(void*, const void*, l= ong > unsigned int)=E2=80=99 writing 3 bytes into a region of size 0 > [-Wstringop-overflow=3D] > 76 | strcpy (d, s); \ > | ~~~~~~~^~~~~~ > b.C:90:3: note: in expansion of macro =E2=80=98T=E2=80=99 > 90 | T (S (2), new int16_t[r_imin_imax + 1]); // { dg-bogus "into > a region of size" "pr106120" { xfail { ilp32 && c++98_only } } } > > > previously, by VRP2 time we hadn't figured out the edge case, couldn't > recalculate _29 and iftmp.1_38 was unknown. > > iftmp.1_38 =3D _29 * 2; > _40 =3D operator new [] (iftmp.1_38); > __builtin_memcpy (_40, &MEM [(void > *)"0123456789abcdefghijklmnopqrstuvwxyz" + 34B], 3); > > Now, by VRP2 we have figured it out... > > _40 =3D operator new [] (0); > __builtin_memcpy (_40, &MEM [(void > *)"0123456789abcdefghijklmnopqrstuvwxyz" + 34B], 3); > > And that info is available earlier for the warnings, just hasn't been > explcitly exposed: > > Do we want to change the cfail to always? something like: > > diff --git a/gcc/testsuite/g++.dg/warn/Wstringop-overflow-4.C > b/gcc/testsuite/g++.dg/warn/Wstringop-overflow-4.C > index 35fb59e0232..faad5bed074 100644 > --- a/gcc/testsuite/g++.dg/warn/Wstringop-overflow-4.C > +++ b/gcc/testsuite/g++.dg/warn/Wstringop-overflow-4.C > @@ -141,7 +141,7 @@ void test_strcpy_new_int16_t (size_t n, const size_t > vals[]) > > int r_imin_imax =3D SR (INT_MIN, INT_MAX); > T (S (1), new int16_t[r_imin_imax]); > - T (S (2), new int16_t[r_imin_imax + 1]); // { dg-bogus "into a region > of size" "pr106120" { xfail { ilp32 && c++98_only } } } > + T (S (2), new int16_t[r_imin_imax + 1]); // { dg-bogus "into a region > of size" "pr106120" { xfail { c++98_only } } } > T (S (9), new int16_t[r_imin_imax * 2 + 1]); > > int r_0_imax =3D SR (0, INT_MAX); > > > Of course, I dont know what this is doing on other arches... perhaps > wait for the fallout to be complete? > > Andrew > > On 3/30/23 12:05, Jakub Jelinek wrote: > > On Thu, Mar 30, 2023 at 11:58:19AM -0400, Andrew MacLeod wrote: > >> On 3/30/23 09:41, Jakub Jelinek wrote: > >>> On Wed, Mar 29, 2023 at 01:22:27PM -0400, Andrew MacLeod wrote: > >>>> however, as seems to be the case often, better ranges result in, I n= ow get: > >>>> > >>>> FAIL: 23_containers/vector/bool/allocator/copy.cc (test for excess e= rrors) > >>> Our middle-end warnings are just badly designed :(, the better value = ranges > >>> are, the more false positives they have. > >>> > >>>> commit 358d0ca44faf2e20fbacd0f74386308b5ca52cd4 > >>>> Author: Andrew MacLeod > >>>> Date: Tue Mar 28 12:16:34 2023 -0400 > >>>> > >>>> Add recursive GORI recompuations with a depth limit. > >>> LGTM for trunk, let's do with the regression incrementally. > >>> Or as Richard mentioned on IRC, one possibility would be to force thi= s > >>> param temporarily to 1 (or whatever matches previous behavior) for th= e > >>> diagnostic range queries). > >>> > >>> You need a ChangeLog entry though... > >>> > >> Attached. I also removed the bogus warning in Walloc-13.c that no long= er > >> happens > >> > >> So incrementally deal with it.. what? just let it fail? > > For today? Yes. > > > > Ok for trunk. > > > >> commit debb8ce1f9b9d5a72d88d0ae90a6b4da5130ff59 > >> Author: Andrew MacLeod > >> Date: Tue Mar 28 12:16:34 2023 -0400 > >> > >> Add recursive GORI recompuations with a depth limit. > >> > >> PR tree-optimization/109154 > >> gcc/ > >> * gimple-range-gori.cc (gori_compute::may_recompute_p): A= dd depth limit. > >> * gimple-range-gori.h (may_recompute_p): Add depth param. > >> * params.opt (ranger-recompute-depth): New param. > >> > >> gcc/testsuite/ > >> * gcc.dg/Walloca-13.c: Remove bogus warning that is now f= ixed. > > Jakub > > >