From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C3EF63858439; Wed, 8 Mar 2023 19:20:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C3EF63858439 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678303209; bh=yDGaRGv0yWu3HMfHKIc+2IzgrTCTuL/iDsj2I1JFvPs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=i/6CDKQbFy90HqxLnbWnyxkUhVWCoaWucaSA8bMurFLUyEJjuaMptSxUD/ZLQlgrn +fzqmX4slzSUSt/Q40LqQZEKoTaarQsfF0A5L0b+AIYYkm5BEfF3yvit+QeeOziQq4 MS6m0ykXpVoqHgrhDNRb0sMiSaXqLqxhIXBH9kaw= 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 19:20:09 +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 #30 from qinzhao at gcc dot gnu.org --- (In reply to Martin Uecker from comment #28) > The problems with VLA are in my opinion caused by poor > implementation (e.g. no stack probing etc) and bad > code generation (Linus was not happy about this) and > not because anything is fundamentally bad about them > from the point of language semantics. you mean gcc's implementation? how about other compilers? > VM =3D variably modified. In C it is a type which is derived from > a VLA which is not necessarily itself a VLA, e.g. a pointer to > a VLA. But a VLA is also a VM type. Okay. >=20 > > struct foo { > > int len; > > char (*buf)[.len]; > > }; > >=20 > >=20 > > This has less issues because the size of the struct then does not depend > > on the length. but I am still not clear on why "the size of the above struct 'foo' does not depend on the .len?" in my opinion, it should depend on .len. do I miss anything here?=