@ -70,12 +70,15 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
| base , []
| base , []
| base , _ :: [] -> base , []
| base , _ :: [] -> base , []
| base , accesses -> base , IList . rev ( IList . tl ( IList . rev accesses ) ) in
| base , accesses -> base , IList . rev ( IList . tl ( IList . rev accesses ) ) in
let is_thread_confined ( _ , accesses ) = match IList . rev accesses with
(* we don't want to warn on writes to the field if it is ( a ) thread-confined, or ( b ) volatile *)
let is_safe_write ( _ , accesses ) = match IList . rev accesses with
| AccessPath . FieldAccess ( fieldname , Typ . Tstruct typename ) :: _ ->
| AccessPath . FieldAccess ( fieldname , Typ . Tstruct typename ) :: _ ->
begin
begin
match Tenv . lookup tenv typename with
match Tenv . lookup tenv typename with
| Some struct_typ ->
| Some struct_typ ->
Annotations . field_has_annot fieldname struct_typ Annotations . ia_is_thread_confined
Annotations . field_has_annot
fieldname struct_typ Annotations . ia_is_thread_confined | |
Annotations . field_has_annot fieldname struct_typ Annotations . ia_is_volatile
| None ->
| None ->
false
false
end
end
@ -86,7 +89,7 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
IList . fold_left
IList . fold_left
( fun acc rawpath ->
( fun acc rawpath ->
if not ( ThreadSafetyDomain . OwnershipDomain . mem ( truncate rawpath ) owned ) &&
if not ( ThreadSafetyDomain . OwnershipDomain . mem ( truncate rawpath ) owned ) &&
not ( is_ thread_confined rawpath )
not ( is_ safe_write rawpath )
then
then
ThreadSafetyDomain . PathDomain . add_sink ( ThreadSafetyDomain . make_access rawpath loc ) acc
ThreadSafetyDomain . PathDomain . add_sink ( ThreadSafetyDomain . make_access rawpath loc ) acc
else
else