[previous] 2834 [next] Possible: Division by zero.
Overflow and wraparound

A possible dataflow condition has been identified.

The result of using the / or % operator with a second operand which is zero is undefined.

For example:


/*PRQA S 489,584,2017,2983,2986,3103,3199,3203,3227,3408,3447,3602,3673,4600 ++*/
extern int x;

void foo(int m)
{
    int r;

    r = x / m;             /* 2834 */ /* m could be zero */
}

See also:

QA·C Source Code Analyser 8.1.2
© 2013 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index Contents