[Bug middle-end/104550] bogus warning from -Wuninitialized + -ftrivial-auto-var-init=pattern

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Feb 17 16:53:42 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104550

--- Comment #15 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to qinzhao from comment #11)
> (In reply to Jakub Jelinek from comment #10)
> > Even in that case, filling the memory with pattern & mask instead of filling
> > the memory with pattern + __builtin_clear_padding afterwards seems like a
> > win.
> 
> So, you mean It's better to do the following for pattern init:
> 
> 1. add call to .DEFERRED_INIT(, pattern, ) during gimplification;
> 2. during RTL expansion, fill the memory with pattern & mask if the variable
> is in memory. 
> 
> how to implement "fill the memory with pattern & mask" during RTL expansion?
> currently, we use memset to fill the memory when the variable is in memory,
> pattern & mask might not fit to a BYTE-repeatable pattern that can be used
> for memset?

You can populate a buffer with the pattern and then clear_type_padding_in_mask.
Then you can create a STRING_CST out from that array and store_expr
(the_STRING_CST, DECL_RTL (var), false, false, false) - at least when DECL_RTL
(var) is a MEM.


More information about the Gcc-bugs mailing list