@@ -28,10 +28,10 @@ abstract class UndefinedVolatilePointerExpr extends Expr {
28
28
/**
29
29
* Gets the depth of a pointer's base type's volatile qualifier
30
30
*/
31
- int getAVolatileDepth ( PointerType pt ) {
32
- pt . getBaseType ( ) .isVolatile ( ) and result = 1
31
+ int getAVolatileDepth ( Type type ) {
32
+ type .isVolatile ( ) and result = 1
33
33
or
34
- result = getAVolatileDepth ( pt .getBaseType ( ) ) + 1
34
+ result = getAVolatileDepth ( type . ( DerivedType ) .getBaseType ( ) ) + 1
35
35
}
36
36
37
37
/**
@@ -54,8 +54,9 @@ class CastFromVolatileToNonVolatileBaseType extends Cast, UndefinedVolatilePoint
54
54
/**
55
55
* Holds if `va` has a subsequent `VariableAccess` which is dereferenced after access
56
56
*/
57
+ bindingset [ va]
57
58
predicate hasSubsequentDereference ( VariableAccess va ) {
58
- dereferenced ( va .getASuccessor + ( ) . ( VariableAccess ) )
59
+ dereferenced ( pragma [ only_bind_out ] ( va ) .getASuccessor + ( ) )
59
60
}
60
61
61
62
/**
@@ -68,9 +69,9 @@ class NonVolatileObjectAssignedToVolatilePointer extends AssignExpr, UndefinedVo
68
69
not i = getAVolatileDepth ( this .getRValue ( ) .getType ( ) ) and
69
70
i = getAVolatileDepth ( this .getLValue ( ) .( VariableAccess ) .getTarget ( ) .getType ( ) )
70
71
) and
71
- // Checks for subsequent accesses to the underlying object via the original non-volatile
72
- // pointer assigned to the volatile pointer. This heuristic can cause false-positives
73
- // in certain instances which require more advanced reachability analysis, e.g. loops and scope
72
+ // Checks for subsequent accesses to the underlying object via the original non-volatile
73
+ // pointer assigned to the volatile pointer. This heuristic can cause false-positives
74
+ // in certain instances which require more advanced reachability analysis, e.g. loops and scope
74
75
// considerations that this simple forward traversal of the control-flow graph does not account for.
75
76
exists ( VariableAccess va |
76
77
va = this .getRValue ( ) .getAChild * ( ) .( VariableAccess ) .getTarget ( ) .getAnAccess ( ) and
0 commit comments