https://sourceware.org/bugzilla/show_bug.cgi?id=18273
Bug ID: 18273 Summary: cppcheck meets sim - five bugs Product: binutils Version: 2.26 (HEAD) Status: NEW Severity: normal Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: dcb314 at hotmail dot com I just ran static analyser cppcheck over the source code of the simulator in binutils. It said many things, but I think these are the most important. 1. [src/sim/bfin/bfin-sim.c:4320]: (style) Same expression on both sides of '&&'. Source code is else if ((aop == 0 || aop == 1 || aop == 2) && s == 1 && aopcde == 8 && x == 0 && s == 1 && HL == 0) Duplicate mention of s == 1. Suggest delete one. 2. [src/sim/erc32/exec.c:295]: (style) Same expression on both sides of '||'. *carry = result < n1 || result < n1; Maybe *carry = result < n1 || result < n2; 3. [src/sim/igen/misc.c:105]: (style) Same expression on both sides of '||'. if (strcmp (a, "false") == 0 || strcmp (a, "false") == 0) Maybe if (strcmp (a, "false") == 0 || strcmp (a, "FALSE") == 0) 4. [src/sim/igen/misc.c:121]: (style) Same expression on both sides of '||'. else if (a[1] == 'b' || a[1] == 'b') Maybe else if (a[1] == 'b' || a[1] == 'B') 5. [src/sim/rx/reg.c:256]: (warning) Logical disjunction always evaluates to true: id>= 1 || id <= 15. if (id>= 1 || id <= 15) Maybe if (id >= 1 && id <= 15) Ohter messages from cppcheck available on request. -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils