From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id F14183857806; Thu, 5 Oct 2023 19:54:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F14183857806 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1696535671; bh=NiH/Nb8AS6kKb2kMZRke9VONKvIXWaU5w53qWh6SX8M=; h=From:To:Subject:Date:In-Reply-To:References:From; b=xkALAhu9ZtzhrPv/YSyCwb9OwnJaG/+eNPRHNdNGe5/bBr9rxmN/w5lkEvHVndx1c YCEgtoOZLu0mIGEhHN8HQDmKTyukYmrClaku3g7+YPKv4q6B53ANDm4AaAkrnn+8TK tq1hcSj/qx0b6+lELniyyLrLfDxeie6XtVvA6bVw= From: "tg at mirbsd dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/108896] provide "element_count" attribute to give more context to __builtin_dynamic_object_size() and -fsanitize=bounds Date: Thu, 05 Oct 2023 19:54:29 +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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: tg at mirbsd dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: qinzhao at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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=3D108896 Thorsten Glaser changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tg at mirbsd dot org --- Comment #47 from Thorsten Glaser --- Regarding the proposed attribute: it would also be really great if I could = do=E2=80=A6 struct foo { int type; char name[] __attribute__((__element_count__(0))); }; =E2=80=A6 to denote name[] is a NUL-terminated string. This also allows, although not static, bounds checking for most of the use cases not covered by a counting member (optionally multiplied by an extra factor).=