From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 97CA23857400; Wed, 8 Mar 2023 17:13:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 97CA23857400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678295638; bh=J5ihhp/ziAXhDJDj7LeGrkThj2/gPqgcMSdoHDbeCg0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=T8lkkAeDU49yRwLk4Usm6Ai+YNupWf+0RXdSexkRLck+Ct9ZYyRsz/1m15qZhwNsI CBZDUl5V4gPXFj1ckP+QPW/u+xRicStEAuMghAbgKaNCDSxvqZLwy7Pi0IViZlRePG k2ZHmKCvP488LkUuSd0/bgD8M4DPykHyz/agTyoY= From: "qinzhao at gcc dot gnu.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: Wed, 08 Mar 2023 17:13:58 +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: qinzhao at gcc dot gnu.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: 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 --- Comment #24 from qinzhao at gcc dot gnu.org --- (In reply to Martin Uecker from comment #15) >=20 > Yes, but that syntax would be intuitive which I would see > as an advantage. Yes, I agree. >=20 > But I am not saying we shouldn't have the attribute first. both the new attribute and the C's syntax extension might be needed at the = same time, I think. 1. Attribute might be better for changing the existing source code to make = them bound-checking friendly; 2. new code can use the C's syntax change, and hopefully this new syntax extension can be made into next C language standard. however, I think that both the new attribute and the new C syntax extension should support the similar user interface. We might need to decide on this first. right now, the user interface we cannot agreed on is: whether we should support the following nested annotation (either with attribute or with the C syntax extension): struct object { ... unsigned int items; ... struct inner { ... int flex[]; }; } *ptr; My opinion is: No, we should not support this, it will make the implementat= ion much more complicated both for attribute and for C syntax extension.=20 But I am not very sure on this yet.=20 Is the PLACEHOLDER_EXPR able to resolve this?=