From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4C9033858D29; Mon, 17 Jun 2024 11:07:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4C9033858D29 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1718622448; bh=Wn0AHteUjWMaADfIjuVpcOsH6c5XHXBygm/Cf3saAyg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Tzib5ncc/ebcMzaT1ZWKjSS8mzcCO5Ho6Q2iqN4/kRks9z4ADIaM+XLSMFRLsplX3 MOMJ8BZ1fUy2PFked+5PUCJ3kL8e2IewBre5mEnYZgat1PsMyrsGOKDS4Xm6hzUBfN b0RKw1eUJ7lUk/bDyWEyM0aspN4ReicxWI819qE8= From: "xry111 at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/115513] attribute nonstring could help with printf mistakes Date: Mon, 17 Jun 2024 11:07:28 +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: 14.1.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: enhancement X-Bugzilla-Who: xry111 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: 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=3D115513 --- Comment #3 from Xi Ruoyao --- (In reply to Peter Eisentraut from comment #2) > (In reply to Xi Ruoyao from comment #1) > > But what should we do with something like `printf("%32s", pd->name);`? >=20 > Perhaps you mean >=20 > printf("%.32s", pd->name); Yes I mean "%.32s".=