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

2023-03-23 Thread Qing Zhao via Gcc-patches
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][PATCH 0/2] Handle component_ref to a structure/union field 
including FAM for builtin_object_size
Date: March 16, 2023 at 5:47:13 PM EDT
To: jos...@codesourcery.com<mailto:jos...@codesourcery.com>, 
ja...@redhat.com<mailto:ja...@redhat.com>, 
san...@codesourcery.com<mailto:san...@codesourcery.com>
Cc: rguent...@suse.de<mailto:rguent...@suse.de>, 
siddh...@gotplt.org<mailto:siddh...@gotplt.org>, 
keesc...@chromium.org<mailto:keesc...@chromium.org>, 
gcc-patches@gcc.gnu.org<mailto:gcc-patches@gcc.gnu.org>, Qing Zhao 
mailto:qing.z...@oracle.com>>

Hi, Joseph, Jakub and Sandra,

Could you please review this patch and let me know whether it’s ready
for committing into GCC13?

The fix to Bug PR101832 is an important patch for kernel security
purpose. it's better to be put into GCC13.

===

These are the 5th version of the patches for PR101832, to fix
builtin_object_size to correctly handle component_ref to a
structure/union field that includes a flexible array member.

also includes a documentation update for the GCC extension on embedding
a structure/union with flexible array member into another structure.
which includes a fix to PR77650.

compared to the 4th version of the patch, the major changes are:

1. Update the documentation per Sandra's comments and
suggestion.
2. per Richard's suggestion, let the new bit TYPE_INCLUDE_FLEXARRAY to
share the same bit with no_named_args_stdarg_p to save space in the IR.
and corresponding changes to support such sharing.
3. I also changed the code inside 
tree-object-size.cc<http://tree-object-size.cc> to make it cleaner
and easier to be understood.

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

gcc/c-family/c.opt|   5 +
gcc/c/c-decl.cc<http://c-decl.cc>   |  19 +++
gcc/doc/extend.texi   |  45 +-
gcc/lto/lto-common.cc<http://lto-common.cc> |   5 +-
gcc/print-tree.cc<http://print-tree.cc> |   5 +
.../gcc.dg/builtin-object-size-pr101832.c | 134 ++
.../gcc.dg/variable-sized-type-flex-array.c   |  31 
gcc/tree-core.h   |   2 +
gcc/tree-object-size.cc<http://tree-object-size.cc>   |  23 
++-
gcc/tree-streamer-in.cc<http://tree-streamer-in.cc>   |   5 
+-
gcc/tree-streamer-out.cc<http://tree-streamer-out.cc>  |   
5 +-
gcc/tree.h|   7 +-
12 files changed, 280 insertions(+), 6 deletions(-)
create mode 100644 gcc/testsuite/gcc.dg/builtin-object-size-pr101832.c
create mode 100644 gcc/testsuite/gcc.dg/variable-sized-type-flex-array.c

--
2.31.1




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

2023-03-16 Thread Qing Zhao via Gcc-patches
Hi, Joseph, Jakub and Sandra,

Could you please review this patch and let me know whether it???s ready
for committing into GCC13?

The fix to Bug PR101832 is an important patch for kernel security
purpose. it's better to be put into GCC13.

===

These are the 5th version of the patches for PR101832, to fix
builtin_object_size to correctly handle component_ref to a
structure/union field that includes a flexible array member.

also includes a documentation update for the GCC extension on embedding
a structure/union with flexible array member into another structure.
which includes a fix to PR77650.

compared to the 4th version of the patch, the major changes are:

1. Update the documentation per Sandra's comments and
suggestion.
2. per Richard's suggestion, let the new bit TYPE_INCLUDE_FLEXARRAY to
share the same bit with no_named_args_stdarg_p to save space in the IR.
and corresponding changes to support such sharing.
3. I also changed the code inside tree-object-size.cc to make it cleaner
and easier to be understood.

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

 gcc/c-family/c.opt|   5 +
 gcc/c/c-decl.cc   |  19 +++
 gcc/doc/extend.texi   |  45 +-
 gcc/lto/lto-common.cc |   5 +-
 gcc/print-tree.cc |   5 +
 .../gcc.dg/builtin-object-size-pr101832.c | 134 ++
 .../gcc.dg/variable-sized-type-flex-array.c   |  31 
 gcc/tree-core.h   |   2 +
 gcc/tree-object-size.cc   |  23 ++-
 gcc/tree-streamer-in.cc   |   5 +-
 gcc/tree-streamer-out.cc  |   5 +-
 gcc/tree.h|   7 +-
 12 files changed, 280 insertions(+), 6 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/builtin-object-size-pr101832.c
 create mode 100644 gcc/testsuite/gcc.dg/variable-sized-type-flex-array.c

-- 
2.31.1