From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9A84E3857375; Fri, 22 Apr 2022 10:31:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9A84E3857375 From: "aldyh at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/105329] Bogus restrict warning when assigning 1-char string literal to std::string Date: Fri, 22 Apr 2022 10:31:55 +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: diagnostic, missed-optimization, needs-bisection X-Bugzilla-Severity: normal X-Bugzilla-Who: aldyh 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: --- 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: Fri, 22 Apr 2022 10:31:55 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105329 Aldy Hernandez changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |aldyh at gcc dot gnu.org --- Comment #4 from Aldy Hernandez --- (In reply to Andrew Macleod from comment #3) > p vr.dump(stderr) > const size_type [1, 9223372036854775807] >=20 > I also have a breakpoint in set_range_info for this name which hasn't been > triggered. So either the set routine have been bypassed or perhaps > inlining is setting this global value? >=20 > Im still trying to figure out who and where has decided that __nleft_49 is > [2, 0x7FFFFFFFFFFFFFFF] instead of [2, 0xFFFFFFFFFFFFFFFFFFFF] Global ranges can also be set via duplicate_ssa_name_range_info, which is u= sed by the inliner. It looks like [1, 9223372036854775807] was originally calculated in evrp for __nleft_64: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D BB 45 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Imports: _27 __s_53(D)=20=20 Exports: _27 _34 __s_53(D) __nleft_64=20=20 _34 : _27(I) __s_53(D)(I)=20=20 __nleft_64 : _27(I) _34 __s_53(D)(I)=20=20 _27 char * [1B, -2B] __s_53(D) const char * [0B, -3B] Relational : (__s_53(D) < _26) Relational : (_27 > __s_53(D)) : _34 =3D _27 - __s_53(D); __nleft_64 =3D (const size_type) _34; if (_34 =3D=3D 1) goto ; [34.00%] else goto ; [66.00%] _34 : long int [1, +INF] __nleft_64 : long unsigned int [1, 9223372036854775807] 45->46 (T) _27 : char * [1B, -2B] 45->46 (T) _34 : long int [1, 1] 45->46 (T) __s_53(D) : const char * [0B, -3B] 45->46 (T) __nleft_64 : long unsigned int [1, 9223372036854775807] 45->47 (F) _27 : char * [1B, -2B] 45->47 (F) _34 : long int [2, +INF] 45->47 (F) __s_53(D) : const char * [0B, -3B] 45->47 (F) __nleft_64 : long unsigned int [1, 9223372036854775807] This was later renamed to __nleft_40, and then copied by the IPA inliner to __nleft_47 and ultimately to __nleft_49.=