ゼロ除算

式でゼロ除算が行われています。

ID

問題箇所

説明

1

ゼロ除算

除算が行われた場所

          
extern int b, x, y, z;

void f()
{
    if (b) {
        x = 2;
        y = 1;
    } else {
        x = 4;
        y = 3;
    }
    // Following statement looks like it could possibly divide by zero
    // because x can be 2 and y can be 3.  In fact this combination
    // of values is impossible so this is a false positive.
    z /= (x - y + 1);

    // This is a real coding error
    if (b == 0) {
        z /= (x + y - 7);
    }
}
        

© 2010 Intel Corporation. 無断での引用、転載を禁じます。