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

2023-11-03 Thread Qing Zhao
Yes, after today’s discussion, I think we agreed on 1. Passing the size field by reference to .ACCESS_WITH_SIZE as jakub suggested. 2. Then the compiler should be able to always use the latest value of size field for the reference to FAM. As a result, no need to add code for pointer

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

2023-11-03 Thread Qing Zhao
> On Nov 2, 2023, at 8:13 PM, Bill Wendling wrote: > > 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:

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

2023-11-03 Thread Qing Zhao
> On Nov 3, 2023, at 12:30 PM, Jakub Jelinek wrote: > > On Fri, Nov 03, 2023 at 04:20:57PM +, Qing Zhao wrote: >> So, based on the discussion so far, We will define the .ACCESS_WITH_SIZE as >> following: >> >> .ACCESS_WITH_SIZE (REF_TO_OBJ, REF_TO_SIZE, ACCESS_MODE) >> >> INTERNAL_FN

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

2023-11-03 Thread Jakub Jelinek
On Fri, Nov 03, 2023 at 04:20:57PM +, Qing Zhao wrote: > So, based on the discussion so far, We will define the .ACCESS_WITH_SIZE as > following: > > .ACCESS_WITH_SIZE (REF_TO_OBJ, REF_TO_SIZE, ACCESS_MODE) > > INTERNAL_FN (ACCESS_WITH_SIZE, ECF_LEAF | ECF_NOTHROW, NULL) > > which

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

2023-11-03 Thread Qing Zhao
So, based on the discussion so far, We will define the .ACCESS_WITH_SIZE as following: .ACCESS_WITH_SIZE (REF_TO_OBJ, REF_TO_SIZE, ACCESS_MODE) INTERNAL_FN (ACCESS_WITH_SIZE, ECF_LEAF | ECF_NOTHROW, NULL) which returns the “REF_TO_OBJ" same as the 1st argument; 1st argument “REF_TO_OBJ":

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

2023-11-03 Thread Qing Zhao
> On Nov 3, 2023, at 10:46 AM, Jakub Jelinek wrote: > > On Fri, Nov 03, 2023 at 02:32:04PM +, Qing Zhao wrote: >>> Why? It doesn't really matter. The options are >>> A. p is at [2] associated with and int type (or size of int >>> or whatever); .ACCESS_WITH_SIZE can't be pure, >> >>

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

2023-11-03 Thread Jakub Jelinek
On Fri, Nov 03, 2023 at 02:32:04PM +, Qing Zhao wrote: > > Why? It doesn't really matter. The options are > > A. p is at [2] associated with and int type (or size of int > > or whatever); .ACCESS_WITH_SIZE can't be pure, > > .ACCESS_WITH_SIZE will only load the size from its address, no

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

2023-11-03 Thread Qing Zhao
> On Nov 3, 2023, at 2:22 AM, Jakub Jelinek wrote: > > On Fri, Nov 03, 2023 at 07:07:36AM +0100, Martin Uecker wrote: >> Am Donnerstag, dem 02.11.2023 um 17:28 -0700 schrieb Bill Wendling: >>> On Thu, Nov 2, 2023 at 1:36 PM Qing Zhao wrote: Thanks a lot for raising these issues.

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

2023-11-03 Thread Martin Uecker
Am Freitag, dem 03.11.2023 um 07:22 +0100 schrieb Jakub Jelinek: > On Fri, Nov 03, 2023 at 07:07:36AM +0100, Martin Uecker wrote: > > Am Donnerstag, dem 02.11.2023 um 17:28 -0700 schrieb Bill Wendling: > > > On Thu, Nov 2, 2023 at 1:36 PM Qing Zhao wrote: > > > > > > > > Thanks a lot for raising

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

2023-11-03 Thread Jakub Jelinek
On Fri, Nov 03, 2023 at 07:07:36AM +0100, Martin Uecker wrote: > Am Donnerstag, dem 02.11.2023 um 17:28 -0700 schrieb 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

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

2023-11-03 Thread Martin Uecker
Am Donnerstag, dem 02.11.2023 um 17:28 -0700 schrieb 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

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

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

2023-11-02 Thread Qing Zhao
> On Nov 2, 2023, at 8:09 AM, Jakub Jelinek wrote: > > On Thu, Nov 02, 2023 at 12:52:50PM +0100, Richard Biener wrote: >>> What I meant is to emit >>> tmp_4 = .ACCESS_WITH_SIZE ([0], , (typeof ()) 0); >>> p_5 = _4[2]; >>> i.e. don't associate the pointer with a value of the size, but with >>>

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

2023-11-02 Thread Qing Zhao
> On Nov 2, 2023, at 7:52 AM, Richard Biener wrote: > > On Thu, Nov 2, 2023 at 11:40 AM Jakub Jelinek wrote: >> >> On Thu, Nov 02, 2023 at 11:18:09AM +0100, Richard Biener wrote: Or, if we want to pay further price, .ACCESS_WITH_SIZE could take as one of the arguments not the size

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

