Re: Unjustified warning?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/15/2017 04:55 AM, Marcel Keller wrote:
The warning isn't caused by the explicit memset but rather by GCC
introducing one within the loop.  I'm not sure that the warning
itself should be considered a bug.  If the function is called with
length greater than or equal to 32 it will overflow.  So I'd say
the warning is helpful in pointing it out.  What's not helpful
is the missing location information, compounded by the fact that
the only memset call in the source code isn't what causes it.

To avoid the warning make sure foo() calls avx_memzero with
a length of at most the size of bar.

Thank you for the clarification. If I limit the length as in the code
attached, I still get the warning however.

To avoid writing past the end of bar length must be at most sizeof
bar:

  avx_memzero(bar, std::min (sizeof(bar), t));

Martin



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux