C, C++: New warning for memset without multiply by elt size

Bernd Schmidt bernds_cb1@t-online.de
Fri Apr 22 13:30:00 GMT 2016


We had this problem in the C frontend until very recently:

   int array[some_count];
   memset (array, 0, some_count);

which forgets to multiply by sizeof int. The following patch implements 
a new warning option for this.

Bootstrapped and tested (a while ago, will retest) on x86_64-linux. Ok 
for trunk?


Bernd
-------------- next part --------------
A non-text attachment was scrubbed...
Name: memset-warn.diff
Type: text/x-patch
Size: 8555 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20160422/559487e2/attachment.bin>


More information about the Gcc-patches mailing list