From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BEFC33858D39; Wed, 15 Dec 2021 17:45:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BEFC33858D39 From: "tomas.kalibera at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/95130] GCC ignoring attribute(format(gnu_printf)) on printf in mingw Date: Wed, 15 Dec 2021 17:45:30 +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: 9.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: tomas.kalibera at gmail dot com 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: 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: Wed, 15 Dec 2021 17:45:30 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95130 --- Comment #5 from Tomas Kalibera --- (In reply to joseph@codesourcery.com from comment #1) > See bug 92292. The extra attribute isn't ignored, it simply means the=20 > function has multiple format attributes, which is valid, but should=20 > probably be special-cased for this case of built-in functions. I've added a draft of a patch to address the issue in the suggested way. I'= ve tested it in gcc 10.3.0 on the example from comment 2 (also attached). With= the patch applied, only line (2) gets a warning, as it should. When deciding whether to emit a format warning for a function with multiple format attributes, it skips the first format in case it is a builtin known = to have a format added by gcc. Please let me know if you have any advice how to improve (thanks to Martin Liska for helping me with identifying the builtin= s), or indeed feel free to adjust and add your way. Fixing this would help the R community or anyone else who uses GCC with UCRT. Thanks, Tomas=