diff options
author | Mikael Pettersson <[email protected]> | 2018-04-21 14:08:14 +0200 |
---|---|---|
committer | Mikael Pettersson <[email protected]> | 2018-04-21 14:08:14 +0200 |
commit | bd31798262cd20354e64cca8654b0781b33d7ede (patch) | |
tree | 1f2d3ec36e48bc9e1e4ba40e5f9cb1f6a88ece55 /make/cross_check_erl | |
parent | 0343b68b053ee97b2ef70ea07b9aa87e8842c591 (diff) | |
download | otp-bd31798262cd20354e64cca8654b0781b33d7ede.tar.gz otp-bd31798262cd20354e64cca8654b0781b33d7ede.tar.bz2 otp-bd31798262cd20354e64cca8654b0781b33d7ede.zip |
erl_interface: fix bad memset
Compiling OTP-20.3.4 with GCC-7 generates the following warning:
CC /tmp/otp_src_20.3.4/lib/erl_interface/obj.st/x86_64-unknown-linux-gnu/erl_marshal.o
legacy/erl_marshal.c: In function 'erl_init_marshal':
legacy/erl_marshal.c:110:5: warning: 'memset' used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
memset(cmp_array, 0, CMP_ARRAY_SIZE);
^~~~~~
CMP_ARRAY_SIZE (256) is the number of elements in that array, but the
elements are not char but enum, which is 4 bytes on e.g. x86-64.
This results in 3/4 of the array not being correctly initialized.
Idiomatic C is to pass sizeof cmp_array to memset(), so that's what I did.
Diffstat (limited to 'make/cross_check_erl')
0 files changed, 0 insertions, 0 deletions