Menu

#209 amacro.c:129: bad size in memset ?

v1.0 (example)
closed-fixed
nobody
None
5
2016-07-05
2016-06-16
dcb
No

amacro.c:129:5: warning: 'memset' used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]

Source code is

memset(math_op, GERBV_OPCODE_NOP, MATH_OP_STACK_SIZE);

but

gerbv_opcodes_t math_op[MATH_OP_STACK_SIZE];

Suggest new code

memset(math_op, GERBV_OPCODE_NOP, MATH_OP_STACK_SIZE * sizeof gerbv_opcodes_t);

Discussion

  • Sergey Alyoshin

    Sergey Alyoshin - 2016-06-16

    How about:
    - memset(math_op, GERBV_OPCODE_NOP, MATH_OP_STACK_SIZE);
    + memset(math_op, GERBV_OPCODE_NOP, sizeof(math_op));

    Please, replace "From:" field in attached patch.

     
  • Sergey Alyoshin

    Sergey Alyoshin - 2016-07-05
    • status: open --> closed-fixed
     
  • Sergey Alyoshin

    Sergey Alyoshin - 2016-07-05

    Fixed in git commit 4b332c7d1fc3181700fa1222f8cd75f8d42b6f47

     

Log in to post a comment.