...
The use of floating-point variables as loop counters can result in unexpected behavior .
Rule | Severity | Likelihood | Detectable | RepairableRemediation Cost | Priority | Level |
|---|---|---|---|---|---|---|
FLP30-C | Low | Probable | Yes | YesLow | P6 | L2 |
Automated Detection
Tool | Version | Checker | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Astrée |
| for-loop-float | Fully checked | ||||||
| Axivion Bauhaus Suite |
| CertC-FLP30 | Fully implemented | ||||||
| Clang |
| cert-flp30-c | Checked by clang-tidy | ||||||
| CodeSonar |
| LANG.STRUCT.LOOP.FPC | Float-typed loop counter | ||||||
| Compass/ROSE | |||||||||
| Coverity |
| MISRA C 2004 Rule 13.4 MISRA C 2012 Rule 14.1 | Implemented | ||||||
| Cppcheck Premium |
| premium-cert-flp30-c | |||||||
| ECLAIR |
| CC2.FLP30 | Fully implemented | ||||||
| Helix QAC |
| C3339, C3340, C3342 C++4234 | |||||||
| Klocwork |
| MISRA.FOR.COUNTER.FLT | |||||||
| LDRA tool suite |
| 39 S | Fully implemented | ||||||
| Parasoft C/C++test |
| CERT_C-FLP30-a | Do not use floating point variables as loop counters | ||||||
| PC-lint Plus |
| 9009 | Fully supported | ||||||
| Polyspace Bug Finder |
| CERT C: Rule FLP30-C | Checks for use of float variable as loop counter (rule fully covered) | ||||||
| PVS-Studio |
| V1034 | |||||||
| RuleChecker |
| for-loop-float | Fully checked | ||||||
| SonarQube C/C++ Plugin |
| S2193 | Fully implemented | ||||||
| TrustInSoft Analyzer |
| non-terminating | Exhaustively detects non-terminating statements (see one compliant and one non-compliant example). |
...