From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3D03B394243C; Fri, 26 May 2023 07:39:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3D03B394243C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685086785; bh=uHEIXfQU/stugMBDRLsgjwjMC1uThtK518u3g+xjJeE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=QUinuz/1aoUgYNG2IgmX14wD/VFwpOWIPjjNTqtVXZBMkoIiVXCUmZnoplx8O/7uX xMExoAJ/N+aDQofgcrZYb04mw11Yd0X0uq9S4/0t70PDZfN+QiAU1DbAuzXng1khH7 SvrLucICdhhB+graAYYMKYz8+V2Sx2FSawrAZC8I= From: "rguenth at gcc dot gnu.org" 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:39:45 +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: rguenth 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: bug_status cf_reconfirmed_on everconfirmed 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 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2023-05-26 Ever confirmed|0 |1 --- Comment #4 from Richard Biener --- Confirmed. This is the usual "we don't warn when we know nothing" vs. "we = warn if we know a tiny bit" vs. "we have a very good idea" case. From e - 1 we know the range passed does not include INT_MAX so we warn. For 'e' we know nothing so we don't - as Andrew says we probably should diagnose this. If you know the value is in a range that fits s[4] then assert that before the prints.=