Re: [GCC16 stage 1][RFC][PATCH 0/3]extend "counted_by" attribute to pointer fields of structures

2025-01-17 Thread Bill Wendling
On Fri, Jan 17, 2025 at 3:14 PM Joseph Myers wrote: > > On Fri, 17 Jan 2025, Qing Zhao wrote: > > > struct fc_bulk { > > ... > > struct fs_bulk fs_bulk; > > struct fc fcs[] __counted_by(fs_bulk.len); > > }; > > > > i.e, the “counted_by” field is in the inner structure of the current > > st

Re: [GCC16 stage 1][RFC][PATCH 0/3]extend "counted_by" attribute to pointer fields of structures

2025-01-17 Thread Bill Wendling
gt;> > >> Although in the previous discussion, I agreed with Martin that we should > >> use the > >> designator syntax (i.e, counted_by (.n) instead of counted_by (n)) for the > >> counted_by attribute for pointer fields, after more consideration and > >

Re: [GCC16 stage 1][RFC][PATCH 0/3]extend "counted_by" attribute to pointer fields of structures

2025-01-16 Thread Bill Wendling
On Thu, Jan 16, 2025 at 3:06 PM Qing Zhao wrote: > > On Jan 16, 2025, at 17:29, Bill Wendling wrote: > > > > On Thu, Jan 16, 2025 at 1:19 PM Qing Zhao wrote: > >> > >> Hi, > >> > >> This is the patch set to extend "counted_by"

Re: [GCC16 stage 1][RFC][PATCH 0/3]extend "counted_by" attribute to pointer fields of structures

2025-01-16 Thread Bill Wendling
;p->array', and 'ref2' uses 'val2' as the number of elements in > 'p->array'. " > > Although in the previous discussion, I agreed with Martin that we should use > the > designator syntax (i.e, counted_by (.n) instead of counted_by (

Re: Should -fsanitize=bounds support counted-by attribute for pointers inside a structure?

2024-12-12 Thread Bill Wendling
On Thu, Dec 12, 2024 at 1:28 PM Martin Uecker wrote: > > Am Montag, dem 09.12.2024 um 16:20 + schrieb Qing Zhao: > > > > > On Dec 7, 2024, at 03:57, Martin Uecker wrote: > > > > > > Am Freitag, dem 06.12.2024 um 16:13 + schrieb Qing Zhao: > > > > > > > > > On Dec 6, 2024, at 10:56, Martin

Re: Should -fsanitize=bounds support counted-by attribute for pointers inside a structure?

2024-12-11 Thread Bill Wendling
On Thu, Dec 5, 2024 at 2:28 PM Bill Wendling wrote: > On Thu, Dec 5, 2024 at 1:09 PM Qing Zhao wrote: > > > On Dec 3, 2024, at 10:29, Qing Zhao wrote: > > >> On Dec 3, 2024, at 10:07, Martin Uecker wrote: > > >> The language extension does not exist yet, s

Re: Should -fsanitize=bounds support counted-by attribute for pointers inside a structure?

2024-12-05 Thread Bill Wendling
On Thu, Dec 5, 2024 at 2:37 PM Martin Uecker wrote: > > Am Donnerstag, dem 05.12.2024 um 14:28 -0800 schrieb Bill Wendling: > > On Thu, Dec 5, 2024 at 1:09 PM Qing Zhao wrote: > > > > On Dec 3, 2024, at 10:29, Qing Zhao wrote: > > > > > On Dec

Re: Should -fsanitize=bounds support counted-by attribute for pointers inside a structure?

2024-12-05 Thread Bill Wendling
On Thu, Dec 5, 2024 at 1:09 PM Qing Zhao wrote: > > On Dec 3, 2024, at 10:29, Qing Zhao wrote: > >> On Dec 3, 2024, at 10:07, Martin Uecker wrote: > >> The language extension does not exist yet, so there is no problem. > > Yeah, I should mention this as “corresponding future language extension”

Re: [PATCH v5] Provide new GCC builtin __builtin_counted_by_ref [PR116016]

