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:
> > > > On Fri, Sep 6, 2024 at 12:32 PM Ma
> On Sep 9, 2024, at 10:20, Jakub Jelinek wrote:
>
> On Mon, Sep 09, 2024 at 02:10:05PM +, Qing Zhao wrote:
>> Okay, now after finishing reading all the discussion so far, I realized that
>> we are back to the previous pointer approach:
>>
>> __builtin_get_counted_by (p->FAM)
>>
>> Works
On Mon, Sep 09, 2024 at 02:10:05PM +, Qing Zhao wrote:
> Okay, now after finishing reading all the discussion so far, I realized that
> we are back to the previous pointer approach:
>
> __builtin_get_counted_by (p->FAM)
>
> Works as:
>
> If (has_counted_by (p->FAM))
> return &p->COUNT;
>
Okay, now after finishing reading all the discussion so far, I realized that we
are back to the previous pointer approach:
__builtin_get_counted_by (p->FAM)
Works as:
If (has_counted_by (p->FAM))
return &p->COUNT;
else
return (void *)0;
Then the user will use it as:
auto p = __builtin_get
> On Sep 7, 2024, at 02:16, 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 of __b
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:
> > > On Fri, Sep 6, 2024 at 12:32 PM Martin Uecker wrote:
> > > > > > >
...
> > > >
> > > > My reco
Am Sonntag, dem 08.09.2024 um 02:26 -0700 schrieb Bill Wendling:
> On Sat, Sep 7, 2024 at 12:21 AM Jakub Jelinek wrote:
> > On Sat, Sep 07, 2024 at 07:50:29AM +0200, Martin Uecker wrote:
> > > > 2. Apple's implementation supports expressions in the '__counted_by'
> > > > attribute, thus the 'cou
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
On Fri, Sep 6, 2024 at 5:12 PM Qing Zhao wrote:
>
> 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 of __builtin_choose_expr.
>
> Then the solution left is:
>
> __builtin_get_count
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:
> > > >
> > > > > On Sep 5, 2024, at 18:22, B
On Sat, Sep 07, 2024 at 07:50:29AM +0200, Martin Uecker wrote:
> > 2. Apple's implementation supports expressions in the '__counted_by'
> > attribute, thus the 'count' may be an R-value that can't have its
> > address taken.
> >
> > [1]
> > https://discourse.llvm.org/t/rfc-introducing-new-clang
Am Samstag, dem 07.09.2024 um 08:16 +0200 schrieb Martin Uecker:
> 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
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 of __builtin_choose_expr.
>
> Then the solution left is:
>
> __buil
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:
> > >
> > > > On Sep 5, 2024, at 18:22, Bill Wendling wrote:
> > > >
> > > > Hi Qing,
> > > >
> > > > So
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 of __builtin_choose_expr.
Then the solution left is:
__builtin_get_counted_by (p->FAM) returns a LVALUE as p->COUNT if p->FAM has a
counted
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.
> > >
> > > On Thu, Aug 29, 2024 at 7:22 AM Qing Zhao 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.
> >
> > On Thu, Aug 29, 2024 at 7:22 AM Qing Zhao wrote:
> > >
> > > Hi,
> > >
> > > Thanks for the information.
> > >
> > > Y
> On Sep 5, 2024, at 18:22, Bill Wendling wrote:
>
> 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 peopl
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
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 following:
__builtin_choose_expr(
__builtin_has_attribute (__p->FAM, "counted_by”)
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
> 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:
On Mon, Aug 26, 2024 at 07:30:15PM +, Qing
> On Aug 26, 2024, at 17:01, Martin Uecker wrote:
>
> Am Montag, dem 26.08.2024 um 13:30 -0700 schrieb Kees Cook:
>> On Mon, Aug 26, 2024 at 07:30:15PM +, Qing Zhao wrote:
>>> Hi, Martin,
>>>
>>> Looks like that there is some issue when I tried to use the _Generic for
>>> the testing case
> On Aug 26, 2024, at 16:30, Kees Cook wrote:
>
> On Mon, Aug 26, 2024 at 07:30:15PM +, Qing Zhao wrote:
>> Hi, Martin,
>>
>> Looks like that there is some issue when I tried to use the _Generic for the
>> testing cases, and then I narrowed down to a
>> small testing case that shows the p
> On Aug 26, 2024, at 15:46, Bill Wendling wrote:
>
> 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:
au
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:
> > > On Mon, Aug 26, 2024 at 07:30:15PM +, Qing Zhao wrote:
> > > > Hi, Martin,
> > > >
> > > > Looks li
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:
> > On Mon, Aug 26, 2024 at 07:30:15PM +, Qing Zhao wrote:
> > > Hi, Martin,
> > >
> > > Looks like that there is some issue when I tried to use the _Generic for
> > >
Am Montag, dem 26.08.2024 um 13:30 -0700 schrieb Kees Cook:
> On Mon, Aug 26, 2024 at 07:30:15PM +, Qing Zhao wrote:
> > Hi, Martin,
> >
> > Looks like that there is some issue when I tried to use the _Generic for
> > the testing cases, and then I narrowed down to a
> > small testing case tha
On Mon, Aug 26, 2024 at 07:30:15PM +, Qing Zhao wrote:
> Hi, Martin,
>
> Looks like that there is some issue when I tried to use the _Generic for the
> testing cases, and then I narrowed down to a
> small testing case that shows the problem without any change to GCC.
>
> [opc@qinzhao-ol8u3-x
Am Montag, dem 26.08.2024 um 19:30 + schrieb Qing Zhao:
> Hi, Martin,
>
> Looks like that there is some issue when I tried to use the _Generic for the
> testing cases, and then I narrowed down to a
> small testing case that shows the problem without any change to GCC.
>
> [opc@qinzhao-ol8u3-
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.
> >>
> >> Then the user could write the following cod
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);
> > >
> > > _
Hi, Martin,
Looks like that there is some issue when I tried to use the _Generic for the
testing cases, and then I narrowed down to a
small testing case that shows the problem without any change to GCC.
[opc@qinzhao-ol8u3-x86 gcc]$ cat t1.c
struct annotated {
char b;
int c[];
} *array_annota
> On Aug 21, 2024, at 18:08, Bill Wendling wrote:
>
>>>
>>> to test.
>>
>> For the unary operator __counted_by(PTR), “PTR” must have a counted_by
>> attribute, if not, there will be a compilation time error.
>>
>> Then the user could write the following code:
>>
>> If __builtin_has_att
> On Aug 21, 2024, at 17:54, Bill Wendling wrote:
>
>> if (__builtin_get_counted_by(p->array)) {
>>size_t max_value =
>> type_max(typeof(*__builtin_get_counted_by(p->array)));
>>if (count > type_max)
>>...fail cleanly...
>>*__builtin_get_counted_by(p->ar
Hi, Bill,
Thank you for the info.
> On Aug 21, 2024, at 17:36, Bill Wendling wrote:
>
>>
>> Bill, could you please provide a little bit more info on the possibility of
>> a new builtin __builtin_has_attribute() in CLANG?
>>
> From what I gathered, it would require some moderate surgery to
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:
> > > >
> > > > Am Mittwoch, dem 21.08.2024 um 16:34 +0200 schrieb
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 =
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
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
> 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 = __builtin_get_counted_by(__p->FAM);
>>>
>>> _Generic(ret
On Wed, Aug 21, 2024 at 05:43:42PM +0200, 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);
> >
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 + schrieb Qing Zhao:
> >>
> >>>
> >>> Yes, I do feel that the ap
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);
> >
> > _Generic(ret, void*: (void)0, default: *ret = COUNT);
>
> Is there an
> 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 + schrieb Qing Zhao:
>>
>>>
>>> Yes, I do feel that the approach __builtin_get_counted_by is not very good.
>>> Maybe it’s bette
> On Aug 21, 2024, at 10:34, Martin Uecker wrote:
>
> Am Mittwoch, dem 21.08.2024 um 14:12 + schrieb Qing Zhao:
>
> ...
>>
>>>
+ if (__builtin_get_counted_by (__p->FAM)) \
+ *(__builtin_get_counted_by(__p->FAM)) = COUNT; \
How to improve it? (Thanks a lot for your
Am Mittwoch, dem 21.08.2024 um 16:34 +0200 schrieb Martin Uecker:
> Am Mittwoch, dem 21.08.2024 um 14:12 + schrieb Qing Zhao:
>
> >
> > Yes, I do feel that the approach __builtin_get_counted_by is not very good.
> > Maybe it’s better to provide
> > A. __builtin_set_counted_by
> > or
> > B.
Am Mittwoch, dem 21.08.2024 um 14:12 + schrieb Qing Zhao:
...
>
> >
> > > + if (__builtin_get_counted_by (__p->FAM)) \
> > > + *(__builtin_get_counted_by(__p->FAM)) = COUNT; \
> > >
> > > How to improve it? (Thanks a lot for your suggestion).
> >
> > There's lack of syntactic guarantee t
(Resend since the previous one has no subject).
> On Aug 21, 2024, at 04:44, Richard Biener wrote:
>
> On Tue, Aug 20, 2024 at 3:41 PM 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:
Wi
On Tue, Aug 20, 2024 at 3:41 PM 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 b
> 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 found that would be very
>> nice to have for object allocators: b
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 found that would be very
> nice to have for object allocators: being able to set the counted_by
> counter variable without knowi
On Tue, Aug 13, 2024 at 03:33:26PM +, 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 found that would be very
> nice to have for object allocators: being able to set the counted_by
> counter variable withou
53 matches
Mail list logo