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

2023-02-08 Thread Qing Zhao via Gcc-patches
I found a bug with this patch, will fix it and send out the updated patch. Please ignore this one. sorry. Qing > On Feb 6, 2023, at 8:47 AM, Qing Zhao wrote: > > This is the 2nd version of the patch, compare to the first version, the major > changes are: > > 1. A

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

2023-02-08 Thread Qing Zhao via Gcc-patches
> On Feb 8, 2023, at 2:20 PM, Siddhesh Poyarekar wrote: > > On 2023-02-08 14:09, Joseph Myers wrote: >> What must be avoided is -pedantic diagnostics for >> struct flex1 { int n; int data[1]; }; >> struct out_flex_end1 { int m; struct flex1 flex_data; }; >> regardless of whether considered fle

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

2023-02-08 Thread Qing Zhao via Gcc-patches
> On Feb 8, 2023, at 2:09 PM, Joseph Myers wrote: > > On Wed, 8 Feb 2023, Qing Zhao via Gcc-patches wrote: > >> But I noticed that “flexible_array_type_p” later was moved from FE to >> middle-end and put into tree.cc, tree.h as a general utility routine, and to >

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

2023-02-09 Thread Qing Zhao via Gcc-patches
> On Feb 9, 2023, at 5:35 AM, Richard Biener wrote: > > On Wed, 8 Feb 2023, Qing Zhao wrote: > >> >> >>> On Feb 7, 2023, at 6:37 PM, Joseph Myers wrote: >>> >>> On Tue, 7 Feb 2023, Qing Zhao via Gcc-patches wrote: >>> &

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

2023-02-09 Thread Qing Zhao via Gcc-patches
> On Feb 8, 2023, at 6:18 PM, Qing Zhao via Gcc-patches > wrote: > > > >> On Feb 8, 2023, at 2:09 PM, Joseph Myers wrote: >> >> On Wed, 8 Feb 2023, Qing Zhao via Gcc-patches wrote: >> >>> But I noticed that “flexible_array_type_p” later

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

2023-02-10 Thread Qing Zhao via Gcc-patches
Thanks, Kees. If there is no objection, I will update my patches with this. And send the updated patches soon. Qing > On Feb 9, 2023, at 11:46 AM, Kees Cook wrote: > > On Thu, Feb 09, 2023 at 02:40:57PM +0000, Qing Zhao wrote: >> So, the major question here is: >> >

[v3][PATCH 1/2] Handle component_ref to a structre/union field including C99 FAM [PR101832]

2023-02-10 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). __builtin_object_size should treat such struct as flexible size. gcc/c/ChangeLog: PR tree-optimization/101832 * c-decl.cc (finish_struct):

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

2023-02-10 Thread Qing Zhao via Gcc-patches
on structure with C99 flexible array member being nested in another structure. This is also fixed PR77650. " GCC extension accepts a structure containing a ISO C99 "flexible array member", or a union containing such a structure (possibly recursively) to be a member of a structure. There are thr

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

2023-02-10 Thread Qing Zhao via Gcc-patches
These are the 3rd 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

[GCC 13][PATCH] PR101836: Add a new option -fstrict-flex-array[=n] and use it in __builtin_object_size

2022-06-27 Thread Qing Zhao via Gcc-patches
Hi, Per our discussion in the bug report, I came up with the following patch: === PR101836: Add a new option -fstrict-flex-array[=n] Add the new option and use it in __builtin_object_size. Treat the trailing array of a structure as a flexible array member in a stricter way. The value of

Re: [GCC 13][PATCH] PR101836: Add a new option -fstrict-flex-array[=n] and use it in __builtin_object_size

2022-06-28 Thread Qing Zhao via Gcc-patches
Hi, Richard, > On Jun 28, 2022, at 3:16 AM, Richard Biener > wrote: > > On Mon, Jun 27, 2022 at 4:20 PM Qing Zhao via Gcc-patches > wrote: >> >> Hi, >> >> Per our discussion in the bug report, I came up with the following patch: >> >>

Re: [GCC 13][PATCH] PR101836: Add a new option -fstrict-flex-array[=n] and use it in __builtin_object_size

2022-06-28 Thread Qing Zhao via Gcc-patches
> On Jun 28, 2022, at 11:08 AM, Jakub Jelinek wrote: > > On Tue, Jun 28, 2022 at 03:03:12PM +0000, Qing Zhao wrote: >> 2. Then replace all “array_at_struct_end_p” with using DECL_NOT_FLEXARRAY in >> GCC, adding new testing cases > > No, IMHO array_at_struct_end_p s

Re: [GCC 13][PATCH] PR101836: Add a new option -fstrict-flex-array[=n] and use it in __builtin_object_size

2022-06-28 Thread Qing Zhao via Gcc-patches
> On Jun 28, 2022, at 12:43 PM, Jakub Jelinek wrote: > > On Tue, Jun 28, 2022 at 03:59:22PM +0000, Qing Zhao via Gcc-patches wrote: >>> On Jun 28, 2022, at 11:08 AM, Jakub Jelinek wrote: >>> >>> On Tue, Jun 28, 2022 at 03:03:12PM +, Qing

Re: [GCC 13][PATCH] PR101836: Add a new option -fstrict-flex-array[=n] and use it in __builtin_object_size

2022-06-28 Thread Qing Zhao via Gcc-patches
> On Jun 28, 2022, at 2:22 PM, Jakub Jelinek wrote: > > On Tue, Jun 28, 2022 at 06:15:58PM +0000, Qing Zhao wrote: >>> Because the flag just tells whether some array shouldn't be treated as >>> (poor man's) >>> flexible array member. We still ne

