http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56966
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-04-15 17:34:20 UTC --- I don't think this is wrong code at all. The warning is correct for the code as given but wrong for memset in general. The code looks like: void set_offset_array(size_t left, size_t right, u_char offset) { ; ; size_t num_cards = right - left + 1; memset(&_offset_array[left], offset, num_cards); } .... num_cards is being turned into 0 which is fine in this case as optimization has happened. The problem is the memset code is just bogus when it tries to see if the length is 0.