From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7BC47385840D; Mon, 7 Nov 2022 20:06:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7BC47385840D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667851603; bh=XRgAaErRUGDZgm7+RI3fomXrQOc+KQx5teMIPM/sFVw=; h=From:To:Subject:Date:From; b=WyYNpHQYKdytX0fe/Y3mK+Gdo5aeUlgmFvCG8HAkB0nnSTh+NVCtInlP7KibuV7Tk 7EH89h34Zsfu3SS7j6x0Kdd7o9MEqCxhfe8YYfmk4mf9ibBAbjFTcIzWwnvou3CxmK DSGCpLUmFVNI/ZtN9iM9m+oYl6oSyXI+e6lCHhI8= From: "aldyh at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107561] New: g++.dg/pr17488.C regression due to -Wstringop-overflow problem Date: Mon, 07 Nov 2022 20:06:42 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: aldyh at gcc dot gnu.org 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 bug_severity priority component assigned_to reporter target_milestone 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=3D107561 Bug ID: 107561 Summary: g++.dg/pr17488.C regression due to -Wstringop-overflow problem Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: aldyh at gcc dot gnu.org Target Milestone: --- g++.dg/pr17488.C fails after commit r13-3761 with: warning: =E2=80=98void* __builtin_memcpy(void*, const void*, long unsigned = int)=E2=80=99 writing 8 or more bytes into a region of size 0 overflows the destination [-Wstringop-overflow=3D] ... ... note: destination object of size 0 allocated by =E2=80=98operator new=E2=80= =99 There is no difference in the IL the -Wstringop-overflow pass sees. For that matter, there is no difference in the entire IL across through the *.optimized dump. However, there are different ranges for two SSA names. In the *.waccess1 pass we see: --- /tmp/a.ii.025t.waccess1.orig.787460 2022-11-07 19:43:41.341855227 +0100 +++ /tmp/a.ii.025t.waccess1.new.787460 2022-11-07 19:43:41.344855238 +0100 @@ -331,8 +331,8 @@ max_depth: 3 pointer_query cache contents: - 5.0[1]: _5 =3D _5 (base0); size: unknown - 6.0[3]: _6 =3D _5 (base0); size: unknown + 5.0[1]: _5 =3D _5 (base0); size: [16, 9223372036854775807] + 6.0[3]: _6 =3D _5 (base0); size: [16, 9223372036854775807] __attribute__((malloc)) struct valarray * std::__valarray_get_storage= > (size_t __n) @@ -364,8 +364,8 @@ max_depth: 3 pointer_query cache contents: - 5.0[1]: _5 =3D _5 (base0); size: unknown - 6.0[3]: _6 =3D _5 (base0); size: unknown + 5.0[1]: _5 =3D _5 (base0); size: [8, 9223372036854775807] + 6.0[3]: _6 =3D _5 (base0); size: [8, 9223372036854775807] __attribute__((malloc)) long long int * std::__valarray_get_storage (size_t __n) This coincides with two unsigned multiplications by 16 and 8, where we correctly restrict the range. This is from the evrp dump: -Global Exported: _2 =3D [irange] long unsigned int [0, +INF] NONZERO 0xfffffffffffffff0 +Global Exported: _2 =3D [irange] long unsigned int [0, 0][16, +INF] NONZERO 0xfffffffffffffff0 -Global Exported: _2 =3D [irange] long unsigned int [0, +INF] NONZERO 0xfffffffffffffff8 +Global Exported: _2 =3D [irange] long unsigned int [0, 0][8, +INF] NONZERO 0xfffffffffffffff8 This is correct as we know the ranges cannot be [1,15] and [1,7] respective= ly.=