From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 75BFA3858407; Tue, 13 Sep 2022 20:09:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 75BFA3858407 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663099762; bh=SmGZbF5HlyoSWO2i7nCZhax1U2szjBNzK59pcSqkZX4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=E3wOUuLnG4ggPj+or9miFI4mO+hmLTocUggNg+2RtDqYVHcnzvDmKgoVqY/DyoGJ6 QOzOrXKTVy9FZ30g0Bpnq8EAEhhHfJNG5/4AICB2NwxavsCP7NJFhOXiZ9hvYPLvHE SQ56lL4WqYBX5TnZi0pK7IVrkJw4EsniBxESK7aw= From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/106931] [12/13 Regression] -Wstringop-overflow false positive -O3 -fno-tree-vectorize with loop unrolling since r12-3300-gece28da924ddda8b Date: Tue, 13 Sep 2022 20:09:22 +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: 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.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: short_desc 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=3D106931 Martin Sebor changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|[12/13 Regression] |[12/13 Regression] |-Wstringop-overflow false |-Wstringop-overflow false |positive -O3 |positive -O3 |-fno-tree-vectorize since |-fno-tree-vectorize with |r12-3300-gece28da924ddda8b |loop unrolling since | |r12-3300-gece28da924ddda8b --- Comment #2 from Martin Sebor --- The false positive is issued for the store to A[i_90] in BB 10 by the strlen pass, where i_90's range is [8, 8]. [local count: 712060]: _35 =3D (sizetype) i_90; _36 =3D B.1_83 + _35; _37 =3D *_36; A[i_90] =3D _37; << -Wstringop-overflow _20 =3D _93 + 9; i_39 =3D (int) _20; goto ; [100.00%] Changing i's type to unsigned avoids the warning. The IL looks very close = but i_90's range in BB 10 is VR_UNDEFINED instead. The following is debug_ranger() output for BBs 9 and 10 in the original test case. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D BB 9 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Imports: _93=20=20 Exports: _8 i_90 _93=20=20 _8 : _93(I)=20=20 _86 : i_82(I)=20=20 _87 : i_82(I) B.1_83(I) _86=20=20 i_90 : _8 _93(I)=20=20 i_82 [irange] int [7, 7] NONZERO 0x7 _93 [irange] unsigned int [0, 0] NONZERO 0x0 Relational : (_8 > _93) [local count: 801058]: _86 =3D (sizetype) i_82; _87 =3D B.1_83 + _86; _88 =3D *_87; A[i_82] =3D _88; _8 =3D _93 + 8; i_90 =3D (int) _8; if (i_90 !=3D 8) goto ; [88.89%] else goto ; [11.11%] _8 : [irange] unsigned int [8, 8] NONZERO 0x8 _86 : [irange] sizetype [7, 7] NONZERO 0x7 _87 : [irange] char * [1, +INF] i_90 : [irange] int [8, 8] NONZERO 0x8 9->10 (T) _8 : [irange] UNDEFINED 9->10 (T) i_90 : [irange] UNDEFINED 9->10 (T) _93 : [irange] UNDEFINED 9->12 (F) _8 : [irange] unsigned int [8, 8] NONZERO 0x8 9->12 (F) i_90 : [irange] int [8, 8] NONZERO 0x8 9->12 (F) _93 : [irange] unsigned int [0, 0] NONZERO 0x0 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D BB 10 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D _93 [irange] UNDEFINED [local count: 712060]: _35 =3D (sizetype) i_90; _36 =3D B.1_83 + _35; _37 =3D *_36; A[i_90] =3D _37; _20 =3D _93 + 9; i_39 =3D (int) _20; goto ; [100.00%] whereas for the unsigned case: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D BB 10 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D _85 [irange] UNDEFINED i_90 [irange] UNDEFINED=