Re: [PATCH][V2][middle-end/104550]Suppress uninitialized warnings for new created uses from __builtin_clear_padding folding

2022-02-25 Thread Qing Zhao
Hi, After more study of all the discussion so far and the corresponding code for suppress_warning, I think the following suggestion Should be the best approach right now for this issue: > SET_EXPR_LOCATION (tmp_dst, UNKNOWN_LOCATION); > suppress_warning (tmp_dst,

Re: [PATCH][V2][middle-end/104550]Suppress uninitialized warnings for new created uses from __builtin_clear_padding folding

2022-02-25 Thread Jakub Jelinek via Gcc-patches
On Fri, Feb 25, 2022 at 11:12:13AM +0100, Richard Biener wrote: > On Fri, 25 Feb 2022, Jakub Jelinek wrote: > > > On Fri, Feb 25, 2022 at 10:31:50AM +0100, Richard Biener wrote: > > > I think it's used as fallback for UNKNOWN_LOCATION, but if we "invent" > > > a creative location for the

Re: [PATCH][V2][middle-end/104550]Suppress uninitialized warnings for new created uses from __builtin_clear_padding folding

2022-02-25 Thread Richard Biener via Gcc-patches
On Fri, 25 Feb 2022, Jakub Jelinek wrote: > On Fri, Feb 25, 2022 at 10:31:50AM +0100, Richard Biener wrote: > > I think it's used as fallback for UNKNOWN_LOCATION, but if we "invent" > > a creative location for the artificial stmt it will of course > > affect other stmts/expressions using that

Re: [PATCH][V2][middle-end/104550]Suppress uninitialized warnings for new created uses from __builtin_clear_padding folding

2022-02-25 Thread Jakub Jelinek via Gcc-patches
On Fri, Feb 25, 2022 at 10:31:50AM +0100, Richard Biener wrote: > I think it's used as fallback for UNKNOWN_LOCATION, but if we "invent" > a creative location for the artificial stmt it will of course > affect other stmts/expressions using that location. > > > I think it will work. > > Yes, I

Re: [PATCH][V2][middle-end/104550]Suppress uninitialized warnings for new created uses from __builtin_clear_padding folding

2022-02-25 Thread Richard Biener via Gcc-patches
On Fri, 25 Feb 2022, Jakub Jelinek wrote: > On Fri, Feb 25, 2022 at 10:13:33AM +0100, Richard Biener via Gcc-patches > wrote: > > I meant > > > > /* Set the no_warning flag of STMT to NO_WARNING. */ > > > > static inline void > > gimple_set_no_warning (gimple *stmt, bool no_warning) > > { > >

Re: [PATCH][V2][middle-end/104550]Suppress uninitialized warnings for new created uses from __builtin_clear_padding folding

2022-02-25 Thread Jakub Jelinek via Gcc-patches
On Fri, Feb 25, 2022 at 10:13:33AM +0100, Richard Biener via Gcc-patches wrote: > I meant > > /* Set the no_warning flag of STMT to NO_WARNING. */ > > static inline void > gimple_set_no_warning (gimple *stmt, bool no_warning) > { > stmt->no_warning = (unsigned) no_warning; > } > > on the

Re: [PATCH][V2][middle-end/104550]Suppress uninitialized warnings for new created uses from __builtin_clear_padding folding

2022-02-25 Thread Richard Biener via Gcc-patches
On Fri, 25 Feb 2022, Jakub Jelinek wrote: > On Fri, Feb 25, 2022 at 08:11:40AM +0100, Richard Biener via Gcc-patches > wrote: > > On Thu, 24 Feb 2022, Qing Zhao wrote: > > > > > I briefly checked all the usages of suppress_warning within the current > > > gcc, > > > and see that most of them

Re: [PATCH][V2][middle-end/104550]Suppress uninitialized warnings for new created uses from __builtin_clear_padding folding

2022-02-25 Thread Jakub Jelinek via Gcc-patches
On Fri, Feb 25, 2022 at 08:11:40AM +0100, Richard Biener via Gcc-patches wrote: > On Thu, 24 Feb 2022, Qing Zhao wrote: > > > I briefly checked all the usages of suppress_warning within the current > > gcc, > > and see that most of them are not guarded by any condition. > > > > So, the

Re: [PATCH][V2][middle-end/104550]Suppress uninitialized warnings for new created uses from __builtin_clear_padding folding

2022-02-24 Thread Richard Biener via Gcc-patches
On Thu, 24 Feb 2022, Qing Zhao wrote: > I briefly checked all the usages of suppress_warning within the current gcc, > and see that most of them are not guarded by any condition. > > So, the current change should be fine without introducing new issues. -:) > > Another thing is, if we use

Re: [PATCH][V2][middle-end/104550]Suppress uninitialized warnings for new created uses from __builtin_clear_padding folding

2022-02-24 Thread Qing Zhao
I briefly checked all the usages of suppress_warning within the current gcc, and see that most of them are not guarded by any condition. So, the current change should be fine without introducing new issues. -:) Another thing is, if we use “warning_enable_at” to guard, I just checked, this

Re: [PATCH][V2][middle-end/104550]Suppress uninitialized warnings for new created uses from __builtin_clear_padding folding

2022-02-24 Thread Jakub Jelinek via Gcc-patches
On Thu, Feb 24, 2022 at 04:00:33PM +0100, Richard Biener wrote: > > > --- a/gcc/gimple-fold.cc > > > +++ b/gcc/gimple-fold.cc > > > @@ -4379,7 +4379,12 @@ clear_padding_flush (clear_padding_struct *buf, > > > bool full) > > > else > > > { > > > src = make_ssa_name

Re: [PATCH][V2][middle-end/104550]Suppress uninitialized warnings for new created uses from __builtin_clear_padding folding

2022-02-24 Thread Richard Biener via Gcc-patches
On Thu, 24 Feb 2022, Jakub Jelinek wrote: > On Thu, Feb 24, 2022 at 02:30:05PM +, Qing Zhao wrote: > > PR middle-end/104550 > > > > gcc/ChangeLog: > > > > * gimple-fold.cc (clear_padding_flush): Suppress warnings for new > > created uses. > > > > gcc/testsuite/ChangeLog: > > >

Re: [PATCH][V2][middle-end/104550]Suppress uninitialized warnings for new created uses from __builtin_clear_padding folding

2022-02-24 Thread Jakub Jelinek via Gcc-patches
On Thu, Feb 24, 2022 at 02:30:05PM +, Qing Zhao wrote: > PR middle-end/104550 > > gcc/ChangeLog: > > * gimple-fold.cc (clear_padding_flush): Suppress warnings for new > created uses. > > gcc/testsuite/ChangeLog: > > * gcc.dg/auto-init-pr104550-1.c: New test. >

[PATCH][V2][middle-end/104550]Suppress uninitialized warnings for new created uses from __builtin_clear_padding folding

2022-02-24 Thread Qing Zhao
Hi, This is the 2nd version for this bug per our discussion. Compared to the previous patch, this patch ONLY suppresses warnings for the fake read that was introduced with folding. The patch has been bootstrapped and regress tested on both x86 and aarch64. Okay for trunk? Thanks. Qing