@@ -11,7 +11,7 @@ private predicate exprInBooleanContext(Expr e) {
11
11
exists ( IRGuardCondition gc |
12
12
exists ( Instruction i |
13
13
i .getUnconvertedResultExpression ( ) = e and
14
- gc .comparesEq ( valueNumber ( i ) .getAUse ( ) , zero ( ) , 0 , _, _)
14
+ gc .comparesEq ( valueNumber ( i ) .getAUse ( ) , 0 , _, _)
15
15
)
16
16
or
17
17
gc .getUnconvertedResultExpression ( ) = e
@@ -36,18 +36,14 @@ private string getEofValue() {
36
36
)
37
37
}
38
38
39
- private ConstantInstruction getEofInstruction ( ) { result .getValue ( ) = getEofValue ( ) }
40
-
41
- private Operand eof ( ) { result .getDef ( ) = getEofInstruction ( ) }
42
-
43
39
/**
44
40
* Holds if the value of `call` has been checked to not equal `EOF`.
45
41
*/
46
42
private predicate checkedForEof ( ScanfFunctionCall call ) {
47
43
exists ( IRGuardCondition gc |
48
44
exists ( Instruction i | i .getUnconvertedResultExpression ( ) = call |
49
45
// call == EOF
50
- gc .comparesEq ( valueNumber ( i ) .getAUse ( ) , eof ( ) , 0 , _, _)
46
+ gc .comparesEq ( valueNumber ( i ) .getAUse ( ) , getEofValue ( ) . toInt ( ) , _, _)
51
47
or
52
48
// call < 0 (EOF is guaranteed to be negative)
53
49
gc .comparesLt ( valueNumber ( i ) .getAUse ( ) , zero ( ) , 0 , true , _)
0 commit comments