Re: [V1][PATCH 0/3] New attribute "element_count" to annotate bounds for C99 FAM(PR108896)

2023-08-02 Thread Qing Zhao via Gcc-patches
> On Aug 1, 2023, at 6:45 PM, Kees Cook wrote: > > On Mon, Jul 31, 2023 at 08:14:42PM +0000, Qing Zhao wrote: >> /* In general, Due to type casting, the type for the pointee of a pointer >> does not say anything about the object it points to, >> So, __builtin_o

Re: [V1][PATCH 0/3] New attribute "element_count" to annotate bounds for C99 FAM(PR108896)

2023-08-02 Thread Qing Zhao via Gcc-patches
> On Aug 2, 2023, at 2:25 AM, Martin Uecker wrote: > > Am Dienstag, dem 01.08.2023 um 15:45 -0700 schrieb Kees Cook: >> On Mon, Jul 31, 2023 at 08:14:42PM +, Qing Zhao wrote: >>> /* In general, Due to type casting, the type for the pointee of a pointer >>&

Re: One question on the source code of tree-object-size.cc

2023-08-02 Thread Qing Zhao via Gcc-patches
in_dynamic_object_size(q, 3) == 0 ok: __builtin_dynamic_object_size(q, 2) == 0 [opc@qinzhao-ol8u3-x86 108896]$ > On Aug 1, 2023, at 6:57 PM, Kees Cook wrote: > > On Tue, Aug 01, 2023 at 09:35:30PM +, Qing Zhao wrote: >> >> >>> On Jul 31, 2023, at 1:07 PM, S

Re: One question on the source code of tree-object-size.cc

2023-08-01 Thread Qing Zhao via Gcc-patches
> On Jul 31, 2023, at 1:07 PM, Siddhesh Poyarekar wrote: > > On 2023-07-31 13:03, Siddhesh Poyarekar wrote: >> On 2023-07-31 12:47, Qing Zhao wrote: >>> Hi, Sid and Jakub, >>> >>> I have a question in the following source portion of the routine

Re: [V1][PATCH 0/3] New attribute "element_count" to annotate bounds for C99 FAM(PR108896)

2023-07-31 Thread Qing Zhao via Gcc-patches
, -1); expect(__builtin_dynamic_object_size(p, 0), -1); expect(__builtin_dynamic_object_size(p, 3), 0); expect(__builtin_dynamic_object_size(p, 2), 0); return 0; } > On Jul 19, 2023, at 2:52 PM, Qing Zhao via Gcc-patches > wrote: > > >>> >>> T

Re: One question on the source code of tree-object-size.cc

2023-07-31 Thread Qing Zhao via Gcc-patches
> On Jul 31, 2023, at 2:23 PM, Siddhesh Poyarekar wrote: > > On 2023-07-31 14:13, Qing Zhao wrote: >> Okay. I see. >> Then if the size info from the TYPE is smaller than the size info from the >> malloc, >> then based on the current code, we use the small

Re: One question on the source code of tree-object-size.cc

2023-07-31 Thread Qing Zhao via Gcc-patches
Hi, Sid, Thanks a lot. > On Jul 31, 2023, at 1:07 PM, Siddhesh Poyarekar wrote: > > On 2023-07-31 13:03, Siddhesh Poyarekar wrote: >> On 2023-07-31 12:47, Qing Zhao wrote: >>> Hi, Sid and Jakub, >>> >>> I have a question in the following source por

One question on the source code of tree-object-size.cc

2023-07-31 Thread Qing Zhao via Gcc-patches
Hi, Sid and Jakub, I have a question in the following source portion of the routine “addr_object_size” of gcc/tree-object-size.cc: 743 bytes = compute_object_offset (TREE_OPERAND (ptr, 0), var); 744 if (bytes != error_mark_node) 745 { 746 bytes =

Re: [C PATCH]: Add Walloc-type to warn about insufficient size in allocations

2023-07-21 Thread Qing Zhao via Gcc-patches
> On Jul 21, 2023, at 7:21 AM, Martin Uecker via Gcc-patches > wrote: > > > > This patch adds a warning for allocations with insufficient size > based on the "alloc_size" attribute and the type of the pointer > the result is assigned to. While it is theoretically legal to > assign to the

[PATCH] gcc-13/changes.html: Add and fix URL to -fstrict-flex-array option.

2023-07-21 Thread Qing Zhao via Gcc-patches
Hi, In the current GCC13 release note, the URL to the option -fstrict-flex-array is wrong (pointing to -Wstrict-flex-array). This is the change to correct the URL and also add the URL in another place where -fstrict-flex-array is mentioned. I have checked the resulting HTML file, works well.

Re: [V1][PATCH 0/3] New attribute "element_count" to annotate bounds for C99 FAM(PR108896)

2023-07-19 Thread Qing Zhao via Gcc-patches
>> >> The point is: allocation size should synced with the value of “counted_by”. >> LLVM’s RFC also have the similar requirement: >> https://discourse.llvm.org/t/rfc-enforcing-bounds-safety-in-c-fbounds-safety/70854#maintaining-correctness-of-bounds-annotations-18 > > Right, I'm saying it

Re: [V1][PATCH 0/3] New attribute "element_count" to annotate bounds for C99 FAM(PR108896)

2023-07-19 Thread Qing Zhao via Gcc-patches
More thoughts on the following example Kees provided: > On Jul 17, 2023, at 7:40 PM, Kees Cook wrote: >> >> The counted_by attribute is used to annotate a Flexible array member on how >> many elements it will have. >> However, if this information can not accurately reflect the real number of

Re: [V1][PATCH 0/3] New attribute "element_count" to annotate bounds for C99 FAM(PR108896)

2023-07-18 Thread Qing Zhao via Gcc-patches
> On Jul 18, 2023, at 11:37 AM, Qing Zhao via Gcc-patches > wrote: > > > >> On Jul 17, 2023, at 7:40 PM, Kees Cook wrote: >> >> On Mon, Jul 17, 2023 at 09:17:48PM +, Qing Zhao wrote: >>> >>>> On Jul 13, 2023, at 4:31 PM, Kees Cook

Re: [V1][PATCH 0/3] New attribute "element_count" to annotate bounds for C99 FAM(PR108896)

2023-07-18 Thread Qing Zhao via Gcc-patches
> On Jul 18, 2023, at 12:03 PM, Martin Uecker wrote: > > Am Dienstag, dem 18.07.2023 um 15:37 + schrieb Qing Zhao: >> >> >>> On Jul 17, 2023, at 7:40 PM, Kees Cook >>> wrote: >>> >>> On Mon, Jul 17, 2023 at 09:17:48PM +,

Re: [V1][PATCH 0/3] New attribute "element_count" to annotate bounds for C99 FAM(PR108896)

2023-07-18 Thread Qing Zhao via Gcc-patches
> On Jul 17, 2023, at 7:40 PM, Kees Cook wrote: > > On Mon, Jul 17, 2023 at 09:17:48PM +0000, Qing Zhao wrote: >> >>> On Jul 13, 2023, at 4:31 PM, Kees Cook wrote: >>> >>> In the bug, the problem is that "p" isn't known to be allocate

Re: [V1][PATCH 0/3] New attribute "element_count" to annotate bounds for C99 FAM(PR108896)

2023-07-17 Thread Qing Zhao via Gcc-patches
> On Jul 13, 2023, at 4:31 PM, Kees Cook wrote: > > In the bug, the problem is that "p" isn't known to be allocated, if I'm > reading that correctly? I think that the major point in PR109557 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109557): for the following pointer p.3_1, p.3_1 = p;

[PATCH] gcc-14/changes.html: Deprecate a GCC C extension on flexible array members.

2023-07-10 Thread Qing Zhao via Gcc-patches
Hi, This is the change for the GCC14 releaes Notes on the deprecating of a C extension about flexible array members. Okay for committing? thanks. Qing *htdocs/gcc-14/changes.html (Caveats): Add notice about deprecating a C extension about flexible array members. ---

Re: [V1][PATCH 0/3] New attribute "element_count" to annotate bounds for C99 FAM(PR108896)

2023-07-07 Thread Qing Zhao via Gcc-patches
=== Qing > On Jul 7, 2023, at 11:47 AM, Qing Zhao via Gcc-patches > wrote: > > > >> On Jul 6, 2023, at 5:10 PM, Martin Uecker wrote: >> >> Am Donnerstag, dem 06.07.2023 um 18:56 + schrieb Qing Zhao: >>> Hi, Kees, >>> >>>

Re: [V1][PATCH 0/3] New attribute "element_count" to annotate bounds for C99 FAM(PR108896)

2023-07-07 Thread Qing Zhao via Gcc-patches
> On Jul 6, 2023, at 5:10 PM, Martin Uecker wrote: > > Am Donnerstag, dem 06.07.2023 um 18:56 + schrieb Qing Zhao: >> Hi, Kees, >> >> I have updated my V1 patch with the following changes: >> A. changed the name to "counted_by" >> B. ch

Re: [V1][PATCH 0/3] New attribute "element_count" to annotate bounds for C99 FAM(PR108896)

2023-07-06 Thread Qing Zhao via Gcc-patches
thanks. Qing > On May 26, 2023, at 4:40 PM, Kees Cook wrote: > > On Thu, May 25, 2023 at 04:14:47PM +, Qing Zhao wrote: >> GCC will pass the number of elements info from the attached attribute to >> both >> __builtin_dynamic_object_size and bounds sani

Re: [PATCH] Introduce hardbool attribute for C

2023-06-29 Thread Qing Zhao via Gcc-patches
On Jun 28, 2023, Qing Zhao wrote: > >> In summary, Ada’s Boolean variables (whether it’s hardened or not) are >> represented as >> enumeration types in GNU IR. > > Not quite. Only boolean types with representation clauses are. Those > without (such as Standard.Boolean

Re: [PATCH] Introduce hardbool attribute for C

2023-06-28 Thread Qing Zhao via Gcc-patches
> On Jun 28, 2023, at 3:26 AM, Alexandre Oliva wrote: > > I'd probably have arranged for the front-end to create the initializer > value, because expansion time is too late to figure it out: we may not > even have the front-end at hand any more, in case of lto compilation. >>>

Re: [PATCH v3] Introduce strub: machine-independent stack scrubbing

2023-06-27 Thread Qing Zhao via Gcc-patches
Hi, Alexandre, Thanks a lot for the work. I think that this will be a valuable feature to be added for GCC’s security functionality. I have several questions on this patch: 1. The implementation of register scrubbing, -fzero-call-used-regs, is to insert the register zeroing sequence in

Re: [V1][PATCH 1/3] Provide element_count attribute to flexible array member field (PR108896)

2023-06-27 Thread Qing Zhao via Gcc-patches
might need to extend the C FE to accept ".count” in the future. Let me know if you have further comments and suggestions. thanks. Qing > On Jun 20, 2023, at 3:40 PM, Qing Zhao via Gcc-patches > wrote: > > > >> On Jun 16, 2023, at 5:35 PM, Joseph Myers wrote:

Re: [PATCH] Introduce hardbool attribute for C

2023-06-26 Thread Qing Zhao via Gcc-patches
Hi, Alexandre, > On Jun 23, 2023, at 10:38 PM, Alexandre Oliva wrote: > >> For normal Boolean variables, 0x00 is false, this is a reasonable init >> value with zero-initialization. > > *nod*. I was surprised by zero initialization of (non-hardened) > booleans even when pattern is requested,

Re: [PATCH v3] Add leafy mode for zero-call-used-regs

2023-06-26 Thread Qing Zhao via Gcc-patches
> On Jun 23, 2023, at 7:27 PM, Alexandre Oliva wrote: > > On Jun 23, 2023, Qing Zhao via Gcc-patches wrote: > >> It’s better to add this definition earlier in the list of the “three >> basic values”, to make it “four basic values”, like the following: > > Oh, m

Re: [PATCH] Introduce hardbool attribute for C

2023-06-23 Thread Qing Zhao via Gcc-patches
> On Jun 21, 2023, at 10:35 PM, Alexandre Oliva wrote: > > On Jun 21, 2023, Qing Zhao wrote: > >> I see that you have testing case to check the above built_in_trap call >> is generated by FE. >> Do you have a testing case to check the trap is happening at

Re: [PATCH zero-call-used-regs] Add leafy mode for zero-call-used-regs

2023-06-23 Thread Qing Zhao via Gcc-patches
Hi, Alexandre, > On Jun 21, 2023, at 9:16 PM, Alexandre Oliva wrote: > > Hello, Qing, > > On Jun 16, 2023, Qing Zhao wrote: > >> As I mentioned in the previous round of review, I think that the >> documentation >> might need to add more details on w

Re: [PATCH] Introduce hardbool attribute for C

2023-06-21 Thread Qing Zhao via Gcc-patches
Hi, Alexandre, > > diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc > index 22e240a3c2a55..f9cc609b54d94 100644 > --- a/gcc/c/c-typeck.cc > +++ b/gcc/c/c-typeck.cc > @@ -2226,6 +2226,35 @@ convert_lvalue_to_rvalue (location_t loc, struct > c_expr exp, > exp.value = convert

Re: [V1][PATCH 1/3] Provide element_count attribute to flexible array member field (PR108896)

2023-06-20 Thread Qing Zhao via Gcc-patches
> On Jun 16, 2023, at 5:35 PM, Joseph Myers wrote: > > On Fri, 16 Jun 2023, Qing Zhao via Gcc-patches wrote: > >>> So for >>> >>> struct foo { int c; int buf[(struct { int d; }){ .d = .c }]; }; >>> >>> one knows d

[V10][PATCH 1/3] Introduce IR bit TYPE_INCLUDES_FLEXARRAY for the GCC extension [PR77650]

2023-06-20 Thread Qing Zhao via Gcc-patches
on a structure with a C99 flexible array member being nested in another structure GCC extension accepts the case when a struct with a flexible array member is embedded into another struct or union (possibly recursively) as the last field. This patch is to introduce the IR bit

[V10][PATCH 3/3] Use TYPE_INCLUDES_FLEXARRAY in __builtin_object_size [PR101832]

2023-06-20 Thread Qing Zhao via Gcc-patches
__builtin_object_size should treat struct with TYPE_INCLUDES_FLEXARRAY as flexible size. gcc/ChangeLog: PR tree-optimization/101832 * tree-object-size.cc (addr_object_size): Handle structure/union type when it has flexible size. gcc/testsuite/ChangeLog: PR

[V10][PATCH 2/3] Update documentation to clarify a GCC extension [PR77650]

2023-06-20 Thread Qing Zhao via Gcc-patches
on a structure with a C99 flexible array member being nested in another structure. "The GCC extension accepts a structure containing an ISO C99 "flexible array member", or a union containing such a structure (possibly recursively) to be a member of a structure. There are two situations: * A

[V10][PATCH 0/3] Accept and Handle the case when a structure including a FAM nested in another structure

2023-06-20 Thread Qing Zhao via Gcc-patches
they have been approved already. for the patch 3/3, I will wait for several days, if there is no objection or new comments, I will commit it the end of this week. Please let me know if you have comments and suggestions. thanks. Qing Qing Zhao (3): Introduce IR bit TYPE_INCLUDES_FLEXARRAY

Re: [V1][PATCH 1/3] Provide element_count attribute to flexible array member field (PR108896)

2023-06-16 Thread Qing Zhao via Gcc-patches
> On Jun 16, 2023, at 1:07 PM, Martin Uecker wrote: > > Am Freitag, dem 16.06.2023 um 16:21 + schrieb Joseph Myers: >> On Fri, 16 Jun 2023, Martin Uecker via Gcc-patches wrote: >> Note that no expressions can start with the '.' token at present. As soon as you invent a new

Re: [PATCH zero-call-used-regs] Add leafy mode for zero-call-used-regs

2023-06-16 Thread Qing Zhao via Gcc-patches
Hi, Alexandre, > On Jun 16, 2023, at 3:26 AM, Alexandre Oliva wrote: > > Hello, Qing, > > On Oct 27, 2022, Qing Zhao wrote: > <https://gcc.gnu.org/pipermail/gcc-patches/2022-October/604480.html> > >> On Oct 26, 2022, at 5:29 PM, Alexandre Oliva wrote: >&

Re: [V1][PATCH 1/3] Provide element_count attribute to flexible array member field (PR108896)

2023-06-16 Thread Qing Zhao via Gcc-patches
> On Jun 16, 2023, at 3:21 AM, Martin Uecker wrote: > > Am Donnerstag, dem 15.06.2023 um 16:55 + schrieb Joseph Myers: >> On Thu, 15 Jun 2023, Qing Zhao via Gcc-patches wrote: >> > ... >>> 1. Update the routine “c_parser_postfix_expression” (is this

Re: [V1][PATCH 1/3] Provide element_count attribute to flexible array member field (PR108896)

2023-06-16 Thread Qing Zhao via Gcc-patches
> On Jun 15, 2023, at 6:48 PM, Joseph Myers wrote: > > On Thu, 15 Jun 2023, Qing Zhao via Gcc-patches wrote: > >> B. The argument of the new attribute “counted_by” is an identifier that can >> be >> accepted by “c_parser_attribute_arguments”: >> >&

Re: [V1][PATCH 1/3] Provide element_count attribute to flexible array member field (PR108896)

2023-06-15 Thread Qing Zhao via Gcc-patches
> On Jun 15, 2023, at 12:55 PM, Joseph Myers wrote: > > On Thu, 15 Jun 2023, Qing Zhao via Gcc-patches wrote: > >> Comparing B with A, I don’t see too much benefit, either from >> user-interface point of view, or from implementation point of view. >> >> F

Re: [V1][PATCH 1/3] Provide element_count attribute to flexible array member field (PR108896)

2023-06-15 Thread Qing Zhao via Gcc-patches
your help. Qing > On Jun 7, 2023, at 6:05 PM, Joseph Myers wrote: > > On Wed, 7 Jun 2023, Qing Zhao via Gcc-patches wrote: > >> Are you suggesting to use identifier directly as the argument of the >> attribute? >> I tried this in the beginning, however, the current p

Ping * 2 : Fwd: [V9][PATCH 1/2] Handle component_ref to a structre/union field including flexible array member [PR101832]

2023-06-13 Thread Qing Zhao via Gcc-patches
for commit to trunk? Thanks a lot! Qing > On Jun 5, 2023, at 11:12 AM, Qing Zhao via Gcc-patches > wrote: > > Ping on this patch. > > The C FE and Doc changes has been approved. > Please help to review and approve the Middle-end change. > > Or provide guide on how

Re: [V1][PATCH 1/3] Provide element_count attribute to flexible array member field (PR108896)

2023-06-08 Thread Qing Zhao via Gcc-patches
> On Jun 7, 2023, at 6:05 PM, Joseph Myers wrote: > > On Wed, 7 Jun 2023, Qing Zhao via Gcc-patches wrote: > >> Are you suggesting to use identifier directly as the argument of the >> attribute? >> I tried this in the beginning, however, the current parser for

Re: [V1][PATCH 1/3] Provide element_count attribute to flexible array member field (PR108896)

2023-06-07 Thread Qing Zhao via Gcc-patches
> On Jun 7, 2023, at 4:53 PM, Joseph Myers wrote: > > On Wed, 7 Jun 2023, Qing Zhao via Gcc-patches wrote: > >> Hi, Joseph, >> >> A question here: can an identifier in C be a wide char string? > > Identifiers and strings are different kinds of tokens

Re: [V1][PATCH 1/3] Provide element_count attribute to flexible array member field (PR108896)

2023-06-07 Thread Qing Zhao via Gcc-patches
Hi, Joseph, A question here: can an identifier in C be a wide char string? Qing > On May 26, 2023, at 2:15 PM, Joseph Myers wrote: > > On Fri, 26 May 2023, Qing Zhao via Gcc-patches wrote: > >>> What if the string is a wide string? I don't expect that to work (ei

Ping: Fwd: [V9][PATCH 1/2] Handle component_ref to a structre/union field including flexible array member [PR101832]

2023-06-05 Thread Qing Zhao via Gcc-patches
Ping on this patch. The C FE and Doc changes has been approved. Please help to review and approve the Middle-end change. Or provide guide on how to move this patch forward. Thanks a lot for the help. Qing Begin forwarded message: From: Qing Zhao mailto:qing.z...@oracle.com>> Subjec

Re: [V1][PATCH 0/3] New attribute "element_count" to annotate bounds for C99 FAM(PR108896)

2023-05-30 Thread Qing Zhao via Gcc-patches
> On May 26, 2023, at 12:12 PM, Kees Cook wrote: > > On Thu, May 25, 2023 at 04:14:47PM +0000, Qing Zhao wrote: >> This patch set introduces a new attribute "element_count" to annotate bounds >> for C99 flexible array member. > > Thank you for this wo

[V9][PATCH 2/2] Update documentation to clarify a GCC extension [PR77650]

2023-05-30 Thread Qing Zhao via Gcc-patches
Joseph, could you please review this patch and see whether it's Okay for commit now? thanks a lot for all your comments and suggestions for this patch. Qing. == on a structure with a C99 flexible array member being nested in another structure. "The GCC

[V9][PATCH 1/2] Handle component_ref to a structre/union field including flexible array member [PR101832]

2023-05-30 Thread Qing Zhao via Gcc-patches
Richard or Jakub, could you please review this patch and see whether it's Okay to commit? thanks a lot. Qing === GCC extension accepts the case when a struct with a C99 flexible array member is embedded into another struct or union (possibly recursively) as

[V9][PATCH 0/2] Accept and Handle the case when a structure including a FAM nested in another structure

2023-05-30 Thread Qing Zhao via Gcc-patches
Hi, This is the 8th version of the patch, which rebased on the latest trunk. This is an important patch needed by Linux Kernel security project. compared to the 8th version, the Only change is in PATCH 2/2 (per Joseph's comment): diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index

Re: [V1][PATCH 2/3] Use the element_count atribute info in builtin object size [PR108896].

2023-05-30 Thread Qing Zhao via Gcc-patches
ame. Thanks a lot for your suggestions and comments. Qing > > Martin > > > > > Am Donnerstag, dem 25.05.2023 um 16:14 + schrieb Qing Zhao: >> 2023-05-17 Qing Zhao >> >> gcc/ChangeLog: >> >> PR C/108896 >>

Re: [V1][PATCH 0/3] New attribute "element_count" to annotate bounds for C99 FAM(PR108896)

2023-05-30 Thread Qing Zhao via Gcc-patches
> On May 26, 2023, at 4:40 PM, Kees Cook wrote: > > On Thu, May 25, 2023 at 04:14:47PM +0000, Qing Zhao wrote: >> GCC will pass the number of elements info from the attached attribute to >> both >> __builtin_dynamic_object_size and bounds sanitizer to check the

Re: [V8][PATCH 2/2] Update documentation to clarify a GCC extension [PR77650]

2023-05-30 Thread Qing Zhao via Gcc-patches
> On May 26, 2023, at 4:12 PM, Joseph Myers wrote: > > On Fri, 26 May 2023, Qing Zhao via Gcc-patches wrote: > >> Another question: is it better for me to rearrange the Patch 1/2 and Patch >> 2/2 a little bit, >> to put the FE , doc change and corresponding

Re: [V1][PATCH 1/3] Provide element_count attribute to flexible array member field (PR108896)

2023-05-26 Thread Qing Zhao via Gcc-patches
> On May 26, 2023, at 2:15 PM, Joseph Myers wrote: > > On Fri, 26 May 2023, Qing Zhao via Gcc-patches wrote: > >>> What if the string is a wide string? I don't expect that to work (either >>> as a matter of interface design, or in the present code), but I th

Re: [V8][PATCH 2/2] Update documentation to clarify a GCC extension [PR77650]

2023-05-26 Thread Qing Zhao via Gcc-patches
Thank you for the suggestion. > On May 26, 2023, at 1:59 PM, Joseph Myers wrote: > > On Thu, 25 May 2023, Qing Zhao via Gcc-patches wrote: > >>> On May 25, 2023, at 4:51 PM, Joseph Myers wrote: >>> >>> The documentation in this case is OK, though

Re: [V1][PATCH 1/3] Provide element_count attribute to flexible array member field (PR108896)

2023-05-26 Thread Qing Zhao via Gcc-patches
> On May 25, 2023, at 5:02 PM, Joseph Myers wrote: > > What happens if the field giving the number of elements is in a contained > anonymous structure or union? > > struct s { > struct { size_t count; }; > int array[] __attribute__ ((element_count ("count"))); > }; > > This ought to work

Re: [V8][PATCH 2/2] Update documentation to clarify a GCC extension [PR77650]

2023-05-25 Thread Qing Zhao via Gcc-patches
> On May 25, 2023, at 4:51 PM, Joseph Myers wrote: > > The documentation in this case is OK, though claims about how a future > version will behave have a poor track record (we tend to end up with such > claims persisting in the documentation even though the change in question > didn't get

[V1][PATCH 3/3] Use the element_count attribute information in bound sanitizer[PR108896]

2023-05-25 Thread Qing Zhao via Gcc-patches
2023-05-17 Qing Zhao gcc/c-family/ChangeLog: PR C/108896 * c-ubsan.cc (ubsan_instrument_bounds): Use element_count attribute information. gcc/testsuite/ChangeLog: PR C/108896 * gcc.dg/ubsan/flex-array-element-count-bounds.c: New test. --- gcc/c-family

[V1][PATCH 2/3] Use the element_count atribute info in builtin object size [PR108896].

2023-05-25 Thread Qing Zhao via Gcc-patches
2023-05-17 Qing Zhao gcc/ChangeLog: PR C/108896 * tree-object-size.cc (addr_object_size): Use the element_count attribute info. * tree.cc (component_ref_has_element_count_p): New function. (component_ref_get_element_count): New function. * tree.h

[V1][PATCH 1/3] Provide element_count attribute to flexible array member field (PR108896)

2023-05-25 Thread Qing Zhao via Gcc-patches
detect out-of-bound errors for flexible array member references. 2023-05-17 Qing Zhao gcc/c-family/ChangeLog: PR C/108896 * c-attribs.cc (handle_element_count_attribute): New function. * c-common.cc (c_flexible_array_member_type_p): To this. * c-common.h (c_flex

[V1][PATCH 0/3] New attribute "element_count" to annotate bounds for C99 FAM(PR108896)

2023-05-25 Thread Qing Zhao via Gcc-patches
Hi, This patch set introduces a new attribute "element_count" to annotate bounds for C99 flexible array member. A gcc bugzilla PR108896 has been created to record this task: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108896 A nice writeup "Bounded Flexible Arrays in C"

[V8][PATCH 2/2] Update documentation to clarify a GCC extension [PR77650]

2023-05-25 Thread Qing Zhao via Gcc-patches
on a structure with a C99 flexible array member being nested in another structure. "The GCC extension accepts a structure containing an ISO C99 "flexible array member", or a union containing such a structure (possibly recursively) to be a member of a structure. There are two situations: * A

[V8][PATCH 0/2]Accept and Handle the case when a structure including a FAM nested in another structure

2023-05-25 Thread Qing Zhao via Gcc-patches
(Resend due to the previous patches didn't include the version number) Hi, This is the 8th version of the patch, which rebased on the latest trunk. This is an important patch needed by Linux Kernel security project. compared to the 7th version, the major change are: 1. update the documentation

[V8][PATCH 1/2] Handle component_ref to a structre/union field including flexible array member [PR101832]

2023-05-25 Thread Qing Zhao via Gcc-patches
GCC extension accepts the case when a struct with a C99 flexible array member is embedded into another struct or union (possibly recursively) as the last field. __builtin_object_size should treat such struct as flexible size. gcc/c/ChangeLog: PR tree-optimization/101832 *

Re: [V7][PATCH 1/2] Handle component_ref to a structre/union field including flexible array member [PR101832]

2023-05-25 Thread Qing Zhao via Gcc-patches
> On May 25, 2023, at 1:41 AM, Bernhard Reutner-Fischer > wrote: > > On 24 May 2023 16:09:21 CEST, Qing Zhao wrote: >> Bernhard, >> >> Thanks a lot for your comments. >> >>> On May 19, 2023, at 7:11 PM, Bernhard Reutner-Fischer >>&g

[V8][PATCH 0/2]Accept and Handle the case when a structure including a FAM nested in another structure

2023-05-24 Thread Qing Zhao via Gcc-patches
Hi, This is the 8th version of the patch, which rebased on the latest trunk. This is an important patch needed by Linux Kernel security project. compared to the 7th version, the major change are: 1. update the documentation wordings based on Joseph's suggestions. 2. change the name of the new

[PATCH 2/2] Update documentation to clarify a GCC extension [PR77650]

2023-05-24 Thread Qing Zhao via Gcc-patches
on a structure with a C99 flexible array member being nested in another structure. "The GCC extension accepts a structure containing an ISO C99 "flexible array member", or a union containing such a structure (possibly recursively) to be a member of a structure. There are two situations: * A

[PATCH 1/2] Handle component_ref to a structre/union field including flexible array member [PR101832]

2023-05-24 Thread Qing Zhao via Gcc-patches
GCC extension accepts the case when a struct with a C99 flexible array member is embedded into another struct or union (possibly recursively) as the last field. __builtin_object_size should treat such struct as flexible size. gcc/c/ChangeLog: PR tree-optimization/101832 *

Re: [V7][PATCH 2/2] Update documentation to clarify a GCC extension [PR77650]

2023-05-24 Thread Qing Zhao via Gcc-patches
ote: > > On Fri, 19 May 2023, Qing Zhao via Gcc-patches wrote: > >> +GCC extension accepts a structure containing an ISO C99 @dfn{flexible array > > "The GCC extension" or "A GCC extension". > >> +@item >> +A structure containing a C99 flexib

Re: [V7][PATCH 1/2] Handle component_ref to a structre/union field including flexible array member [PR101832]

2023-05-24 Thread Qing Zhao via Gcc-patches
Bernhard, Thanks a lot for your comments. > On May 19, 2023, at 7:11 PM, Bernhard Reutner-Fischer > wrote: > > On Fri, 19 May 2023 20:49:47 + > Qing Zhao via Gcc-patches wrote: > >> GCC extension accepts the case when a struct with a flexible array member >

Re: [V7][PATCH 2/2] Update documentation to clarify a GCC extension [PR77650]

2023-05-24 Thread Qing Zhao via Gcc-patches
Joseph, Thanks a lot for the review. And sorry for my late reply (just came back from a short vacation). > On May 19, 2023, at 5:12 PM, Joseph Myers wrote: > > On Fri, 19 May 2023, Qing Zhao via Gcc-patches wrote: > >> +GCC extension accepts a structure containing an ISO

[V7][PATCH 2/2] Update documentation to clarify a GCC extension [PR77650]

2023-05-19 Thread Qing Zhao via Gcc-patches
on a structure with a C99 flexible array member being nested in another structure. "GCC extension accepts a structure containing an ISO C99 "flexible array member", or a union containing such a structure (possibly recursively) to be a member of a structure. There are two situations: * A

[V7][PATCH 1/2] Handle component_ref to a structre/union field including flexible array member [PR101832]

2023-05-19 Thread Qing Zhao via Gcc-patches
GCC extension accepts the case when a struct with a flexible array member is embedded into another struct or union (possibly recursively). __builtin_object_size should treat such struct as flexible size. gcc/c/ChangeLog: PR tree-optimization/101832 * c-decl.cc (finish_struct):

[V7][PATCH 0/2]Accept and Handle the case when a structure including a FAM nested in another structure

2023-05-19 Thread Qing Zhao via Gcc-patches
Hi, This is the 7th version of the patch, which rebased on the latest trunk. This is an important patch needed by Linux Kernel security project. We already have an extensive discussion on this issue and I have went through 6 revisions of the patches based on the discussion and resolved all the

Re: Question on patch -fprofile-partial-training

2023-05-15 Thread Qing Zhao via Gcc-patches
> On May 11, 2023, at 12:08 PM, Qing Zhao via Gcc-patches > wrote: > > > >> On May 10, 2023, at 9:15 AM, Jan Hubicka wrote: >> >>> Honza, >>>> Main motivation for this was profiling programs that contain specific >>>> code p

Re: Question on patch -fprofile-partial-training

2023-05-11 Thread Qing Zhao via Gcc-patches
> On May 10, 2023, at 9:15 AM, Jan Hubicka wrote: > >> Honza, >>> Main motivation for this was profiling programs that contain specific >>> code paths for different CPUs (such as graphics library in Firefox or Linux >>> kernel). In the situation training machine differs from the machine >>>

Re: Question on patch -fprofile-partial-training

2023-05-09 Thread Qing Zhao via Gcc-patches
Honza, Thanks a lot for your comments. > On May 9, 2023, at 6:22 AM, Jan Hubicka wrote: > > > From my understanding, -fprofile-partial-training is one important option > for PGO performance. I don't think so, speed benefit would be rather small I guess. >>> I saw some

Re: Question on patch -fprofile-partial-training

2023-05-04 Thread Qing Zhao via Gcc-patches
> On May 4, 2023, at 9:05 AM, Martin Liška wrote: > > On 5/4/23 14:54, Qing Zhao wrote: >> >> >>> On May 4, 2023, at 4:30 AM, Martin Liška wrote: >>> >>> On 5/3/23 21:10, Qing Zhao via Gcc-patches wrote: >>>> Hi, Jan, >>

Re: Question on patch -fprofile-partial-training

2023-05-04 Thread Qing Zhao via Gcc-patches
> On May 4, 2023, at 4:30 AM, Martin Liška wrote: > > On 5/3/23 21:10, Qing Zhao via Gcc-patches wrote: >> Hi, Jan, >> >> You added the following patch into gcc10: >> >> From 34fbe3f0946f88828765184ed6581bda62cdf49f Mon Sep 17 00:00:00 2001 >> F

Question on patch -fprofile-partial-training

2023-05-03 Thread Qing Zhao via Gcc-patches
Hi, Jan, You added the following patch into gcc10: >From 34fbe3f0946f88828765184ed6581bda62cdf49f Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Thu, 5 Dec 2019 19:12:51 +0100 Subject: [PATCH] cgraphclones.c (localize_profile): New function. * cgraphclones.c (localize_profile): New

Ping * 3: [V6][PATCH 2/2] Update documentation to clarify a GCC extension

2023-04-20 Thread Qing Zhao via Gcc-patches
Hi, Is this patch ready for GCC14? Thanks. Qing Begin forwarded message: From: Qing Zhao via Gcc-patches mailto:gcc-patches@gcc.gnu.org>> Subject: Fwd: [V6][PATCH 2/2] Update documentation to clarify a GCC extension Date: April 11, 2023 at 9:38:29 AM EDT To: Joseph Myers mail

Ping * 3: [V6][PATCH 1/2] Handle component_ref to a structre/union field including flexible array member [PR101832]

2023-04-20 Thread Qing Zhao via Gcc-patches
Hi, Is this patch ready for GCC14? Thanks. Qing Begin forwarded message: From: Qing Zhao via Gcc-patches mailto:gcc-patches@gcc.gnu.org>> Subject: Fwd: [V6][PATCH 1/2] Handle component_ref to a structre/union field including flexible array member [PR101832] Date: April 11, 2023 at 9

Ping * 3: Fwd: [V6][PATCH 0/2] Handle component_ref to a structure/union field including FAM for builtin_object_size

2023-04-20 Thread Qing Zhao via Gcc-patches
ension This is basically a C FE and documentation change, I have updated it based on previous comments and suggestions. Joseph, could you review it to see whether this version is ready to go? Thanks a lot. Qing Begin forwarded message: From: Qing Zhao mailto:qing.z...@oracle.com>>

Re: [V6][PATCH 1/2] Handle component_ref to a structre/union field including flexible array member [PR101832]

2023-04-17 Thread Qing Zhao via Gcc-patches
to the Kernel security. Thanks. Qing > On Apr 12, 2023, at 2:46 PM, Kees Cook wrote: > > On Tue, Mar 28, 2023 at 03:49:43PM +0000, Qing Zhao wrote: >> the C front-end has been approved by Joseph. >> >> Jacub, could you please eview the middle end part of th

Fwd: [V6][PATCH 2/2] Update documentation to clarify a GCC extension

2023-04-11 Thread Qing Zhao via Gcc-patches
Hi, Joseph, This is the 2nd ping to the 6th version of the patch -:) Please let me know if you have any further comments on the patch, and whether it’s Okay to commit it to trunk? Thanks a lot for the help. Qing Begin forwarded message: From: Qing Zhao via Gcc-patches mailto:gcc-patches

Fwd: [V6][PATCH 1/2] Handle component_ref to a structre/union field including flexible array member [PR101832]

2023-04-11 Thread Qing Zhao via Gcc-patches
Hi, Jakub, This is the 2nd ping to the 6th version of the patches -:) Please let me know if you have any further comments on this patch, and whether it’s Okay to commit it to trunk? Thanks a lot for the help. Qing Begin forwarded message: From: Qing Zhao via Gcc-patches mailto:gcc-patches

Fwd: [V6][PATCH 0/2] Handle component_ref to a structure/union field including FAM for builtin_object_size

2023-04-11 Thread Qing Zhao via Gcc-patches
Hi, Joseph and Jakub, This is the 2nd ping to the 6th version of the patches -:) Please let me know if you have any further comments on the patches, and whether it’s Okay to commit them to trunk? Thanks a lot for the help. Qing Begin forwarded message: From: Qing Zhao mailto:qing.z

Fwd: [V6][PATCH 2/2] Update documentation to clarify a GCC extension

2023-04-04 Thread Qing Zhao via Gcc-patches
Ping…. Qing Begin forwarded message: From: Qing Zhao mailto:qing.z...@oracle.com>> Subject: [PATCH 2/2] Update documentation to clarify a GCC extension Date: March 28, 2023 at 11:49:44 AM EDT To: ja...@redhat.com<mailto:ja...@redhat.com>, jos...@codesourcery.com<mailto:jos...@c

Fwd: [V6][PATCH 1/2] Handle component_ref to a structre/union field including flexible array member [PR101832]

2023-04-04 Thread Qing Zhao via Gcc-patches
Ping… Qing Begin forwarded message: From: Qing Zhao mailto:qing.z...@oracle.com>> Subject: [V6][PATCH 1/2] Handle component_ref to a structre/union field including flexible array member [PR101832] Date: March 28, 2023 at 11:49:43 AM EDT To: ja...@redhat.com<mailto:ja...@redhat.c

Re: Should -ffp-contract=off the default on GCC?

2023-03-31 Thread Qing Zhao via Gcc-patches
> On Mar 24, 2023, at 3:42 PM, Andrew Pinski wrote: > > On Fri, Mar 24, 2023 at 1:14 AM Fangrui Song via Gcc-patches > wrote: >> >> On Wed, Mar 22, 2023 at 8:52 AM Qing Zhao via Gcc-patches >> wrote: >>> >>> >>> >>

[V6][PATCH 0/2] Handle component_ref to a structure/union field including FAM for builtin_object_size

2023-03-28 Thread Qing Zhao via Gcc-patches
a review from Jakub for the Middle-end. bootstrapped and regression tested on aarch64 and x86. Okay for commit? thanks. Qing = Qing Zhao (2): Handle component_ref to a structre/union field including flexible array member [PR101832] Update documentation to clarify a GCC extension

[V6][PATCH 1/2] Handle component_ref to a structre/union field including flexible array member [PR101832]

2023-03-28 Thread Qing Zhao via Gcc-patches
the C front-end has been approved by Joseph. Jacub, could you please eview the middle end part of the changes of this patch? The major change is in tree-object-size.cc (addr_object_size). (To use the new TYPE_INCLUDE_FLEXARRAY info). This patch is to fix

[PATCH 2/2] Update documentation to clarify a GCC extension

2023-03-28 Thread Qing Zhao via Gcc-patches
on a structure with a C99 flexible array member being nested in another structure. (PR77650) "GCC extension accepts a structure containing an ISO C99 "flexible array member", or a union containing such a structure (possibly recursively) to be a member of a structure. There are two situations:

Re: [V5][PATCH 2/2] Update documentation to clarify a GCC extension

2023-03-27 Thread Qing Zhao via Gcc-patches
> On Mar 27, 2023, at 12:48 PM, Qing Zhao via Gcc-patches > wrote: > > > >> On Mar 27, 2023, at 12:31 PM, Jakub Jelinek wrote: >> >> On Mon, Mar 27, 2023 at 04:22:25PM +, Qing Zhao via Gcc-patches wrote: >>>> The latter IMHO. Havi

Re: [V5][PATCH 2/2] Update documentation to clarify a GCC extension

2023-03-27 Thread Qing Zhao via Gcc-patches
> On Mar 27, 2023, at 12:31 PM, Jakub Jelinek wrote: > > On Mon, Mar 27, 2023 at 04:22:25PM +0000, Qing Zhao via Gcc-patches wrote: >>> The latter IMHO. Having a warning with completely nonsensical name will >>> just confuse users. >> >> Okay. -:) >

Re: [V5][PATCH 2/2] Update documentation to clarify a GCC extension

2023-03-27 Thread Qing Zhao via Gcc-patches
> On Mar 27, 2023, at 12:06 PM, Jakub Jelinek wrote: > > On Mon, Mar 27, 2023 at 03:57:58PM +0000, Qing Zhao wrote: >>>> +Please use warning option @option{-Wgnu-variable-sized-type-not-at-end} >>>> to >>> This is certainly misnamed. >> &

Re: [V5][PATCH 2/2] Update documentation to clarify a GCC extension

2023-03-27 Thread Qing Zhao via Gcc-patches
> On Mar 27, 2023, at 11:43 AM, Jakub Jelinek wrote: > > On Mon, Mar 27, 2023 at 01:38:34PM +0000, Qing Zhao wrote: >> >> >>> On Mar 23, 2023, at 4:14 PM, Joseph Myers wrote: >>> >>> On Thu, 23 Mar 2023, Qing Zhao via Gcc-patches wrote

Re: [V5][PATCH 2/2] Update documentation to clarify a GCC extension

2023-03-27 Thread Qing Zhao via Gcc-patches
> On Mar 27, 2023, at 10:34 AM, Xi Ruoyao wrote: > > On Mon, 2023-03-27 at 13:38 +0000, Qing Zhao via Gcc-patches wrote: >> >> >>> On Mar 23, 2023, at 4:14 PM, Joseph Myers wrote: >>> >>> On Thu, 23 Mar 2023, Qing Zhao via Gcc-patches wrote

Re: [V5][PATCH 1/2] Handle component_ref to a structre/union field including flexible array member [PR101832]

2023-03-27 Thread Qing Zhao via Gcc-patches
AM, Qing Zhao via Gcc-patches > wrote: > > Ping… > > Please let me know if you have any further comments on the patch. > > thanks. > > Qing > > > Begin forwarded message: > > From: Qing Zhao mailto:qing.z...@oracle.com>> > Subject: [V5][PAT

Re: [V5][PATCH 2/2] Update documentation to clarify a GCC extension

2023-03-27 Thread Qing Zhao via Gcc-patches
> On Mar 23, 2023, at 4:14 PM, Joseph Myers wrote: > > On Thu, 23 Mar 2023, Qing Zhao via Gcc-patches wrote: > >> +Wgnu-variable-sized-type-not-at-end >> +C C++ Var(warn_variable_sized_type_not_at_end) Warning >> +Warn about structures or unions w

Re: [V5][PATCH 1/2] Handle component_ref to a structre/union field including flexible array member [PR101832]

2023-03-27 Thread Qing Zhao via Gcc-patches
> On Mar 23, 2023, at 2:55 PM, Joseph Myers wrote: > > On Thu, 23 Mar 2023, Qing Zhao via Gcc-patches wrote: > >> gcc/c/ChangeLog: >> >> PR tree-optimization/101832 >> * c-decl.cc<http://c-decl.cc> (finish_struct): Set TYPE_INCLUDE_FLEXARRAY for

<    1   2   3   4   5   6   7   8   9   10   >