From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BE7463858404; Mon, 8 Nov 2021 19:50:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BE7463858404 From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/103121] [12 Regression] Warnings in cp/optimize.c causing build failure Date: Mon, 08 Nov 2021 19:50:10 +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.0 X-Bugzilla-Keywords: build, diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: msebor at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2021 19:50:10 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103121 --- Comment #8 from Martin Sebor --- The [1, 1] range comes from a call to qry->range_of_expr (vr, exp, stmt) in= in get_size_range() in pointer-query.cc: (gdb) p debug(gimple_bb(stmt)) [local count: 118111600]: _4 =3D _1 + 1; grp_name_37 =3D __builtin_alloca (_4); p_38 =3D _32->identifier.id.str; q_39 =3D _35->identifier.id.str; if (_1 !=3D 0) goto ; [89.00%] else goto ; [11.00%] $3 =3D void (gdb) n=20=20=20=20 326 max =3D wi::to_wide (vr.max ()); (gdb) p range_type $4 =3D VR_RANGE (gdb) p debug_tree(vr.min()) cons= tant 1> $5 =3D void (gdb) p debug_tree(vr.max()) cons= tant 1> $6 =3D void (gdb) up #1 0x0000000001513720 in gimple_call_alloc_size (stmt=3D0x7ffff4c23d80,=20 rng1=3D0x7fffffffc980, qry=3D0x7fffffffd8a0) at /src/gcc/master/gcc/pointer-query.cc:506 506 if (!get_size_range (qry, size, stmt, r, SR_ALLOW_ZERO | SR_USE_LARGEST)) (gdb)=20 #2 0x000000000151a68c in handle_ssa_name (ptr=3D0x7ffff4d0ebd0, addr=3Dfal= se,=20 ostype=3D1, pref=3D0x7fffffffd230, snlim=3D..., qry=3D0x7fffffffd978) at /src/gcc/master/gcc/pointer-query.cc:2088 2088 if (gimple_call_alloc_size (stmt, wr, rvals)) (gdb)=20 #3 0x000000000151bd4c in compute_objsize_r (ptr=3D0x7ffff4d0ebd0,=20 stmt=3D0x7ffff4de2730, addr=3Dfalse, ostype=3D1, pref=3D0x7fffffffd230,= =20 snlim=3D..., qry=3D0x7fffffffd978) at /src/gcc/master/gcc/pointer-query.cc:2380 2380 return handle_ssa_name (ptr, addr, ostype, pref, snlim, qry); (gdb)=20 #4 0x0000000001519e17 in handle_mem_ref (mref=3D0x7ffff47f8a00,=20 stmt=3D0x7ffff4de2730, ostype=3D1, pref=3D0x7fffffffd230, snlim=3D...,= =20 qry=3D0x7fffffffd978) at /src/gcc/master/gcc/pointer-query.cc:1976 1976 if (!compute_objsize_r (mrefop, stmt, false, ostype, pref, snlim, qry)) (gdb)=20 #5 0x000000000151b844 in compute_objsize_r (ptr=3D0x7ffff47f8a00,=20 stmt=3D0x7ffff4de2730, addr=3Dfalse, ostype=3D1, pref=3D0x7fffffffd230,= =20 snlim=3D..., qry=3D0x7fffffffd978) at /src/gcc/master/gcc/pointer-query.cc:2314 2314 return handle_mem_ref (ptr, stmt, ostype, pref, snlim, qry); (gdb)=20 #6 0x000000000151befc in compute_objsize (ptr=3D0x7ffff47f8a00,=20 stmt=3D0x7ffff4de2730, ostype=3D1, pref=3D0x7fffffffd230,=20 ptr_qry=3D0x7fffffffd978) at /src/gcc/master/gcc/pointer-query.cc:2414 2414 if (!compute_objsize_r (ptr, stmt, false, ostype, pref, snlim, ptr_qry)) (gdb)=20 #7 0x000000000192c0df in strlen_pass::maybe_warn_overflow ( this=3D0x7fffffffd880, stmt=3D0x7ffff4de2730, call_lhs=3Dtrue,=20 len=3D0x7ffff78ff4e0, si=3D0x0, plus_one=3Dfalse, rawmem=3Dfalse) at /src/gcc/master/gcc/tree-ssa-strlen.c:2038 2038 tree destsize =3D compute_objsize (dest, stmt, ostype, &aref, &ptr_qry); (gdb) dg stmt # .MEM_53 =3D VDEF <.MEM_36> *grp_name_37 =3D 0; $7 =3D (gimple *) 0x7ffff4de2730=