From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DEAE738323EA; Fri, 26 May 2023 07:54:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DEAE738323EA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685087688; bh=2+BVyezqI+yp2XWvmQo2tzrtHNbWTn/c+QnxsvnXK2Y=; h=From:To:Subject:Date:In-Reply-To:References:From; b=uC9qggpbhvpDWrG0enO2sVb10B4T/8ivpU3Ddb5ZOdggvSorZ9vl1zldEPJeEU+Vq j+uuV7bAmG+S/0qPp2SaSDF4ZL9tuaCVJ+KLq3dBfbBn2EZWzP8bv1swHQvu2x/fpb UQklF5bsraAxi/EOICx5/UNxs7Vz/VtURoWYKOr4= From: "vincent-gcc at vinc17 dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/109979] -Wformat-overflow false positive for %d and non-basic expression Date: Fri, 26 May 2023 07:54:48 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: vincent-gcc at vinc17 dot net 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: 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=3D109979 --- Comment #5 from Vincent Lef=C3=A8vre --- (In reply to Andrew Pinski from comment #1) > The warning should happen for both ... OK (as the documentation says "[...] that might overflow the destination buffer). (In reply to Richard Biener from comment #4) > If you know the value is in a range that fits s[4] then assert that before > the prints. I don't think that an assert() will change anything. With MPFR, the code is= in an "else" branch, already with a reduced range. However, this time, I did n= ot use -O2 to enable VRP (I was working on a different issue, but had to use -Werror=3Dformat to change the behavior of the configure script); that was = my mistake. Then I found the inconsistency between "e" and "e - 1", so I did n= ot look further.=