2024-09-11 Thread Bill Wendling
On Wed, Sep 11, 2024 at 2:13 PM Qing Zhao wrote: > > compared to the 4th version, the changes are (address Jacub's concerns): > > 1. change the global "in_builtin_counted_by_ref" from a boolean to an int; > 2. delete the label for the error handling code, and decress the global >"in_builtin_co

Re: [PATCH v1] Provide new GCC builtin __builtin_get_counted_by [PR116016]

2024-09-09 Thread Bill Wendling
On Sun, Sep 8, 2024 at 3:07 AM Martin Uecker wrote: > > Am Sonntag, dem 08.09.2024 um 02:09 -0700 schrieb Bill Wendling: > > On Fri, Sep 6, 2024 at 10:50 PM Martin Uecker wrote: > > > > > > Am Freitag, dem 06.09.2024 um 13:59 -0700 schrieb Bill Wendling: > >

Re: [PATCH v1] Provide new GCC builtin __builtin_get_counted_by [PR116016]

2024-09-08 Thread Bill Wendling
On Fri, Sep 6, 2024 at 11:16 PM Martin Uecker wrote: > > Am Samstag, dem 07.09.2024 um 00:12 + schrieb Qing Zhao: > > Now, if > > > > 1. __builtin_get_counted_by should return a LVALUE instead of a pointer > > (required by CLANG’s design) > > And > > 2. It’s better not to change the behavior

Re: [PATCH v1] Provide new GCC builtin __builtin_get_counted_by [PR116016]

2024-09-08 Thread Bill Wendling
long history of hating compiler warnings, even in cases where they explicitly *ask* for the warnings, so it's not likely to run into a NACK or anything... > thanks. > > Qing > > On Sep 6, 2024, at 16:59, Bill Wendling wrote: > > > > On Fri, Sep 6, 2024 at 12:32 PM

Re: [PATCH v1] Provide new GCC builtin __builtin_get_counted_by [PR116016]

2024-09-08 Thread Bill Wendling
On Fri, Sep 6, 2024 at 10:50 PM Martin Uecker wrote: > > Am Freitag, dem 06.09.2024 um 13:59 -0700 schrieb Bill Wendling: > > On Fri, Sep 6, 2024 at 12:32 PM Martin Uecker wrote: > > > > > > Am Freitag, dem 06.09.2024 um 13:59 + schrieb Qing Zhao: > > &g

Re: [PATCH v1] Provide new GCC builtin __builtin_get_counted_by [PR116016]

2024-09-06 Thread Bill Wendling
On Fri, Sep 6, 2024 at 12:32 PM Martin Uecker wrote: > > Am Freitag, dem 06.09.2024 um 13:59 + schrieb Qing Zhao: > > > > > On Sep 5, 2024, at 18:22, Bill Wendling wrote: > > > > > > Hi Qing, > > > > > > Sorry for my late reply. >

Re: [PATCH v1] Provide new GCC builtin __builtin_get_counted_by [PR116016]

2024-09-05 Thread Bill Wendling
Hi Qing, Sorry for my late reply. On Thu, Aug 29, 2024 at 7:22 AM Qing Zhao wrote: > > Hi, > > Thanks for the information. > > Yes, providing a unary operator similar as __counted_by(PTR) as suggested by > multiple people previously is a cleaner approach. > > Then the programmer will use the fo

Re: [PATCH v1] Provide new GCC builtin __builtin_get_counted_by [PR116016]

2024-08-27 Thread Bill Wendling
On Tue, Aug 27, 2024 at 6:58 AM Qing Zhao wrote: > > On Aug 27, 2024, at 02:17, Martin Uecker wrote: > > Am Montag, dem 26.08.2024 um 17:21 -0700 schrieb Kees Cook: > >> On Mon, Aug 26, 2024 at 11:01:08PM +0200, Martin Uecker wrote: > >>> Am Montag, dem 26.08.2024 um 13:30 -0700 schrieb Kees Cook

Re: [PATCH v1] Provide new GCC builtin __builtin_get_counted_by [PR116016]

2024-08-26 Thread Bill Wendling
On Thu, Aug 22, 2024 at 8:03 AM Qing Zhao wrote: > > On Aug 21, 2024, at 18:08, Bill Wendling wrote: > >> For the unary operator __counted_by(PTR), “PTR” must have a counted_by > >> attribute, if not, there will be a compilation time error. > >> > >&g

Re: [PATCH v1] Provide new GCC builtin __builtin_get_counted_by [PR116016]

2024-08-26 Thread Bill Wendling
On Wed, Aug 21, 2024 at 8:43 AM Martin Uecker wrote: > > Am Mittwoch, dem 21.08.2024 um 15:24 + schrieb Qing Zhao: > > > > > > But if we changed it to return a void pointer, we could make this > > > a compile-time check: > > > > > > auto ret = __builtin_get_counted_by(__p->FAM); > > > > > > _

Re: [PATCH v1] Provide new GCC builtin __builtin_get_counted_by [PR116016]

2024-08-21 Thread Bill Wendling
On Wed, Aug 21, 2024 at 2:54 PM Bill Wendling wrote: > > On Wed, Aug 21, 2024 at 10:44 AM Kees Cook wrote: > > > > On Wed, Aug 21, 2024 at 03:27:56PM +, Qing Zhao wrote: > > > > On Aug 21, 2024, at 10:45, Martin Uecker wrote: > > > > > >

Re: [PATCH v1] Provide new GCC builtin __builtin_get_counted_by [PR116016]

2024-08-21 Thread Bill Wendling
On Wed, Aug 21, 2024 at 10:52 AM Qing Zhao wrote: > > On Aug 21, 2024, at 11:43, Martin Uecker wrote: > > Am Mittwoch, dem 21.08.2024 um 15:24 + schrieb Qing Zhao: > >>> > >>> But if we changed it to return a void pointer, we could make this > >>> a compile-time check: > >>> > >>> auto ret =

Re: [PATCH v1] Provide new GCC builtin __builtin_get_counted_by [PR116016]

2024-08-21 Thread Bill Wendling
On Wed, Aug 21, 2024 at 10:44 AM Kees Cook wrote: > > On Wed, Aug 21, 2024 at 03:27:56PM +, Qing Zhao wrote: > > > On Aug 21, 2024, at 10:45, Martin Uecker wrote: > > > > > > Am Mittwoch, dem 21.08.2024 um 16:34 +0200 schrieb Martin Uecker: > > >> Am Mittwoch, dem 21.08.2024 um 14:12 + sc

Re: [PATCH v1] Provide new GCC builtin __builtin_get_counted_by [PR116016]

2024-08-21 Thread Bill Wendling
On Tue, Aug 20, 2024 at 6:41 AM Qing Zhao wrote: > > On Aug 20, 2024, at 05:58, Richard Biener > > wrote: > > > > On Tue, Aug 13, 2024 at 5:34 PM Qing Zhao wrote: > >> > >> With the addition of the 'counted_by' attribute and its wide roll-out > >> within the Linux kernel, a use case has been fo

Re: RFC: the proposal to resolve the missing dependency issue for counted_by attribute

2023-11-02 Thread Bill Wendling
On Thu, Nov 2, 2023 at 1:36 PM Qing Zhao wrote: > > Thanks a lot for raising these issues. > > If I understand correctly, the major question we need to answer is: > > For the following example: (Jakub mentioned this in an early message) > > 1 struct S { int a; char b __attribute__((counted_by

Re: RFC: the proposal to resolve the missing dependency issue for counted_by attribute

2023-11-02 Thread Bill Wendling
On Thu, Nov 2, 2023 at 1:00 AM Richard Biener wrote: > > On Wed, Nov 1, 2023 at 3:47 PM Qing Zhao wrote: > > > > > > > > > On Oct 31, 2023, at 6:14 PM, Joseph Myers wrote: > > > > > > On Tue, 31 Oct 2023, Qing Zhao wrote: > > > > > >> 2.3 A new semantic requirement in the user documentation of "