From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 07ED2393BC3B; Mon, 1 Mar 2021 14:48:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 07ED2393BC3B From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/95757] [11 regression] missing warning in gcc.dg/Wstringop-overflow-25.c since r11-1517 Date: Mon, 01 Mar 2021 14:48:21 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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, 01 Mar 2021 14:48:22 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95757 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |aldyh at gcc dot gnu.org, | |jakub at gcc dot gnu.org --- Comment #8 from Jakub Jelinek --- We get only 3 warnings on the last function with -O2 -Wall -Wno-array-bounds --param=3Dlogical-op-non-short-circuit=3D0 -ftrack-macro-expansion=3D0 while we get 4 with -O2 -Wall -Wno-array-bounds --param=3Dlogical-op-non-short-circuit=3D1 -ftrack-macro-expansion=3D0 I think the important differences are that while we have in *.optimized pre= tty much the same IL - I only see differences between SSA_NAME versions, in the --param=3Dlogical-op-non-short-circuit=3D1 case we have more accurate SSA_NAME_RANGE_INFO on 3 SSA_NAMEs [local count: 1073741824]: - _51 =3D{v} unsigned_value_source; - if (_51 > 1) + _57 =3D{v} unsigned_value_source; + if (_57 > 1) goto ; [50.00%] else goto ; [50.00%] [local count: 536870912]: # RANGE [1, 2] NONZERO 3 - _55 =3D _51 + 1; + _55 =3D _57 + 1; [local count: 1073741824]: # RANGE [1, 2] NONZERO 3 - # prephitmp_54 =3D PHI <_55(3), 1(2)> - _49 =3D{v} unsigned_value_source; - _48 =3D _49 + 18446744073709551615; - if (_48 > 1) + # prephitmp_50 =3D PHI <1(2), _55(3)> + _52 =3D{v} unsigned_value_source; + _59 =3D _52 + 18446744073709551615; + if (_59 > 1) goto ; [50.00%] else goto ; [50.00%] - [local count: 268435457]: - _53 =3D _49 + 1; + [local count: 536870913]: + # RANGE [2, 3] NONZERO 3 + _53 =3D _52 + 1; [local count: 1073741824]: - # prephitmp_57 =3D PHI <2(4), _53(5)> + # RANGE [2, 3] NONZERO 3 + # prephitmp_54 =3D PHI <2(4), _53(5)> _47 =3D{v} unsigned_value_source; - _52 =3D _47 + 18446744073709551614; - if (_52 > 1) + _61 =3D _47 + 18446744073709551614; + if (_61 > 1) goto ; [50.00%] else goto ; [50.00%] - [local count: 268435457]: - _59 =3D _47 + 1; + [local count: 536870913]: + # RANGE [3, 4] NONZERO 7 + _48 =3D _47 + 1; [local count: 1073741824]: ... I mean the _53, prephitmp_54 and _48 ranges above in the + lines (i.e. =3D1= ). Early during optimizations we have the usual short-circuit vs. non-short-circuit differences like: - # iftmp.0_52 =3D PHI <_51(3), 0(2)> - _49 =3D{v} unsigned_value_source; - if (_49 =3D=3D 0) - goto ; [50.00%] + # iftmp.0_58 =3D PHI <0(2), _57(3)> + _52 =3D{v} unsigned_value_source; + _53 =3D _52 =3D=3D 0; + _54 =3D _52 > 2; + _55 =3D _53 | _54; + if (_55 !=3D 0) + goto ; [50.00%] else goto ; [50.00%] [local count: 536870913]: - if (_49 > 2) - goto ; [50.00%] - else - goto ; [50.00%] - - [local count: 268435456]: - [local count: 1073741824]: - # iftmp.0_50 =3D PHI <1(4), 1(5), _49(6)> + [local count: 1073741824]: + # iftmp.0_56 =3D PHI <1(4), _52(5)> but they gradually disappear. Right before *.dom3 the IL is already pretty much the same when ignoring SSA_NAME version differences, except: - # prephitmp_54 =3D PHI <_55(3), 1(2)> - _49 =3D{v} unsigned_value_source; - _48 =3D _49 + 18446744073709551615; - _1 =3D _48 > 1; - if (_1 !=3D 0) + # prephitmp_50 =3D PHI <1(2), _55(3)> + _52 =3D{v} unsigned_value_source; + _59 =3D _52 + 18446744073709551615; + if (_59 > 1) and _47 =3D{v} unsigned_value_source; - _52 =3D _47 + 18446744073709551614; - _50 =3D _52 > 1; - if (_50 !=3D 0) + _61 =3D _47 + 18446744073709551614; + if (_61 > 1) i.e. the - version (=3D0) doesn't have the comparisons folded into GIMPLE_C= ONDs while the + version (=3D1) does. And I believe that is the trigger on why during dom3 adds the more precise ranges in the --param=3Dlogical-op-non-short-circuit=3D1 case and not in the --param=3Dlogical-op-non-short-circuit=3D0 case.=