File tree Expand file tree Collapse file tree
cpp/ql/test/query-tests/Likely Bugs/Arithmetic/UnsignedGEZero Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ template <typename T>
2+ bool sometimesPointless (T param) {
3+ return param >= 0 ; // GOOD (FALSE POSITIVE: hypothetical instantiations are okay)
4+ }
5+
6+ template <typename T>
7+ bool alwaysPointless (T param) {
8+ unsigned int local = param;
9+ return local >= 0 ; // BAD (in all instantiations)
10+ }
11+
12+ static int caller (int i) {
13+ return
14+ sometimesPointless<unsigned int >(i) ||
15+ alwaysPointless<unsigned int >(i) ||
16+ alwaysPointless<int >(i);
17+ }
Original file line number Diff line number Diff line change 1+ | Templates.cpp:3:10:3:19 | ... >= ... | Pointless comparison of unsigned value to zero. |
2+ | Templates.cpp:9:10:9:19 | ... >= ... | Pointless comparison of unsigned value to zero. |
3+ | Templates.cpp:9:10:9:19 | ... >= ... | Pointless comparison of unsigned value to zero. |
4+ | Templates.cpp:9:10:9:19 | ... >= ... | Pointless comparison of unsigned value to zero. |
15| UnsignedGEZero.c:40:6:40:12 | ... >= ... | Pointless comparison of unsigned value to zero. |
26| UnsignedGEZero.c:48:6:48:15 | ... >= ... | Pointless comparison of unsigned value to zero. |
37| UnsignedGEZero.c:54:6:54:12 | ... >= ... | Pointless comparison of unsigned value to zero. |
You can’t perform that action at this time.
0 commit comments