[Bug c++/104920] Unreliable results with memset-elt-size

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Mar 14 18:14:32 GMT 2022


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
There is nothing unreliable on the warning.  If it sees a memset call with an
base language array and size that constant evaluates to the number of array
elements and the array element has size > 1, it warns.
The warning is implemented in the FEs, so it can't see through functions that
would need to be inlined etc., it really requires the size to be constant
expression.
In some of your testcases, that is the case even when you use std:array, in
others it is not.


More information about the Gcc-bugs mailing list