![]() |
![]() |
2831 | ![]() |
||||
![]() | |||||||
| Overflow and wraparound | |||||||
A definite anomaly has been detected. Examination of the context indicates that this expression will always result in division by zero. In the example below, n is zero throughout the code contained in the "if" block and the result of the division operation will always be undefined.
/*PRQA S 587,2017,2983,2986,3103,3199,3203,3227,3408 ++*/
void foo(int x, int n)
{
int r;
if (n == 0)
{
r = x / n; /* 2831 */
}
}
MISRA C:2012 Rules applicable to message 2831:
| Dir-4.1 (Required) | Run-time failures shall be minimized |
See also:
![]() | ||
| QA·C Source Code Analyser 8.1
MISRA C:2012 Compliance Module 1.0 © 2012 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | MISRA C:2012 Rule Index | Contents |