@@ -21,19 +21,12 @@ class ShiftByNegativeOrGreaterPrecisionOperand extends UndefinedBehavior, BitShi
21
21
string reason ;
22
22
23
23
ShiftByNegativeOrGreaterPrecisionOperand ( ) {
24
- (
25
- getPrecision ( this .getLeftOperand ( ) .getExplicitlyConverted ( ) .getUnderlyingType ( ) ) <=
26
- upperBound ( this .getRightOperand ( ) ) and
27
- reason =
28
- "The operand " + this .getLeftOperand ( ) + " is shifted by an expression " +
29
- this .getRightOperand ( ) + " whose upper bound (" + upperBound ( this .getRightOperand ( ) ) +
30
- ") is greater than or equal to the precision."
31
- or
32
- lowerBound ( this .getRightOperand ( ) ) < 0 and
33
- reason =
34
- "The operand " + this .getLeftOperand ( ) + " is shifted by an expression " +
35
- this .getRightOperand ( ) + " which may be negative."
36
- ) and
24
+ getPrecision ( this .getLeftOperand ( ) .getExplicitlyConverted ( ) .getUnderlyingType ( ) ) <=
25
+ upperBound ( this .getRightOperand ( ) ) and
26
+ reason =
27
+ "The operand " + this .getLeftOperand ( ) + " is shifted by an expression " +
28
+ this .getRightOperand ( ) + " whose upper bound (" + upperBound ( this .getRightOperand ( ) ) +
29
+ ") is greater than or equal to the precision." and
37
30
/*
38
31
* this statement is not at a basic block where
39
32
* `this_rhs < PRECISION(...)` is ensured
@@ -49,18 +42,22 @@ class ShiftByNegativeOrGreaterPrecisionOperand extends UndefinedBehavior, BitShi
49
42
|
50
43
globalValueNumber ( lTLhs ) = globalValueNumber ( this .getRightOperand ( ) ) and
51
44
gc .ensuresLt ( lTLhs , precisionCall , 0 , block , true )
52
- ) and
45
+ )
46
+ or
47
+ lowerBound ( this .getRightOperand ( ) ) < 0 and
48
+ reason =
49
+ "The operand " + this .getLeftOperand ( ) + " is shifted by an expression " +
50
+ this .getRightOperand ( ) + " which may be negative." and
53
51
/*
54
52
* this statement is not at a basic block where
55
- * `this_rhs < 0` is ensured
53
+ * `this_rhs > 0` is ensured
56
54
*/
57
55
58
56
not exists ( GuardCondition gc , BasicBlock block , Expr literalZero , Expr lTLhs |
59
57
block = this .getBasicBlock ( ) and
60
- literalZero instanceof LiteralZero
61
- |
58
+ literalZero instanceof LiteralZero and
62
59
globalValueNumber ( lTLhs ) = globalValueNumber ( this .getRightOperand ( ) ) and
63
- gc .ensuresLt ( lTLhs , literalZero , 0 , block , true )
60
+ gc .ensuresLt ( literalZero , lTLhs , 0 , block , true )
64
61
)
65
62
}
66
63
0 commit comments