Hi, Richard,
> On Jun 5, 2024, at 13:58, Qing Zhao wrote:
>>
>>>>>>>>> Like this?
>>>>>>>>>
>>>>>>>>> diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h
>>>>>>>>
> On Jun 5, 2024, at 09:49, David Malcolm wrote:
>
> On Tue, 2024-06-04 at 22:09 +0000, Qing Zhao wrote:
>>
>>
>>> On Jun 4, 2024, at 17:55, David Malcolm
>>> wrote:
>>>
>>> On Fri, 2024-05-31 at 13:11 +, Qing Zhao wrote
> On Jun 5, 2024, at 13:07, Richard Biener wrote:
>
>
>
>> Am 05.06.2024 um 18:39 schrieb Qing Zhao :
>>
>>
>>
>>> On Jun 5, 2024, at 03:26, Richard Biener wrote:
>>>
>>>> On Tue, Jun 4, 2024 at 10:31 PM Qing Zhao wrote
> On Jun 5, 2024, at 03:26, Richard Biener wrote:
>
> On Tue, Jun 4, 2024 at 10:31 PM Qing Zhao wrote:
>>
>>
>>
>>> On Jun 4, 2024, at 03:43, Richard Biener wrote:
>>>
>>> On Mon, Jun 3, 2024 at 4:48 PM David Malcolm wrote:
>&g
> On Jun 4, 2024, at 17:55, David Malcolm wrote:
>
> On Fri, 2024-05-31 at 13:11 +0000, Qing Zhao wrote:
>>
>>
>>> On May 31, 2024, at 08:58, Richard Biener
>>> wrote:
>>>
>>> On Thu, 30 May 2024, Qing Zhao wrote:
>>>
>
> On Jun 4, 2024, at 03:43, Richard Biener wrote:
>
> On Mon, Jun 3, 2024 at 4:48 PM David Malcolm wrote:
>>
>> On Mon, 2024-06-03 at 08:29 +0200, Richard Biener wrote:
>>> On Fri, May 31, 2024 at 11:23 PM Qing Zhao
>>> wrote:
>>>>
&
> On Jun 3, 2024, at 02:29, Richard Biener wrote:
>
> On Fri, May 31, 2024 at 11:23 PM Qing Zhao wrote:
>>
>>
>>
>>> On May 23, 2024, at 07:46, Richard Biener
>>> wrote:
>>>
>>> On Wed, May 22, 2024 at 8:53 PM Qing Zhao wr
> 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
https://gcc.gnu.org/g:3d94fee616d6132075f3292a6eafdcb7b1d3f5a5
commit r15-947-g3d94fee616d6132075f3292a6eafdcb7b1d3f5a5
Author: Qing Zhao
Date: Tue May 28 18:37:14 2024 +
Use the .ACCESS_WITH_SIZE in bound sanitizer.
gcc/c-family/ChangeLog:
* c-ubsan.cc
https://gcc.gnu.org/g:4c5bea7def13613fba166edb23289bab446b0b48
commit r15-948-g4c5bea7def13613fba166edb23289bab446b0b48
Author: Qing Zhao
Date: Tue May 28 18:39:31 2024 +
Add the 6th argument to .ACCESS_WITH_SIZE
to carry the TYPE of the flexible array
https://gcc.gnu.org/g:6f17933548fc34ee269e90546a590df8269cee60
commit r15-946-g6f17933548fc34ee269e90546a590df8269cee60
Author: Qing Zhao
Date: Tue May 28 18:36:00 2024 +
Use the .ACCESS_WITH_SIZE in builtin object size.
gcc/ChangeLog:
* tree-object-size.cc
https://gcc.gnu.org/g:bb49b6e4f55891d0d8b596845118f40df6ae72a5
commit r15-945-gbb49b6e4f55891d0d8b596845118f40df6ae72a5
Author: Qing Zhao
Date: Tue May 28 18:34:09 2024 +
Convert references with "counted_by" attributes to/from .ACCESS_WITH_SIZE.
Including the
https://gcc.gnu.org/g:f824acd0e807546a733c122ab6340f18cef88766
commit r15-944-gf824acd0e807546a733c122ab6340f18cef88766
Author: Qing Zhao
Date: Tue May 28 18:30:05 2024 +
Provide counted_by attribute to flexible array member field
'counted_by (COUNT)'
The 'counted_by
> On May 31, 2024, at 08:58, Richard Biener wrote:
>
> On Thu, 30 May 2024, Qing Zhao wrote:
>
>> Including the following changes:
>> * The definition of the new internal function .ACCESS_WITH_SIZE
>> in internal-fn.def.
>> * C FE converts every r
> On May 30, 2024, at 15:43, Joseph Myers wrote:
>
> On Thu, 30 May 2024, Qing Zhao wrote:
>
>> In order to make this working, the routine digest_init in c-typeck.cc
>> is updated to fold calls to .ACCESS_WITH_SIZE to its first argument
>> when require_
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.
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.
*
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 10th version of the patch.
Which is rebased on the latest trunk.
Compare with the 9th version, all the difference are in patch #2, including
a small C FE change in the routine "digest_init". all others are middle-end
changes.
please review the changes for the patch #2:
updates
Richard and Joseph:
> On May 28, 2024, at 17:09, Qing Zhao wrote:
>
>>>
>>> diff --git a/gcc/varasm.cc b/gcc/varasm.cc
>>> index fa17eff551e8..d75b23668925 100644
>>> --- a/gcc/varasm.cc
>>> +++ b/gcc/varasm.cc
>>> @@ -5082,6
> On May 29, 2024, at 02:57, Richard Biener wrote:
>
> On Tue, May 28, 2024 at 11:09 PM Qing Zhao wrote:
>>
>> Thank you for the comments. See my answers below:
>>
>> Joseph, please see the last question, I need your help on it. Thanks a lot
>> for
> On May 28, 2024, at 03:43, Richard Biener wrote:
>
> On Fri, Apr 12, 2024 at 3:55 PM Qing Zhao wrote:
>>
>> to carry the TYPE of the flexible array.
>>
>> Such information is needed during tree-object-size.cc.
>>
>> We cannot use th
> On May 28, 2024, at 03:39, Richard Biener wrote:
>
> On Fri, Apr 12, 2024 at 3:54 PM Qing Zhao wrote:
>>
>
> I have no comments here, if Siddesh is OK with this I approve.
thanks.
Qing
>
>> gcc/ChangeLog:
>>
>>* tree-object-size.cc (a
Thank you for the comments. See my answers below:
Joseph, please see the last question, I need your help on it. Thanks a lot for
the help.
Qing
> On May 28, 2024, at 03:38, Richard Biener wrote:
>
> On Fri, Apr 12, 2024 at 3:54 PM Qing Zhao wrote:
>>
>> Including
> 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
https://gcc.gnu.org/g:6634a409124a884ff66b3756568a7daae7d3c295
commit r15-211-g6634a409124a884ff66b3756568a7daae7d3c295
Author: Qing Zhao
Date: Mon May 6 16:28:01 2024 +
Update the C FE routine "add_flexible_array_elts_to_size" C++ FE routine
"layout_var_decl"
https://gcc.gnu.org/g:93f6a47583f3fa8a1b66856ecb19ec28f26b2ba4
commit r15-210-g93f6a47583f3fa8a1b66856ecb19ec28f26b2ba4
Author: Qing Zhao
Date: Mon May 6 16:27:09 2024 +
Add testing cases for flexible array members in unions and alone in
structures.
PR c/53548
gcc
https://gcc.gnu.org/g:f27fc59d9f7c735d200fda647a487850144b10eb
commit r15-209-gf27fc59d9f7c735d200fda647a487850144b10eb
Author: Qing Zhao
Date: Mon May 6 16:26:19 2024 +
C and C++ FE changes to support flexible array members in unions and alone
in structures. Adjust testcases
https://gcc.gnu.org/g:adb1c8a0f167c3a1f7593d75f5a10eb07a5d741a
commit r15-208-gadb1c8a0f167c3a1f7593d75f5a10eb07a5d741a
Author: Qing Zhao
Date: Mon May 6 16:25:04 2024 +
Allow flexible array members in unions and alone in structures [PR53548]
The request for GCC to accept
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
1 - 100 of 1232 matches
Mail list logo