Re: [GCC 13][PATCH] PR101836: Add a new option -fstrict-flex-array[=n] and use it in __builtin_object_size

2022-06-28 Thread Qing Zhao via Gcc-patches
> On Jun 28, 2022, at 2:49 PM, Jakub Jelinek wrote: > > On Tue, Jun 28, 2022 at 06:29:01PM +0000, Qing Zhao wrote: >> >> >>> On Jun 28, 2022, at 2:22 PM, Jakub Jelinek wrote: >>> >>> On Tue, Jun 28, 2022 at 06:15:58PM +, Qing Zhao wrote

Re: [GCC 13][PATCH] PR101836: Add a new option -fstrict-flex-array[=n] and use it in __builtin_object_size

2022-06-29 Thread Qing Zhao via Gcc-patches
Hi, Jakub and Joseph: > On Jun 28, 2022, at 12:43 PM, Jakub Jelinek wrote: > > On Tue, Jun 28, 2022 at 03:59:22PM +0000, Qing Zhao via Gcc-patches wrote: >>> On Jun 28, 2022, at 11:08 AM, Jakub Jelinek wrote: >>> >>> On Tue, Jun 28, 2022 at 03:03:12PM

Re: [RFC][patch for gcc12][version 1] add -ftrivial-auto-var-init and variable attribute "uninitialized" to gcc

2021-03-11 Thread Qing Zhao via Gcc-patches
ote: > > On Thu, Feb 25, 2021 at 05:56:38PM -0600, Qing Zhao wrote: >> Just noticed that you didn’t add -fauto-var-init-approach=D to the command >> line. > > Ah-ha! I didn't realize that was needed; thanks. However, now some of the > sources crash in a different way

Re: [RFC][patch for gcc12][version 1] add -ftrivial-auto-var-init and variable attribute "uninitialized" to gcc

2021-03-12 Thread Qing Zhao via Gcc-patches
> On Mar 11, 2021, at 6:46 PM, Kees Cook wrote: > > On Thu, Mar 11, 2021 at 03:47:17PM -0600, Qing Zhao wrote: >> Hi, Kees, >> >> Sorry for the late reply (I have been busy with other work recently). >> >> Currently, I am working on the issue of flex

Re: [RFC][patch for gcc12][version 1] add -ftrivial-auto-var-init and variable attribute "uninitialized" to gcc

2021-03-12 Thread Qing Zhao via Gcc-patches
Hi, Kees, I am looking at the structure padding initialization issue. And also have some questions: > On Feb 24, 2021, at 10:41 PM, Kees Cook wrote: > > It looks like there is still some issues with padding and pre-case > switch variables. Here's the test output, FWIW: > > > test_stackinit:

Re: [RFC][patch for gcc12][version 1] add -ftrivial-auto-var-init and variable attribute "uninitialized" to gcc

2021-03-15 Thread Qing Zhao via Gcc-patches
(CC’ing gcc-patch alias). Hi, Kees, > On Mar 12, 2021, at 3:55 PM, Kees Cook wrote: > > On Fri, Mar 12, 2021 at 03:35:28PM -0600, Qing Zhao wrote: >> Hi, Kees, >> >> I am looking at the structure padding initialization issue. And also have >> some questions

Re: [PATCH] testsuite: Disable zero-scratch-regs-{8, 9, 10, 11}.c on s390* [PR97680]

2021-03-31 Thread Qing Zhao via Gcc-patches
Yes, basically, I agreed with Eric. One of the major reason to intentionally put these testing cases under c-c++-common is to fail them by default on the platforms that do not support this feature yet. Then the platform maintainer could decide whether to complete this feature on the specif

Re: [patch for gcc12 stage1][version 2] add -ftrivial-auto-var-init and variable attribute "uninitialized" to gcc

2021-04-07 Thread Qing Zhao via Gcc-patches
Ping > On Mar 24, 2021, at 4:21 PM, Qing Zhao via Gcc-patches > wrote: > > Hi, > > This is the 2nd version of the patch for the new security feature for GCC. > > Could you please take a look at it and let me know any comments and issues. > > Thanks. > >

Re: [patch for gcc12 stage1][version 2] add -ftrivial-auto-var-init and variable attribute "uninitialized" to gcc

2021-04-08 Thread Qing Zhao via Gcc-patches
Hi, Kees, Thanks a lot for your testing on the linux kernel, I am so happy that this time it works well. > On Apr 7, 2021, at 5:19 PM, Kees Cook wrote: > > On Wed, Mar 24, 2021 at 04:21:49PM -0500, Qing Zhao wrote: >> This is the 2nd version of the patch for the new security

Re: [PATCH][version 3]add -ftrivial-auto-var-init and variable attribute "uninitialized" to gcc

2021-06-14 Thread Qing Zhao via Gcc-patches
Hi, Richard: On Jun 11, 2021, at 10:49 AM, Qing Zhao via Gcc-patches mailto:gcc-patches@gcc.gnu.org>> wrote: On May 26, 2021, at 6:18 AM, Richard Biener mailto:rguent...@suse.de>> wrote: +/* Expand the IFN_DEFERRED_INIT function according to its second argument. */

Re: [PATCH][version 3]add -ftrivial-auto-var-init and variable attribute "uninitialized" to gcc

