> On May 23, 2024, at 10:13, David Malcolm wrote:
>
> On Thu, 2024-05-23 at 14:03 +0000, Qing Zhao wrote:
>
> [...snip...]
>
>> Is “location_adhoc_data” an available data structure in current GCC?
>> I just searched GCC source tree, cannot find it.
>
>
> On May 23, 2024, at 07:46, Richard Biener wrote:
>
> On Wed, May 22, 2024 at 8:53 PM Qing Zhao wrote:
>>
>>
>>
>>> On May 22, 2024, at 03:38, Richard Biener
>>> wrote:
>>>
>>> On Tue, May 21, 2024 at 11:36 PM David Mal
> On May 22, 2024, at 03:38, Richard Biener wrote:
>
> On Tue, May 21, 2024 at 11:36 PM David Malcolm wrote:
>>
>> On Tue, 2024-05-21 at 15:13 +, Qing Zhao wrote:
>>> Thanks for the comments and suggestions.
>>>
>>>> O
Thanks for the comments and suggestions.
> On May 15, 2024, at 10:00, David Malcolm wrote:
>
> On Tue, 2024-05-14 at 15:08 +0200, Richard Biener wrote:
>> On Mon, 13 May 2024, Qing Zhao wrote:
>>
>>> -Warray-bounds is an important option to enable linux kernal
024, at 10:14, Qing Zhao wrote:
>
>
>
>> On May 7, 2024, at 10:02, Qing Zhao wrote:
>>
>> 2nd Ping for the middle-end change approval. -:)
>>
>> **Approval status:
>>
>> All C FE changes have been approved.
>>
>> **Revi
> On May 15, 2024, at 02:09, Richard Biener wrote:
>
> On Tue, 14 May 2024, Qing Zhao wrote:
>
>>
>>
>>> On May 14, 2024, at 13:14, Richard Biener wrote:
>>>
>>> On Tue, 14 May 2024, Qing Zhao wrote:
>>>
>&g
> On May 14, 2024, at 13:14, Richard Biener wrote:
>
> On Tue, 14 May 2024, Qing Zhao wrote:
>
>>
>>
>>> On May 14, 2024, at 10:29, Richard Biener wrote:
>>>
> [...]
>>> It would of course
>>> need experimenting since we c
> On May 14, 2024, at 11:08, Jeff Law wrote:
>
>
>
> On 5/14/24 8:57 AM, Qing Zhao wrote:
>>> On May 13, 2024, at 20:14, Kees Cook wrote:
>>>
>>> On Tue, May 14, 2024 at 01:38:49AM +0200, Andrew Pinski wrote:
>>>> On Mon, May 13, 2024,
> On May 14, 2024, at 10:29, Richard Biener wrote:
>
> On Tue, 14 May 2024, Qing Zhao wrote:
>
>>
>>
>>> On May 14, 2024, at 09:08, Richard Biener wrote:
>>>
>>> On Mon, 13 May 2024, Qing Zhao wrote:
>>>
>>>&
> On May 13, 2024, at 20:14, Kees Cook wrote:
>
> On Tue, May 14, 2024 at 01:38:49AM +0200, Andrew Pinski wrote:
>> On Mon, May 13, 2024, 11:41 PM Kees Cook wrote:
>>> But it makes no sense to warn about:
>>>
>>> void sparx5_set (int * ptr, struct nums * sg, int index)
>>> {
>>> if (index
> On May 14, 2024, at 09:08, Richard Biener wrote:
>
> On Mon, 13 May 2024, Qing Zhao wrote:
>
>> -Warray-bounds is an important option to enable linux kernal to keep
>> the array out-of-bound errors out of the source tree.
>>
>> However, due to
-Warray-bounds is an important option to enable linux kernal to keep
the array out-of-bound errors out of the source tree.
However, due to the false positive warnings reported in PR109071
(-Warray-bounds false positive warnings due to code duplication from
jump threading), -Warray-bounds=1 cannot
> On May 7, 2024, at 17:52, Kees Cook wrote:
>
> On Tue, May 07, 2024 at 06:34:19PM +0000, Qing Zhao wrote:
>> On May 7, 2024, at 13:57, Sebastian Huber
>> wrote:
>>> On 07.05.24 16:26, Qing Zhao wrote:
>>>> Hi, Sebastian,
>>>> Than
(Resend since my previous email in HTML and inline quoting wasn’t work, I
changed the mail setting, hopefully this time it’s good). Sorry for the
inconvenience.
> On May 7, 2024, at 13:57, Sebastian Huber
> wrote:
>
> On 07.05.24 16:26, Qing Zhao wrote:
>> Hi, Sebastian,
On May 7, 2024, at 13:57, Sebastian Huber
wrote:
On 07.05.24 16:26, Qing Zhao wrote:
Hi, Sebastian,
Thanks for your explanation.
Our goal is to deprecate the GCC extension on structure containing a flexible
array member not at the end of another structure. In order to achieve this
goal, we
wrote:
>
> On 06.05.24 16:20, Qing Zhao wrote:
>> Hi, Sebastian,
>> Looks like that the behavior you described is correct.
>> What’s your major concern? ( a little confused).
>
> I am concerned that the static initialization of structures with flexible
> array members no
On May 7, 2024, at 10:02, Qing Zhao wrote:
2nd Ping for the middle-end change approval. -:)
**Approval status:
All C FE changes have been approved.
**Review status:
All Middle-end changes have been reviewed by Sid, no remaining issue.
Okay for GCC15?
For convenience
2nd Ping for the middle-end change approval. -:)
**Approval status:
All C FE changes have been approved.
**Review status:
All Middle-end changes have been reviewed by Sid, no remaining issue.
Okay for GCC15?
thanks.
Qing
Begin forwarded message:
From: Qing Zhao
Subject: Re
Hi, Sebastian,
Looks like that the behavior you described is correct.
What’s your major concern? ( a little confused).
Qing
On May 6, 2024, at 09:29, Sebastian Huber
wrote:
On 06.05.24 09:08, Richard Biener wrote:
On Sat, 4 May 2024, Sebastian Huber wrote:
On 07.08.23 16:22, Qing Zhao via
"add_flexible_array_elts_to_size" C++ FE routine "layout_var_decl" to handle
the cases when the DECL is union.
Add testing cases to test the _bos for flexible array members in unions
or alone in structures.
gcc/c/ChangeLog:
* c-decl.cc (add_flexible_array_elts_to_size): Handle the
gcc/testsuite/ChangeLog:
* c-c++-common/fam-in-union-alone-in-struct-1.c: New testcase.
* c-c++-common/fam-in-union-alone-in-struct-2.c: New testcase.
* c-c++-common/fam-in-union-alone-in-struct-3.c: New testcase.
---
.../fam-in-union-alone-in-struct-1.c | 52
to support flexible array members
in unions and alone in structures. Adjust testcases for flexible array member
in union and alone in structure extension.
gcc/c/ChangeLog:
* c-decl.cc (finish_struct): Change errors to pedwarns for the cases
flexible array members in union or
The request for GCC to accept that the C99 flexible array member can be
in a union or alone in a structure has been made a long time ago around 2012
for supporting several practical cases including glibc.
A GCC PR has been opened for such request at that time:
Hi,
This is the 5th version for
Allow flexible array members in unions and alone in structures [PR53548]
(for your reference, the 1st version is at:
https://gcc.gnu.org/pipermail/gcc-patches/2024-April/649737.html
The 2nd version is at:
On May 1, 2024, at 09:35, Jason Merrill wrote:
On 5/1/24 08:19, Qing Zhao wrote:
"add_flexible_array_elts_to_size" and "layout_var_decl" to handle
the cases when the DECL is union.
Add testing cases to test the _bos for flexible array members in unions
or alone
to support flexible array members
in unions and alone in structures. Adjust testcases for flexible array member
in union and alone in structure extension.
gcc/c/ChangeLog:
* c-decl.cc (finish_struct): Change errors to pedwarns for the cases
flexible array members in union or
"add_flexible_array_elts_to_size" and "layout_var_decl" to handle
the cases when the DECL is union.
Add testing cases to test the _bos for flexible array members in unions
or alone in structures.
gcc/c/ChangeLog:
* c-decl.cc (add_flexible_array_elts_to_size): Handle the cases
gcc/testsuite/ChangeLog:
* c-c++-common/fam-in-union-alone-in-struct-1.c: New testcase.
* c-c++-common/fam-in-union-alone-in-struct-2.c: New testcase.
* c-c++-common/fam-in-union-alone-in-struct-3.c: New testcase.
---
.../fam-in-union-alone-in-struct-1.c | 52
The request for GCC to accept that the C99 flexible array member can be
in a union or alone in a structure has been made a long time ago around 2012
for supporting several practical cases including glibc.
A GCC PR has been opened for such request at that time:
Hi,
This is the 4th version for
Allow flexible array members in unions and alone in structures [PR53548]
(for your reference, the 1st version is at:
https://gcc.gnu.org/pipermail/gcc-patches/2024-April/649737.html
The 2nd version is at:
On Apr 30, 2024, at 17:55, Kees Cook wrote:
On Tue, Apr 30, 2024 at 05:51:20PM -0400, Jason Merrill wrote:
On 4/30/24 14:45, Qing Zhao wrote:
On Apr 30, 2024, at 15:27, Jason Merrill wrote:
On 4/30/24 07:58, Qing Zhao wrote:
The request for GCC to accept that the C99 flexible array member
> On Apr 30, 2024, at 15:52, Jason Merrill wrote:
>
> On 4/30/24 14:49, Qing Zhao wrote:
>>> On Apr 30, 2024, at 15:45, Qing Zhao wrote:
>>>
>>>
>>>
>>>>> gcc/doc/extend.texi | 34 ++
>&g
On Apr 30, 2024, at 15:45, Qing Zhao wrote:
gcc/doc/extend.texi | 34 ++
1 file changed, 34 insertions(+)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 7b54a241a7bf..cba98c8aadd7 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
On Apr 30, 2024, at 15:27, Jason Merrill wrote:
On 4/30/24 07:58, Qing Zhao wrote:
The request for GCC to accept that the C99 flexible array member can be
in a union or alone in a structure has been made a long time ago around 2012
for supporting several practical cases including glibc.
A GCC
On Apr 30, 2024, at 15:29, Jason Merrill wrote:
On 4/30/24 07:58, Qing Zhao wrote:
Add testing cases to test the _bos for flexible array members in unions
or alone in structures.
gcc/c/ChangeLog:
* c-decl.cc (add_flexible_array_elts_to_size): Handle the cases
when the DECL is union.
gcc/cp
Add testing cases to test the _bos for flexible array members in unions
or alone in structures.
gcc/c/ChangeLog:
* c-decl.cc (add_flexible_array_elts_to_size): Handle the cases
when the DECL is union.
gcc/cp/ChangeLog:
* decl.cc (layout_var_decl): Handle the cases when
gcc/testsuite/ChangeLog:
* c-c++-common/fam-in-union-alone-in-struct-1.c: New testcase.
* c-c++-common/fam-in-union-alone-in-struct-2.c: New testcase.
* c-c++-common/fam-in-union-alone-in-struct-3.c: New testcase.
---
.../fam-in-union-alone-in-struct-1.c | 52
to support flexible array members
in unions and alone in structures. Adjust testcases for flexible array member
in union and alone in structure extension.
gcc/c/ChangeLog:
* c-decl.cc (finish_struct): Change errors to pedwarns for the cases
flexible array members in union or
Hi,
This is the 3rd version for
Allow flexible array members in unions and alone in structures [PR53548]
(for your reference, the 1st version is at:
https://gcc.gnu.org/pipermail/gcc-patches/2024-April/649737.html
The 2nd version is at:
The request for GCC to accept that the C99 flexible array member can be
in a union or alone in a structure has been made a long time ago around 2012
for supporting several practical cases including glibc.
A GCC PR has been opened for such request at that time:
> On Apr 25, 2024, at 10:13, Siddhesh Poyarekar wrote:
>
> On 2024-04-25 10:06, Qing Zhao wrote:
>> gcc/testsuite/ChangeLog:
>> * c-c++-common/fam-in-union-alone-in-struct-1.c: New testcase.
>> * c-c++-common/fam-in-union-alone-in-struct-2.c: New testcase.
gcc/testsuite/ChangeLog:
* c-c++-common/fam-in-union-alone-in-struct-1.c: New testcase.
* c-c++-common/fam-in-union-alone-in-struct-2.c: New testcase.
* c-c++-common/fam-in-union-alone-in-struct-3.c: New testcase.
---
.../fam-in-union-alone-in-struct-1.c | 52
Hi,
This is the 2nd version for
Allow flexible array members in unions and alone in structures [PR53548]
(for your reference, the 1st version is at:
https://gcc.gnu.org/pipermail/gcc-patches/2024-April/649737.html)
compared to the 1st version, the major difference are:
A. C FE updates based
to support flexible array members in unions and alone in structures.
Adjust testcases for flexible array member
in union and alone in structure extension.
gcc/c/ChangeLog:
* c-decl.cc (finish_struct): Change errors to pedwarns for the cases
flexible array members in union or
The request for GCC to accept that the C99 flexible array member can be
in a union or alone in a structure has been made a long time ago around 2012
for supporting several practical cases including glibc.
A GCC PR has been opened for such request at that time:
> On Apr 23, 2024, at 15:51, Joseph Myers wrote:
>
> On Fri, 19 Apr 2024, Qing Zhao wrote:
>
>> gcc/c/ChangeLog:
>>
>> * c-decl.cc (finish_struct): Change errors to pedwarns for the cases
>> flexible array members in union or alone in stru
024, at 09:54, Qing Zhao wrote:
>
> Hi,
>
> This is the 9th version of the patch.
>
> Compare with the 8th version, the difference are:
>
> updates per Joseph's comments:
>
> 1. in C FE, add checking for counted_by attribute for the new multiple
> definitions of
> On Apr 23, 2024, at 14:53, Joseph Myers wrote:
>
> On Fri, 19 Apr 2024, Qing Zhao wrote:
>
>> gcc/testsuite/ChangeLog:
>>
>> * gcc.dg/flex-array-in-union-1.c: New test.
>> * gcc.dg/flex-array-in-union-2.c: New test.
>
> Th
> On Apr 23, 2024, at 15:03, Joseph Myers wrote:
>
> On Tue, 23 Apr 2024, Qing Zhao wrote:
>
>> However, I am not very confident on the wording of the doc, is the
>> current wording good enough for this? Or do you have any suggestion on
>> how to make it
> On Apr 23, 2024, at 14:04, Joseph Myers wrote:
>
> On Fri, 19 Apr 2024, Qing Zhao wrote:
>
>> +The size of the union is as if the flexiable array member were omitted
>> +except that it may have more trailing padding than the omission would imply.
>
> "
Thanks a lot.
Qing
> On Apr 22, 2024, at 16:38, Joseph Myers wrote:
>
> This version of patch 1/5 is OK for GCC 15.
>
> --
> Joseph S. Myers
> josmy...@redhat.com
>
> On Apr 19, 2024, at 16:54, Tom Tromey wrote:
>
>>>>>> Qing Zhao writes:
>
>> +The size of the union is as if the flexiable array member were omitted
>> +except that it may have more trailing padding than the omission would imply.
>> +
>>
gcc/testsuite/ChangeLog:
* c-c++-common/builtin-clear-padding-3.c: Adjust testcase.
* g++.dg/ext/flexary12.C: Likewise.
* g++.dg/ext/flexary19.C: Likewise.
* g++.dg/ext/flexary2.C: Likewise.
* g++.dg/ext/flexary3.C: Likewise.
*
gcc/testsuite/ChangeLog:
* gcc.dg/flex-array-in-union-1.c: New test.
* gcc.dg/flex-array-in-union-2.c: New test.
---
gcc/testsuite/gcc.dg/flex-array-in-union-1.c | 37 +
gcc/testsuite/gcc.dg/flex-array-in-union-2.c | 42
2 files changed, 79
for allow flexible array members in unions and alone in structures [PR53548]
The request for GCC to accept that the C99 flexible array member can be
in a union or alone in a structure has been made a long time ago around 2012
for supporting several practical cases including glibc.
A GCC PR has
gcc/c/ChangeLog:
* c-decl.cc (finish_struct): Change errors to pedwarns for the cases
flexible array members in union or alone in structures.
gcc/cp/ChangeLog:
* class.cc (diagnose_flexarrays): Change error to pdewarn for the case
flexible array members alone in
Hi,
The request for GCC to accept that the C99 flexible array member can be
in a union or alone in a struct has been made a long time ago around 2012
for supporting several practical cases including glibc.
A GCC PR has been opened for such request at that time:
gcc/c-family/ChangeLog:
* c-ubsan.cc (get_bound_from_access_with_size): New function.
(ubsan_instrument_bounds): Handle call to .ACCESS_WITH_SIZE.
gcc/testsuite/ChangeLog:
* gcc.dg/ubsan/flex-array-counted-by-bounds-2.c: New test.
*
gcc/ChangeLog:
* tree-object-size.cc (access_with_size_object_size): New function.
(call_object_size): Call the new function.
gcc/testsuite/ChangeLog:
* gcc.dg/builtin-object-size-common.h: Add a new macro EXPECT.
* gcc.dg/flex-array-counted-by-3.c: New test.
to carry the TYPE of the flexible array.
Such information is needed during tree-object-size.cc.
We cannot use the result type or the type of the 1st argument
of the routine .ACCESS_WITH_SIZE to decide the element type
of the original array due to possible type casting in the
source code.
Including the following changes:
* The definition of the new internal function .ACCESS_WITH_SIZE
in internal-fn.def.
* C FE converts every reference to a FAM with a "counted_by" attribute
to a call to the internal function .ACCESS_WITH_SIZE.
(build_component_ref in c_typeck.cc)
This
'counted_by (COUNT)'
The 'counted_by' attribute may be attached to the C99 flexible
array member of a structure. It indicates that the number of the
elements of the array is given by the field "COUNT" in the
same structure as the flexible array member.
GCC may use this
Hi,
This is the 9th version of the patch.
Compare with the 8th version, the difference are:
updates per Joseph's comments:
1. in C FE, add checking for counted_by attribute for the new multiple
definitions of the same tag for C23 in the routine
"tagged_types_tu_compatible_p".
Add a new
Sid and Richard,
The C FE changes in this patch has been approved by Joseph.
Could you please review the Middle-end change?
thanks.
Qing
> On Apr 10, 2024, at 14:36, Joseph Myers wrote:
>
> On Fri, 29 Mar 2024, Qing Zhao wrote:
>
>> +/* For a SUBDATUM field of a struct
Sid,
Thanks a lot for your review.
Richard,
Could you please comment on this patch? Is the middle-end part Okay for stage 1?
Thanks.
Qing
On Apr 10, 2024, at 17:48, Siddhesh Poyarekar wrote:
On 2024-03-29 12:07, Qing Zhao wrote:
to carry the TYPE of the flexible array.
Such information
Sid,
Thanks a lot for the review.
> On Apr 10, 2024, at 17:46, Siddhesh Poyarekar wrote:
>
> On 2024-03-29 12:07, Qing Zhao wrote:
>> gcc/c-family/ChangeLog:
>> * c-ubsan.cc (get_bound_from_access_with_size): New function.
>> (ubsan_inst
Sid,
Thanks a lot for your review!
> On Apr 10, 2024, at 17:45, Siddhesh Poyarekar wrote:
>
> On 2024-03-29 12:07, Qing Zhao wrote:
>> gcc/ChangeLog:
>> * tree-object-size.cc (access_with_size_object_size): New function.
>> (call_object_size): Call the new
> On Apr 10, 2024, at 17:56, Joseph Myers wrote:
>
> On Wed, 10 Apr 2024, Qing Zhao wrote:
>
>> Okay, the above is very clear, thanks a lot for the explanation.
>> So, basically, for “counted-by” attribute:
>> **The following is good:
>> struc
> On Apr 11, 2024, at 02:02, Martin Uecker wrote:
>
> Am Mittwoch, dem 10.04.2024 um 19:35 + schrieb Qing Zhao:
>>
>>> On Apr 10, 2024, at 15:05, Martin Uecker wrote:
>>>
>>> Am Mittwoch, dem 10.04.2024 um 20:25 +0200 schrieb Martin Uecker:
Thanks a lot for your review.
Will fix these typos before committing to GCC15.
Qing
> On Apr 10, 2024, at 14:36, Joseph Myers wrote:
>
> On Fri, 29 Mar 2024, Qing Zhao wrote:
>
>> +/* For a SUBDATUM field of a structure or union DATUM, generate a REF to
>> + the ob
> On Apr 10, 2024, at 15:05, Martin Uecker wrote:
>
> Am Mittwoch, dem 10.04.2024 um 20:25 +0200 schrieb Martin Uecker:
>> Am Mittwoch, dem 10.04.2024 um 17:35 + schrieb Joseph Myers:
>>> On Fri, 29 Mar 2024, Qing Zhao wrote:
>>>
>>>> + /* Iss
> On Apr 10, 2024, at 14:44, Joseph Myers wrote:
>
> On Wed, 10 Apr 2024, Qing Zhao wrote:
>
>> A stupid question first, the same scope means the same file? (Or same
>> function)
>
> struct X { int a; };
> struct X { int a; };
>
> is an example of t
Thanks for the comments.
> On Apr 10, 2024, at 13:35, Joseph Myers wrote:
>
> On Fri, 29 Mar 2024, Qing Zhao wrote:
>
>> + /* Issue error when there is a counted_by attribute with a different
>> + field as the argument for the same flexible array member field.
On Apr 2, 2024, at 03:06, Richard Biener wrote:
On Mon, Apr 1, 2024 at 3:36 PM Qing Zhao
mailto:qing.z...@oracle.com>> wrote:
This is a bug in tree-ssa-math-opts.c, when applying the widening mul
optimization, the compiler needs to check whether the operand is in a
ABNORMAL PHI, if Y
This is a bug in tree-ssa-math-opts.c, when applying the widening mul
optimization, the compiler needs to check whether the operand is in a
ABNORMAL PHI, if YES, we should avoid the transformation.
PR tree-optimization/111407
gcc/ChangeLog:
* tree-ssa-math-opts.c
This is a bug in tree-ssa-math-opts.c, when applying the widening mul
optimization, the compiler needs to check whether the operand is in a
ABNORMAL PHI, if YES, we should avoid the transformation.
PR tree-optimization/111407
gcc/ChangeLog:
* tree-ssa-math-opts.c
This is a bug in tree-ssa-math-opts.cc, when applying the widening mul
optimization, the compiler needs to check whether the operand is in a
ABNORMAL PHI, if YES, we should avoid the transformation.
PR tree-optimization/111407
gcc/ChangeLog:
* tree-ssa-math-opts.cc
This is a bug in tree-ssa-math-opts.cc, when applying the widening mul
optimization, the compiler needs to check whether the operand is in a
ABNORMAL PHI, if YES, we should avoid the transformation.
PR tree-optimization/111407
gcc/ChangeLog:
* tree-ssa-math-opts.cc
bound sanitizer and dynamic object size, etc.
So, let’s delay the possible support to gdb in a later patch.
Does this sound reasonable to you?
Qing
> On Mar 29, 2024, at 15:16, Kees Cook wrote:
>
> On Fri, Mar 29, 2024 at 12:09:15PM -0600, Tom Tromey wrote:
>>>>
gcc/c-family/ChangeLog:
* c-ubsan.cc (get_bound_from_access_with_size): New function.
(ubsan_instrument_bounds): Handle call to .ACCESS_WITH_SIZE.
gcc/testsuite/ChangeLog:
* gcc.dg/ubsan/flex-array-counted-by-bounds-2.c: New test.
*
gcc/ChangeLog:
* tree-object-size.cc (access_with_size_object_size): New function.
(call_object_size): Call the new function.
gcc/testsuite/ChangeLog:
* gcc.dg/builtin-object-size-common.h: Add a new macro EXPECT.
* gcc.dg/flex-array-counted-by-3.c: New test.
Including the following changes:
* The definition of the new internal function .ACCESS_WITH_SIZE
in internal-fn.def.
* C FE converts every reference to a FAM with a "counted_by" attribute
to a call to the internal function .ACCESS_WITH_SIZE.
(build_component_ref in c_typeck.cc)
This
to carry the TYPE of the flexible array.
Such information is needed during tree-object-size.cc.
We cannot use the result type or the type of the 1st argument
of the routine .ACCESS_WITH_SIZE to decide the element type
of the original array due to possible type casting in the
source code.
Hi,
This is the 8th version of the patch.
compare with the 7th version, the difference are:
updates per Joseph's comments:
1. Wording changes in diagnostics;
"non flexible" to "non-flexible";
Diagnostics starts with a lowercase letter;
2. Documentation changes:
"named ``@var{count}''
'counted_by (COUNT)'
The 'counted_by' attribute may be attached to the C99 flexible
array member of a structure. It indicates that the number of the
elements of the array is given by the field "COUNT" in the
same structure as the flexible array member.
GCC may use this
> On Mar 26, 2024, at 13:20, Joseph Myers wrote:
>
> On Tue, 26 Mar 2024, Qing Zhao wrote:
>
>>> What happens when there are multiple counted_by attributes on the same
>>> field? As far as I can see, all but one end up being ignored (by the code
>&g
> On Mar 26, 2024, at 11:21, Joseph Myers wrote:
>
> On Tue, 26 Mar 2024, Qing Zhao wrote:
>
>>>> +@cindex @code{counted_by} variable attribute
>>>> +@item counted_by (@var{count})
>>>> +The @code{counted_by} attribute may be attached to th
Thanks, will update.
Qing
> On Mar 25, 2024, at 16:50, Joseph Myers wrote:
>
> On Wed, 20 Mar 2024, Qing Zhao wrote:
>
>> + the size of the element can be retrived from the result type of the call,
>> + which is the pointer to the array type. */
>
> On Mar 25, 2024, at 16:48, Joseph Myers wrote:
>
> On Wed, 20 Mar 2024, Qing Zhao wrote:
>
>> + /* get the TYPE of the counted_by field. */
>
> Start comments with an uppercase letter.
Okay.
>
>> + The type of the first argument o
Hi, Joseph,
Thanks a lot for the reviews.
> On Mar 25, 2024, at 16:44, Joseph Myers wrote:
>
> On Wed, 20 Mar 2024, Qing Zhao wrote:
>
>> + /* This attribute only applies to a C99 flexible array member type. */
>> + else if (! c_flexible_array_member
gcc/c-family/ChangeLog:
* c-ubsan.cc (get_bound_from_access_with_size): New function.
(ubsan_instrument_bounds): Handle call to .ACCESS_WITH_SIZE.
gcc/testsuite/ChangeLog:
* gcc.dg/ubsan/flex-array-counted-by-bounds-2.c: New test.
*
to carry the TYPE of the flexible array.
Such information is needed during tree-object-size.cc.
We cannot use the result type or the type of the 1st argument
of the routine .ACCESS_WITH_SIZE to decide the element type
of the original array due to possible type casting in the
source code.
gcc/ChangeLog:
* tree-object-size.cc (access_with_size_object_size): New function.
(call_object_size): Call the new function.
gcc/testsuite/ChangeLog:
* gcc.dg/builtin-object-size-common.h: Add a new macro EXPECT.
* gcc.dg/flex-array-counted-by-3.c: New test.
Including the following changes:
* The definition of the new internal function .ACCESS_WITH_SIZE
in internal-fn.def.
* C FE converts every reference to a FAM with a "counted_by" attribute
to a call to the internal function .ACCESS_WITH_SIZE.
(build_component_ref in c_typeck.cc)
This
'counted_by (COUNT)'
The 'counted_by' attribute may be attached to the C99 flexible
array member of a structure. It indicates that the number of the
elements of the array is given by the field named "COUNT" in the
same structure as the flexible array member.
GCC may use
Hi,
This is the 7th version of the patch.
compare with the 6th version, the difference are:
updates per Siddhesh's comments:
1. update the error messages in "handle_counted_by_attribute"
then update the testing case accordingly;
2. update the error messages in "verify_counted_by_attribute"
On Mar 19, 2024, at 09:46, Jakub Jelinek wrote:
On Tue, Mar 19, 2024 at 01:14:51PM +, Qing Zhao wrote:
Currently, the OST_DYNAMIC information is not passed to
early_object_sizes phase. Pass this information to it, and adjust the code
and testing case accordingly.
Can you explain why do
Currently, the OST_DYNAMIC information is not passed to
early_object_sizes phase. Pass this information to it, and adjust the code
and testing case accordingly.
bootstrapped and regress tested on both x86 and aarch64. no issue.
Okay for trunk?
thanks.
Qing
gcc/ChangeLog:
*
> On Mar 18, 2024, at 12:30, Siddhesh Poyarekar wrote:
>
> On 2024-03-18 12:28, Qing Zhao wrote:
>>>> This should probably bail out if object_size_type & OST_DYNAMIC == 0.
>>> Okay. Will add this.
>> When add this into access_with
On Mar 13, 2024, at 15:17, Qing Zhao wrote:
On Mar 11, 2024, at 13:11, Siddhesh Poyarekar wrote:
On 2024-02-16 14:47, Qing Zhao wrote:
gcc/ChangeLog:
* tree-object-size.cc (access_with_size_object_size): New function.
(call_object_size): Call the new function.
gcc/testsuite/ChangeLog
1 - 100 of 1169 matches
Mail list logo