From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3A8A83858D35; Sat, 1 Aug 2020 17:17:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3A8A83858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1596302249; bh=vYvvnXot7xVpm7Woz7V2cSIUoW6C2OwIKeZ6GpNqGv8=; h=From:To:Subject:Date:From; b=nk3MgehIn1aGiIRGFrlpVJf0Gv45CWxwJw5ZOxxpMhkWGB8ztyNOPHp1QHXMiYCPp 02woTV3TPZCYKSN3HlTAR5O9OICcrXx6RFLtc5E6rVT3yZuwYAbrTb21Mp9vpH+L2e 655/H6mW2OBLGZutyx/G2lWEG043rZv50kE5A0RQ= From: "jg at jguk dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/96412] New: format suggestion issue Date: Sat, 01 Aug 2020 17:17:29 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 10.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jg at jguk dot org X-Bugzilla-Status: UNCONFIRMED 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_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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: Sat, 01 Aug 2020 17:17:29 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96412 Bug ID: 96412 Summary: format suggestion issue Product: gcc Version: 10.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jg at jguk dot org Target Milestone: --- Running on godbolt trunk The suggestion is '%ld' in green type colour in the terminal, but should it actually be '%zu' ?=20 -Wformat-signedness -Wall #include int main() { size_t i =3D 0; printf("%ld\n", i); } #1 with x86-64 gcc (trunk) : In function 'int main()': :5:11: warning: format '%ld' expects argument of type 'long int', b= ut argument 2 has type 'size_t' {aka 'long unsigned int'} [-Wformat=3D] 5 | printf("%ld\n", i); | ~~^ ~ | | | | | size_t {aka long unsigned int} | long int | %ld Compiler returned: 0=