From: Nobuyoshi Nakada Date: 2013-10-11T01:56:02+09:00 Subject: [ruby-core:57817] Re: ruby-2.0.0-p247siphash.c:443: bug report (13/10/10 23:43), David Binderman wrote: > I just ran the static analysis tool cppcheck over the source code > of ruby-2.0.0-p247 > > It said > > [siphash.c:443] -> [siphash.c:445]: (warning) Variable 'last' is reassigned a value before the old one has been used. 'break;' missing? > [siphash.c:445] -> [siphash.c:447]: (warning) Variable 'last' is reassigned a value before the old one has been used. 'break;' missing? > [siphash.c:447] -> [siphash.c:460]: (warning) Variable 'last' is reassigned a value before the old one has been used. 'break;' missing? > [siphash.c:460] -> [siphash.c:462]: (warning) Variable 'last' is reassigned a value before the old one has been used. 'break;' missing? > [siphash.c:462] -> [siphash.c:464]: (warning) Variable 'last' is reassigned a value before the old one has been used. 'break;' missing? > > Source code is > > switch (len % sizeof(uint64_t)) { > case 7: > OR_BYTE(6); > case 6: > OR_BYTE(5); > case 5: > OR_BYTE(4); OR_BYTE() macro is defined as: #define OR_BYTE(n) (last |= ((uint64_t) end[n]) << ((n) * 8)) So 'last' is actually used before reassignment. Seems a flaw in cppcheck's analysis. -- Nobu Nakada