From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 474EB3858C41; Wed, 21 Jun 2023 04:33:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 474EB3858C41 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687322007; bh=YGk8qPYnwpGKxwyG2p1JkbiZdjHZVzACOGdZhghJrLk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=HJecwVJyiDQ0QiHJAiFNWmk1fA147BeqnPg8A8gO3qZnAlhmjjK7CnIw4/yuquXsB HCvhOgTWEmb7xKBFYo/jfuMMu1eUPMkeKaiqRYOSd8SGesPelfO6WxYjv3iOoXqOVm kaoCqhbkaZsOkI5PUQIVseqMjBqMPiiqGXxifHw4= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/94021] -Wformat-truncation false positive due to excessive integer range Date: Wed, 21 Jun 2023 04:33:26 +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: 9.2.1 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status resolution target_milestone 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=3D94021 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED Target Milestone|--- |13.0 --- Comment #11 from Andrew Pinski --- GCC 13: # RANGE [irange] int [0, 59] NONZERO 0x3f m_10 =3D _1 / 60; # RANGE [irange] int [0, 24] NONZERO 0x1f h_9 =3D _5 / 3600; GCC 12: # RANGE [0, 59] NONZERO 63 m_10 =3D _1 / 60; # RANGE [0, 596523] NONZERO 1048575 h_9 =3D _5 / 3600; And the warning is gone in GCC 13 too. And produces: /app/example.cpp:14: snprintfD.1756: objsize =3D 8, fmtstr =3D "%s%02i%02i" Directive 1 at offset 0: "%s" Result: 1, 1, 1, 1 (1, 1, 1, 1) Directive 2 at offset 2: "%02i" Result: 2, 2, 2, 2 (3, 3, 3, 3) Directive 3 at offset 6: "%02i" Result: 2, 2, 2, 2 (5, 5, 5, 5) Directive 4 at offset 10: "", length =3D 1 Substituting 5 for return value.=