2023-11-02 Thread Qing Zhao
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 (a))) []; }; 2 struct S s; 3 s.a = 5; 4 char *p = [2];

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

2023-11-02 Thread Siddhesh Poyarekar
On 2023-11-02 10:12, Martin Uecker wrote: This shouldn't be necessary. The object-size pass can track pointer arithmeti if it comes after inserting the .ACCESS_WITH_SIZE. https://godbolt.org/z/fvc3aoPfd The problem is dependency tracking through the pointer arithmetic, which Jakub suggested

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

2023-11-02 Thread Qing Zhao
> On Nov 2, 2023, at 9:54 AM, Richard Biener wrote: > > On Thu, Nov 2, 2023 at 2:50 PM Qing Zhao wrote: >> >> >> >>> On Nov 2, 2023, at 3:57 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

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

2023-11-02 Thread Martin Uecker
Am Donnerstag, dem 02.11.2023 um 13:50 + schrieb Qing Zhao: > > > On Nov 2, 2023, at 3:57 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,

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

2023-11-02 Thread Richard Biener
On Thu, Nov 2, 2023 at 2:50 PM Qing Zhao wrote: > > > > > On Nov 2, 2023, at 3:57 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: > >>>

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

2023-11-02 Thread Qing Zhao
> On Nov 2, 2023, at 3:57 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

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

2023-11-02 Thread Jakub Jelinek
On Thu, Nov 02, 2023 at 12:52:50PM +0100, Richard Biener wrote: > > What I meant is to emit > > tmp_4 = .ACCESS_WITH_SIZE ([0], , (typeof ()) 0); > > p_5 = _4[2]; > > i.e. don't associate the pointer with a value of the size, but with > > an address where to find the size (plus how large it is),

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

2023-11-02 Thread Richard Biener
On Thu, Nov 2, 2023 at 11:40 AM Jakub Jelinek wrote: > > On Thu, Nov 02, 2023 at 11:18:09AM +0100, Richard Biener wrote: > > > Or, if we want to pay further price, .ACCESS_WITH_SIZE could take as one > > > of > > > the arguments not the size value, but its address. Then at __bdos time > > > we

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

2023-11-02 Thread Jakub Jelinek
On Thu, Nov 02, 2023 at 11:18:09AM +0100, Richard Biener wrote: > > Or, if we want to pay further price, .ACCESS_WITH_SIZE could take as one of > > the arguments not the size value, but its address. Then at __bdos time > > we would dereference that pointer to get the size. > > So, > > struct S {

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

2023-11-02 Thread Richard Biener
On Thu, Nov 2, 2023 at 9:27 AM Jakub Jelinek wrote: > > On Thu, Nov 02, 2023 at 08:57:36AM +0100, Richard Biener wrote: > > You probably want to specify that when a pointer to the array is taken the > > pointer has to be to the first array element (or do we want to mangle the > > 'size'

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

2023-11-02 Thread Jakub Jelinek
On Thu, Nov 02, 2023 at 08:57:36AM +0100, Richard Biener wrote: > You probably want to specify that when a pointer to the array is taken the > pointer has to be to the first array element (or do we want to mangle the > 'size' accordingly for the instrumentation?). You also want to specify that >

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

2023-11-02 Thread Richard Biener
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 "counted_by" > >> > >> For the following structure including a FAM with a

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

2023-11-01 Thread Qing Zhao
> On Nov 1, 2023, at 11:00 AM, Martin Uecker wrote: > > Am Mittwoch, dem 01.11.2023 um 14:47 + schrieb Qing Zhao: >> >>> 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

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

2023-11-01 Thread Martin Uecker
Am Mittwoch, dem 01.11.2023 um 14:47 + schrieb Qing Zhao: > > > 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 "counted_by" > > > > > > For the following structure

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

2023-11-01 Thread Qing Zhao
> 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 "counted_by" >> >> For the following structure including a FAM with a counted_by attribute: >> >> struct A >> { >> size_t size;

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

2023-10-31 Thread Joseph Myers
On Tue, 31 Oct 2023, Qing Zhao wrote: > 2.3 A new semantic requirement in the user documentation of "counted_by" > > For the following structure including a FAM with a counted_by attribute: > > struct A > { >size_t size; >char buf[] __attribute__((counted_by(size))); > }; > > for

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

2023-10-31 Thread Qing Zhao
> On Oct 31, 2023, at 1:35 PM, Siddhesh Poyarekar wrote: > > On 2023-10-31 12:26, Qing Zhao wrote: >> Hi, >> I wrote a summary based on our extensive discussion, hopefully this can be >> served as an informal proposal. >> Please take a look at it and let me know any comment or suggestion. >>

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

2023-10-31 Thread Siddhesh Poyarekar
On 2023-10-31 12:26, Qing Zhao wrote: Hi, I wrote a summary based on our extensive discussion, hopefully this can be served as an informal proposal. Please take a look at it and let me know any comment or suggestion. There are some (???) in the section 3.2 and 3.6, those are my questions