2021-06-15 Thread Qing Zhao via Gcc-patches
Hi, Richard, > On Jun 15, 2021, at 8:21 AM, Richard Biener wrote: >> >> >> +/* Expand the IFN_DEFERRED_INIT function according to its second >> argument. */ >> +static void >> +expand_DEFERRED_INIT (internal_fn, gcall *stmt) >> +{ >> + tree var = gimple_call_lhs (stmt); >> + tree init = NUL

Re: [PATCH][version 3]add -ftrivial-auto-var-init and variable attribute "uninitialized" to gcc

2021-06-16 Thread Qing Zhao via Gcc-patches
Hi, Richard, On Jun 16, 2021, at 1:19 AM, Richard Biener mailto:rguent...@suse.de>> wrote: +/* Expand the IFN_DEFERRED_INIT function according to its second argument. */ +static void +expand_DEFERRED_INIT (internal_fn, gcall *stmt) +{ + tree var = gimple_call_lhs (stmt); + tree init = NULL_TR

Re: [PATCH][version 3]add -ftrivial-auto-var-init and variable attribute "uninitialized" to gcc

2021-06-16 Thread Qing Zhao via Gcc-patches
So, the major question now is: Is one single repeatable pattern enough for pattern initialization for all different types of auto variables? If YES, then the implementation for pattern initialization will be much easier and simpler as you pointed out. And will save me a lot of pain to imp

Re: [PATCH][version 3]add -ftrivial-auto-var-init and variable attribute "uninitialized" to gcc

2021-06-21 Thread Qing Zhao via Gcc-patches
HI, Richard, > On Jun 21, 2021, at 2:53 AM, Richard Biener wrote: > >> >> >> This is for the compatibility with CLANG. -:). >> (https://reviews.llvm.org/D54604) > > I don't care about functional 1:1 "compatibility" with CLANG. Okay. -:) > >> 1. Pattern initialization >> >> This is the

Re: [PATCH][version 3]add -ftrivial-auto-var-init and variable attribute "uninitialized" to gcc

2021-06-21 Thread Qing Zhao via Gcc-patches
Hi, Kees, On Jun 18, 2021, at 6:47 PM, Kees cook mailto:keesc...@chromium.org>> wrote: On Wed, Jun 16, 2021 at 07:39:02PM +, Qing Zhao wrote: So, the major question now is: Is one single repeatable pattern enough for pattern initialization for all different types of auto variable

Re: [PATCH][version 3]add -ftrivial-auto-var-init and variable attribute "uninitialized" to gcc

2021-06-21 Thread Qing Zhao via Gcc-patches
> On Jun 21, 2021, at 10:35 AM, Richard Biener wrote: >>> I think we can drop -fauto-var-init=pattern and just go with block >>> initializing which will cover padding as well which means we can >>> stay with the odd -ftrivial-auto-var-init name used by CLANG and >>> add no additional options. >>

Re: [PATCH][version 3]add -ftrivial-auto-var-init and variable attribute "uninitialized" to gcc

2021-06-21 Thread Qing Zhao via Gcc-patches
> On Jun 21, 2021, at 11:18 AM, Kees Cook wrote: > > On Mon, Jun 21, 2021 at 03:39:45PM +0000, Qing Zhao wrote: >> So, if “pattern value” is “0x”, then it’s a valid canonical >> virtual memory address. However, for most OS, “0x” should &g

Re: [PATCH][version 3]add -ftrivial-auto-var-init and variable attribute "uninitialized" to gcc

2021-06-22 Thread Qing Zhao via Gcc-patches
ichard Sandiford wrote: Kees Cook mailto:keesc...@chromium.org>> writes: On Mon, Jun 21, 2021 at 03:39:45PM +0000, Qing Zhao wrote: So, if “pattern value” is “0x”, then it’s a valid canonical virtual memory address. However, for most OS, “0x” should be not i

Re: [PATCH][version 3]add -ftrivial-auto-var-init and variable attribute "uninitialized" to gcc

2021-06-22 Thread Qing Zhao via Gcc-patches
> On Jun 22, 2021, at 9:00 AM, Richard Biener wrote: > > On Tue, 22 Jun 2021, Qing Zhao wrote: > >> So, I am wondering why not still keep my current implementation on >> assign different patterns for different types? >> >> This major issue with this

Re: [PATCH][version 3]add -ftrivial-auto-var-init and variable attribute "uninitialized" to gcc

2021-06-22 Thread Qing Zhao via Gcc-patches
> On Jun 22, 2021, at 9:15 AM, Richard Biener wrote: > > On Tue, 22 Jun 2021, Qing Zhao wrote: > >> >> >>> On Jun 22, 2021, at 9:00 AM, Richard Biener wrote: >>> >>> On Tue, 22 Jun 2021, Qing Zhao wrote: >>> >>>

Re: [PATCH][version 3]add -ftrivial-auto-var-init and variable attribute "uninitialized" to gcc

2021-06-22 Thread Qing Zhao via Gcc-patches
22, 2021 at 09:25:57AM +0100, Richard Sandiford wrote: >>> Kees Cook writes: >>>> On Mon, Jun 21, 2021 at 03:39:45PM +, Qing Zhao wrote: >>>>> So, if “pattern value” is “0x”, then it’s a valid >>>>> canonical virtual memory

HELP!! How to inhibit optimizations applied to .DEFERRED_INIT argument?

2021-06-29 Thread Qing Zhao via Gcc-patches
Hi, I am testing the 4th patch of -ftrivial-auto-var-init with CPU2017 today, and found the following issues: In the dump file of “*t.i.031t.objsz1”, we have: : __s1_len_217 = .DEFERRED_INIT (__s1_len_176, 2); __s2_len_218 = .DEFERRED_INIT (__s2_len_177, 2); __s2_len_219 = 7; if (

Re: HELP!! How to inhibit optimizations applied to .DEFERRED_INIT argument?

2021-06-30 Thread Qing Zhao via Gcc-patches
On Jun 30, 2021, at 2:46 AM, Richard Biener mailto:rguent...@suse.de>> wrote: On Wed, 30 Jun 2021, Qing Zhao wrote: Hi, I am testing the 4th patch of -ftrivial-auto-var-init with CPU2017 today, and found the following issues: In the dump file of “*t.i.031t.objsz1”, w

Re: HELP!! How to inhibit optimizations applied to .DEFERRED_INIT argument?

2021-06-30 Thread Qing Zhao via Gcc-patches
> On Jun 30, 2021, at 9:39 AM, Richard Biener wrote: > > On Wed, 30 Jun 2021, Qing Zhao wrote: > >> >> >> On Jun 30, 2021, at 2:46 AM, Richard Biener >> mailto:rguent...@suse.de>> wrote: >> >> On Wed, 30 Jun 2021, Qing Zhao wrote: >

Re: HELP!! How to inhibit optimizations applied to .DEFERRED_INIT argument?

2021-06-30 Thread Qing Zhao via Gcc-patches
bug ? Qing > On Jun 30, 2021, at 9:39 AM, Richard Biener wrote: > > On Wed, 30 Jun 2021, Qing Zhao wrote: > >> >> >> On Jun 30, 2021, at 2:46 AM, Richard Biener >> mailto:rguent...@suse.de>> wrote: >> >> On Wed, 30 Jun 2021, Qing Zhao wro

Re: HELP!! How to inhibit optimizations applied to .DEFERRED_INIT argument?

2021-06-30 Thread Qing Zhao via Gcc-patches
Hi, Andrew, Thanks a lot for your explanation. On Jun 30, 2021, at 12:20 PM, Andrew Pinski mailto:pins...@gmail.com>> wrote: On Wed, Jun 30, 2021 at 8:47 AM Qing Zhao via Gcc-patches mailto:gcc-patches@gcc.gnu.org>> wrote: I came up with a very simple testing case that can rep

Re: HELP!! How to inhibit optimizations applied to .DEFERRED_INIT argument?

2021-06-30 Thread Qing Zhao via Gcc-patches
> On Jun 30, 2021, at 12:36 PM, Richard Biener wrote: > > On June 30, 2021 7:20:18 PM GMT+02:00, Andrew Pinski > wrote: >> On Wed, Jun 30, 2021 at 8:47 AM Qing Zhao via Gcc-patches >> wrote: >>> >>> I came up with a very simple test

Re: HELP!! How to inhibit optimizations applied to .DEFERRED_INIT argument?

2021-06-30 Thread Qing Zhao via Gcc-patches
<0(2), i_15(3)> if (i_2 < a_9(D)) goto ; [INV] else goto ; [INV] : return; } The constant “4” is propagated to the call to “ART_INIT”. This looks incorrect. Right? Qing On Jun 30, 2021, at 1:07 PM, Qing Zhao via Gcc-patches mailto:gcc-patches@gcc.gnu.org>> wr

Re: HELP!! How to inhibit optimizations applied to .DEFERRED_INIT argument?

2021-06-30 Thread Qing Zhao via Gcc-patches
> On Jun 30, 2021, at 1:59 PM, Richard Biener wrote: > > On June 30, 2021 8:07:43 PM GMT+02:00, Qing Zhao wrote: >> >> >>> On Jun 30, 2021, at 12:36 PM, Richard Biener >> wrote: >>> >>> On June 30, 2021 7:20:18 PM GMT+02:00, Andrew

Re: HELP!! How to inhibit optimizations applied to .DEFERRED_INIT argument?

2021-06-30 Thread Qing Zhao via Gcc-patches
> On Jun 30, 2021, at 1:59 PM, Richard Biener wrote: > > On June 30, 2021 8:07:43 PM GMT+02:00, Qing Zhao wrote: >> >> >>> On Jun 30, 2021, at 12:36 PM, Richard Biener >> wrote: >>> >>> On June 30, 2021 7:20:18 PM GMT+02:00, Andrew

Re: HELP!! How to inhibit optimizations applied to .DEFERRED_INIT argument?

2021-06-30 Thread Qing Zhao via Gcc-patches
Hi, Andrew: > On Jun 30, 2021, at 2:20 PM, Andrew Pinski wrote: > Then, where is the correct place for “.DEFERRED_INIT(size2,2)? The variable “size2” is a block scope variable which is declared inside the “if” condition: >>> >>> But that's obviously not how it beh

Re: HELP!! How to inhibit optimizations applied to .DEFERRED_INIT argument?

2021-07-01 Thread Qing Zhao via Gcc-patches
> On Jul 1, 2021, at 1:48 AM, Richard Biener wrote: > > On Wed, Jun 30, 2021 at 9:15 PM Qing Zhao via Gcc-patches > wrote: >> >> >> >>> On Jun 30, 2021, at 1:59 PM, Richard Biener wrote: >>> >>> On June 30, 2021 8:07:43 PM GMT+

Re: HELP!! How to inhibit optimizations applied to .DEFERRED_INIT argument?

2021-07-01 Thread Qing Zhao via Gcc-patches
> On Jul 1, 2021, at 9:04 AM, Richard Biener wrote: > > On Thu, Jul 1, 2021 at 3:45 PM Qing Zhao wrote: >> >> >> >>> On Jul 1, 2021, at 1:48 AM, Richard Biener >>> wrote: >>> >>> On Wed, Jun 30, 2021 at 9:15 PM Qing Zha

Re: HELP!! How to inhibit optimizations applied to .DEFERRED_INIT argument?

2021-07-01 Thread Qing Zhao via Gcc-patches
> On Jul 1, 2021, at 9:09 AM, Richard Sandiford > wrote: > > Qing Zhao writes: >>> On Jul 1, 2021, at 1:48 AM, Richard Biener >>> wrote: >>> >>> On Wed, Jun 30, 2021 at 9:15 PM Qing Zhao via Gcc-patches >>> wrote: >>>>

Re: HELP!! How to inhibit optimizations applied to .DEFERRED_INIT argument?

2021-07-01 Thread Qing Zhao via Gcc-patches
Hi, Michael, > On Jul 1, 2021, at 9:40 AM, Michael Matz wrote: > > Hello, > > I haven't followed this thread too closely, in particular I haven't seen > why the current form of the .DEFERRED_INIT call was chosen or suggested, > but it triggered my "well, that's obviously wrong" gut feeling; s

Re: HELP!! How to inhibit optimizations applied to .DEFERRED_INIT argument?

2021-07-01 Thread Qing Zhao via Gcc-patches
Hi, Richard, > On Jul 1, 2021, at 11:23 AM, Richard Sandiford > wrote: > > Michael Matz writes: >> Hello, >> >> On Thu, 1 Jul 2021, Richard Sandiford wrote: >> >>> Well, it does feel like this is pressing the reset button on a thread >>> whose message count is already in the high double figu

Re: [PATCH 2/2] Add a new warning option -Wstrict-flex-arrays.

2022-11-18 Thread Qing Zhao via Gcc-patches
AM, Richard Biener wrote: > > On Tue, 8 Nov 2022, Qing Zhao wrote: > >> '-Wstrict-flex-arrays' >> Warn about inproper usages of flexible array members according to >> the LEVEL of the 'strict_flex_array (LEVEL)' attribute attached to >

Re: [PATCH 2/2] Add a new warning option -Wstrict-flex-arrays.

2022-11-21 Thread Qing Zhao via Gcc-patches
> On Nov 18, 2022, at 11:31 AM, Kees Cook wrote: > > On Fri, Nov 18, 2022 at 03:19:07PM +0000, Qing Zhao wrote: >> Hi, Richard, >> >> Honestly, it’s very hard for me to decide what’s the best way to handle the >> interaction >> between -fs

Re: [PATCH 2/2] Add a new warning option -Wstrict-flex-arrays.

2022-11-22 Thread Qing Zhao via Gcc-patches
> On Nov 22, 2022, at 3:16 AM, Richard Biener wrote: > > On Mon, 21 Nov 2022, Qing Zhao wrote: > >> >> >>> On Nov 18, 2022, at 11:31 AM, Kees Cook wrote: >>> >>> On Fri, Nov 18, 2022 at 03:19:07PM +, Qing Zhao wrote: >>>

Re: [PATCH 2/2] Add a new warning option -Wstrict-flex-arrays.

2022-11-22 Thread Qing Zhao via Gcc-patches
> On Nov 22, 2022, at 9:10 AM, Qing Zhao via Gcc-patches > wrote: > > > >> On Nov 22, 2022, at 3:16 AM, Richard Biener wrote: >> >> On Mon, 21 Nov 2022, Qing Zhao wrote: >> >>> >>> >>>> On Nov 18, 2022, at 11:31 AM,

[V2][PATCH 0/1]Add a new warning option -Wstrict-flex-arrays

2022-11-30 Thread Qing Zhao via Gcc-patches
Hi, this is the 2nd version for this patch. Per our discussion, I made the following change compared to the first version: 1. The level of -Warray-bounds will NOT control how a trailing array is considered as a flex array member anymore. Only the level of -fstrict-flex-arrays will contro

[V2][PATCH 1/1] Add a new warning option -Wstrict-flex-arrays.

2022-11-30 Thread Qing Zhao via Gcc-patches
'-Wstrict-flex-arrays' Warn about inproper usages of flexible array members according to the LEVEL of the 'strict_flex_array (LEVEL)' attribute attached to the trailing array field of a structure if it's available, otherwise according to the LEVEL of the option '-fstrict-fl

Re: [V2][PATCH 1/1] Add a new warning option -Wstrict-flex-arrays.

2022-12-01 Thread Qing Zhao via Gcc-patches
> On Dec 1, 2022, at 11:42 AM, Kees Cook wrote: > > On Wed, Nov 30, 2022 at 02:25:56PM +0000, Qing Zhao wrote: >> '-Wstrict-flex-arrays' >> Warn about inproper usages of flexible array members according to >> the LEVEL of the 'strict_flex_array

Re: [V2][PATCH 1/1] Add a new warning option -Wstrict-flex-arrays.

2022-12-01 Thread Qing Zhao via Gcc-patches
ote: > > On Thu, Dec 01, 2022 at 05:04:02PM +0000, Qing Zhao wrote: >> >> >>> On Dec 1, 2022, at 11:42 AM, Kees Cook wrote: >>> >>> On Wed, Nov 30, 2022 at 02:25:56PM +, Qing Zhao wrote: >>>> '-Wstrict-flex-arrays' >

Re: [V2][PATCH 1/1] Add a new warning option -Wstrict-flex-arrays.

2022-12-01 Thread Qing Zhao via Gcc-patches
esh Poyarekar wrote: > > On 2022-12-01 11:42, Kees Cook wrote: >> On Wed, Nov 30, 2022 at 02:25:56PM +, Qing Zhao wrote: >>> '-Wstrict-flex-arrays' >>> Warn about inproper usages of flexible array members according to >>> the LEVEL of the

Re: [V2][PATCH 1/1] Add a new warning option -Wstrict-flex-arrays.

2022-12-02 Thread Qing Zhao via Gcc-patches
> On Dec 2, 2022, at 2:16 AM, Richard Biener wrote: > > On Thu, 1 Dec 2022, Siddhesh Poyarekar wrote: > >> On 2022-12-01 11:42, Kees Cook wrote: >>> On Wed, Nov 30, 2022 at 02:25:56PM +, Qing Zhao wrote: >>>> '-Wstrict-flex-arrays' >&

Re: [V2][PATCH 1/1] Add a new warning option -Wstrict-flex-arrays.

2022-12-02 Thread Qing Zhao via Gcc-patches
> On Dec 2, 2022, at 2:20 AM, Richard Biener wrote: > > On Fri, 2 Dec 2022, Richard Biener wrote: > >> On Thu, 1 Dec 2022, Siddhesh Poyarekar wrote: >> >>> On 2022-12-01 11:42, Kees Cook wrote: >>>> On Wed, Nov 30, 2022 at 02:25:56PM +,

Re: [V2][PATCH 1/1] Add a new warning option -Wstrict-flex-arrays.

2022-12-05 Thread Qing Zhao via Gcc-patches
> On Dec 5, 2022, at 10:16 AM, Richard Biener wrote: > > On Fri, 2 Dec 2022, Qing Zhao wrote: > >> >> >>> On Dec 2, 2022, at 2:20 AM, Richard Biener wrote: >>> >>> On Fri, 2 Dec 2022, Richard Biener wrote: >>> >>>>

[V3][PATCH 0/2]Update -Warray-bounds with -fstrict-flex-arrays

2022-12-06 Thread Qing Zhao via Gcc-patches
Hi, this is the 3rd version of the patch. Per Richard's request, I split the patch into two seperate patches: 1. Update -Warray-bounds with -fstrict-flex-arrays. 2. Add a new warning option -Wstrict-flex-arrays. I have bootstrapped and regression tested on both X86 and aarch64 without any issu

[V3][PATCH 1/2] Update -Warray-bounds with -fstrict-flex-arrays.

2022-12-06 Thread Qing Zhao via Gcc-patches
A. add the following to clarify the relationship between -Warray-bounds and the LEVEL of -fstrict-flex-array: By default, the trailing array of a structure will be treated as a flexible array member by '-Warray-bounds' or '-Warray-bounds=N' if it is declared as either a

[V2][PATCH 1/1] Add a new warning option -Wstrict-flex-arrays.

2022-12-06 Thread Qing Zhao via Gcc-patches
'-Wstrict-flex-arrays' Warn about inproper usages of flexible array members according to the LEVEL of the 'strict_flex_array (LEVEL)' attribute attached to the trailing array field of a structure if it's available, otherwise according to the LEVEL of the option '-fstrict-fl

Re: [V2][PATCH 1/1] Add a new warning option -Wstrict-flex-arrays.

2022-12-06 Thread Qing Zhao via Gcc-patches
Sorry, Please ignore this email. Qing > On Dec 6, 2022, at 11:14 AM, Qing Zhao wrote: > > '-Wstrict-flex-arrays' > Warn about inproper usages of flexible array members according to > the LEVEL of the 'strict_flex_array (LEVEL)' attribute attached to

[V3][PATCH 2/2] Add a new warning option -Wstrict-flex-arrays.

2022-12-06 Thread Qing Zhao via Gcc-patches
'-Wstrict-flex-arrays' Warn about inproper usages of flexible array members according to the LEVEL of the 'strict_flex_array (LEVEL)' attribute attached to the trailing array field of a structure if it's available, otherwise according to the LEVEL of the option '-fstrict-fl

Re: [Patch]Enable -Wuninitialized + -ftrivial-auto-var-init for address taken variables

2021-12-14 Thread Qing Zhao via Gcc-patches
Hi, > On Dec 9, 2021, at 12:13 PM, Qing Zhao via Gcc-patches > wrote: >> >>> + return; >>> + >>> + /* Get the variable declaration location from the def_stmt. */ >>> + var_decl_loc = gimple_location (def_stmt); >>> + >

Re: [Patch]Enable -Wuninitialized + -ftrivial-auto-var-init for address taken variables

2021-12-15 Thread Qing Zhao via Gcc-patches
> On Dec 14, 2021, at 4:06 PM, Martin Sebor wrote: > > Dynamically creating the string seems quite cumbersome here, and it leaks the allocated block. I wonder if it might be better to remove the gmsgid argument from the function and assign it to one of the litera

Re: [Patch]Enable -Wuninitialized + -ftrivial-auto-var-init for address taken variables

2021-12-16 Thread Qing Zhao via Gcc-patches
> On Dec 15, 2021, at 11:33 AM, Qing Zhao via Gcc-patches > wrote: > > > >> On Dec 14, 2021, at 4:06 PM, Martin Sebor wrote: >> >>>>>> >>>>> >>>>> Dynamically creating the string seems quite cumbersome here,

[Patch][V2]Enable -Wuninitialized + -ftrivial-auto-var-init for address taken variables

2021-12-16 Thread Qing Zhao via Gcc-patches
Hi, This is the 2nd version of the patch. The original patch is at: https://gcc.gnu.org/pipermail/gcc-patches/2021-December/586341.html In addition to resolve the two issues mentioned in the original patch, This patch also can be used as a very good workaround for the issue in PR103720 https://g

Patch Ping : [Patch][V2]Enable -Wuninitialized + -ftrivial-auto-var-init for address taken variables

2022-01-04 Thread Qing Zhao via Gcc-patches
Hi, I’d like to ping the patch: https://gcc.gnu.org/pipermail/gcc-patches/2021-December/587014.html Please take a look and let me know whether it’s okay for committing? Thanks. Qing > On Dec 16, 2021, at 9:59 AM, Qing Zhao via Gcc-patches > wrote: > > Hi, > > This is

Re: [Patch][V2]Enable -Wuninitialized + -ftrivial-auto-var-init for address taken variables

2022-01-05 Thread Qing Zhao via Gcc-patches
Hi, Richard, Thanks a lot for the review and questions. See my reply embedded below: > On Jan 5, 2022, at 4:33 AM, Richard Biener wrote: > > On Thu, Dec 16, 2021 at 5:00 PM Qing Zhao wrote: >> >> Hi, >> >> This is the 2nd version of the patch. >>

Re: [Patch][V2]Enable -Wuninitialized + -ftrivial-auto-var-init for address taken variables

2022-01-07 Thread Qing Zhao via Gcc-patches
> On Jan 5, 2022, at 10:59 AM, Qing Zhao via Gcc-patches > wrote: > > Hi, Richard, > > Thanks a lot for the review and questions. > See my reply embedded below: > > >> On Jan 5, 2022, at 4:33 AM, Richard Biener >> wrote: >> >&g

[Patch][V3][Patch 1/2]Change the 3rd parameter of function .DEFERRED_INIT from IS_VLA to decl name

2022-01-10 Thread Qing Zhao via Gcc-patches
uses. In order to improve such situation, changing the 3rd parameter of the function .DEFERRED_INIT to the name string of the variable will provide necessary information to uninitialized warning analysis to make the missing warning possible. gcc/ChangeLog: 2022-01-10 qing zhao

[Patch][V3][Patch 2/2]Enable -Wuninitialized + -ftrivial-auto-var-init for address taken variables.

2022-01-10 Thread Qing Zhao via Gcc-patches
gs + -ftrivial-auto-var-init are adjusted to reflect the fact that we can issue warnings for address taken variables. gcc/ChangeLog: 2022-01-10 qing zhao * tree-ssa-uninit.c (warn_uninit): Handle .DEFERRED_INIT call with an anonymous SSA_NAME specially. (ch

Re: [Patch][V3][Patch 1/2]Change the 3rd parameter of function .DEFERRED_INIT from IS_VLA to decl name

2022-01-11 Thread Qing Zhao via Gcc-patches
> On Jan 11, 2022, at 7:53 AM, Richard Biener > wrote: > > On Tue, Jan 11, 2022 at 12:58 AM Qing Zhao wrote: >> >> Hi, Richard, >> >> I splited the previous patch for “Enable -Wuninitialized + >> -ftrivial-auto-var-init for address taken variabl

Re: [Patch][V2]Enable -Wuninitialized + -ftrivial-auto-var-init for address taken variables

2022-01-11 Thread Qing Zhao via Gcc-patches
Hi, Richard, > On Jan 11, 2022, at 7:43 AM, Richard Biener > wrote: > 1. Add some meaningful temporaries to break the long expression to make it Readable. And also add comments to explain the purpose of the statement; 2. Resolve the memory leakage of the dy

Re: [Patch][V3][Patch 1/2]Change the 3rd parameter of function .DEFERRED_INIT from IS_VLA to decl name

2022-01-11 Thread Qing Zhao via Gcc-patches
FYI. Just committed this patch to gcc12 as: https://gcc.gnu.org/pipermail/gcc-cvs/2022-January/359118.html Qing > On Jan 11, 2022, at 9:38 AM, Qing Zhao via Gcc-patches > wrote: > > > >> On Jan 11, 2022, at 7:53 AM, Richard Biener >> wrote: >> >>

Re: [Patch][V2]Enable -Wuninitialized + -ftrivial-auto-var-init for address taken variables

2022-01-12 Thread Qing Zhao via Gcc-patches
> On Jan 12, 2022, at 4:46 AM, Richard Biener > wrote: > > On Tue, Jan 11, 2022 at 5:32 PM Qing Zhao wrote: >> >>>>> + /* Ignore the call to .DEFERRED_INIT that define the original >>>>> +var itself.

[Patch][V4][Patch 2/2]Enable -Wuninitialized + -ftrivial-auto-var-init for address taken variables.

2022-01-12 Thread Qing Zhao via Gcc-patches
ss warning messages when needed; The current testing cases for uninitialized warnings + -ftrivial-auto-var-init are adjusted to reflect the fact that we can issue warnings for address taken variables. gcc/ChangeLog: 2022-01-12 qing zhao * tree-ssa-uninit.c (warn_uninit): Handle .DEFERRE

Re: [Patch][V4][Patch 2/2]Enable -Wuninitialized + -ftrivial-auto-var-init for address taken variables.

2022-01-14 Thread Qing Zhao via Gcc-patches
> On Jan 14, 2022, at 12:58 PM, Martin Sebor wrote: > > On 1/14/22 11:29, Qing Zhao wrote: >>> On Jan 14, 2022, at 12:11 PM, Martin Sebor wrote: >>> >>> On 1/14/22 09:30, Qing Zhao wrote: >>>>> On Jan 14, 2022, at 6:45 AM, Richard Biener

[Patch][V5][Patch 2/2]Enable -Wuninitialized + -ftrivial-auto-var-init for address taken variables.

2022-01-15 Thread Qing Zhao via Gcc-patches
or not to suppress warning messages when needed; The current testing cases for uninitialized warnings + -ftrivial-auto-var-init are adjusted to reflect the fact that we can issue warnings for address taken variables. gcc/ChangeLog: 2022-01-14 qing zhao * tree-ssa-uninit.c (warn_unin

Re: [Patch][V5][Patch 2/2]Enable -Wuninitialized + -ftrivial-auto-var-init for address taken variables.

2022-01-17 Thread Qing Zhao via Gcc-patches
Thanks. I just committed the patch to gcc12 as: https://gcc.gnu.org/pipermail/gcc-cvs/2022-January/359400.html Qing > On Jan 17, 2022, at 5:36 AM, Richard Biener > wrote: > > On Sat, Jan 15, 2022 at 5:49 PM Qing Zhao wrote: >> >> Hi, Richard, >> >>

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

2023-03-16 Thread Qing Zhao via Gcc-patches
Hi, Recently, we discovered some floating point precision diffs when using GCC8 to build our application on arm64: After some investigation, it turns out that this is due to the -ffp-contract=fast option that is on by default. Therefore, we have to explicitly add -ffp-contract=off and do a f

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

2023-03-16 Thread Qing Zhao via Gcc-patches
> On Mar 16, 2023, at 12:31 PM, Andrew Pinski wrote: > > On Thu, Mar 16, 2023 at 9:25 AM Qing Zhao via Gcc-patches > wrote: >> >> Hi, >> >> Recently, we discovered some floating point precision diffs when using GCC8 >> to build our >> ap

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

2023-03-16 Thread Qing Zhao via Gcc-patches
> On Mar 16, 2023, at 12:53 PM, Jakub Jelinek wrote: > > On Thu, Mar 16, 2023 at 04:38:41PM +0000, Qing Zhao via Gcc-patches wrote: >>> NO. We have this debate every few years and such. >> >> So, what’s the major reason we keep the default that is not IEEE754 &

[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
rgs_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 Zha

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

2023-03-16 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 per -fstrict-flex-arrays. gcc/c/ChangeLog: PR tree-optimization/101832 * c-dec

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

2023-03-16 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: Should -ffp-contract=off the default on GCC?

2023-03-20 Thread Qing Zhao via Gcc-patches
Hi, > On Mar 16, 2023, at 12:53 PM, Jakub Jelinek wrote: > > On Thu, Mar 16, 2023 at 04:38:41PM +0000, Qing Zhao via Gcc-patches wrote: >>> NO. We have this debate every few years and such. >> >> So, what’s the major reason we keep the default that is not

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

2023-03-21 Thread Qing Zhao via Gcc-patches
Thanks a lot for the info. Qing > On Mar 20, 2023, at 6:25 PM, Jakub Jelinek wrote: > > On Mon, Mar 20, 2023 at 10:05:57PM +0000, Qing Zhao via Gcc-patches wrote: >> My question: is the above section the place in C standard “explicitly allows >> contractions”? If

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

2023-03-21 Thread Qing Zhao via Gcc-patches
> On Mar 20, 2023, at 6:25 PM, Jakub Jelinek wrote: > > On Mon, Mar 20, 2023 at 10:05:57PM +0000, Qing Zhao via Gcc-patches wrote: >> My question: is the above section the place in C standard “explicitly allows >> contractions”? If not, where it is in C standard? > &g

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

2023-03-21 Thread Qing Zhao via Gcc-patches
> On Mar 21, 2023, at 12:56 PM, Paul Koning wrote: > > > >> On Mar 21, 2023, at 11:01 AM, Qing Zhao via Gcc-patches >> wrote: >> >> ... >> Most of the compiler users are not familiar with language standards, or no >> access to language stan

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

2023-03-21 Thread Qing Zhao via Gcc-patches
> On Mar 21, 2023, at 1:59 PM, Jeff Law via Gcc-patches > wrote: > > > > On 3/21/23 11:00, Qing Zhao via Gcc-patches wrote: >>> On Mar 21, 2023, at 12:56 PM, Paul Koning wrote: >>> >>> >>> >>>> On

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

2023-03-21 Thread Qing Zhao via Gcc-patches
> On Mar 21, 2023, at 3:51 PM, Jeff Law wrote: > > > > On 3/21/23 13:01, Qing Zhao wrote: > >> The code previously worked now has some issue since we added some new stuff >> into standard, and the compiler added some new transformation based on this >>

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

2023-03-22 Thread Qing Zhao via Gcc-patches
> On Mar 22, 2023, at 8:33 AM, Alexander Monakov wrote: > > > On Mon, 20 Mar 2023, Jakub Jelinek via Gcc-patches wrote: > >> On Mon, Mar 20, 2023 at 10:05:57PM +, Qing Zhao via Gcc-patches wrote: >>> My question: is the above section the place in C st

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

2023-03-22 Thread Qing Zhao via Gcc-patches
> On Mar 22, 2023, at 9:57 AM, Richard Biener via Gcc-patches > wrote: > > On Wed, Mar 22, 2023 at 1:26 PM Alexander Monakov wrote: >> >> >> On Wed, 22 Mar 2023, Richard Biener wrote: >> >>> I think it's even less realistic to expect users to know the details of >>> floating-point math. S

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, 202

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

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 1/2] Handle component_ref to a structre/union field including flexible array member [PR101832] Date: March 16

<    9   10   11   12   13   14   15   >