@@ -1406,6 +1406,9 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
14061406 bindingset [ node, state, t0, ap]
14071407 predicate filter ( NodeEx node , FlowState state , Typ t0 , Ap ap , Typ t ) ;
14081408
1409+ bindingset [ node, ap, isStoreStep]
1410+ predicate stepFilter ( NodeEx node , Ap ap , boolean isStoreStep ) ;
1411+
14091412 bindingset [ typ, contentType]
14101413 predicate typecheckStore ( Typ typ , DataFlowType contentType ) ;
14111414
@@ -2842,11 +2845,12 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
28422845
28432846 private predicate localStep (
28442847 StagePathNodeImpl pn1 , NodeEx node , FlowState state , Cc cc , ParamNodeOption summaryCtx ,
2845- TypOption argT , ApOption argAp , Typ t , Ap ap , string label
2848+ TypOption argT , ApOption argAp , Typ t , Ap ap , string label , boolean isStoreStep
28462849 ) {
28472850 exists ( NodeEx mid , FlowState state0 , Typ t0 , LocalCc localCc |
28482851 pn1 = TStagePathNodeMid ( mid , state0 , cc , summaryCtx , argT , argAp , t0 , ap ) and
2849- localCc = getLocalCc ( cc )
2852+ localCc = getLocalCc ( cc ) and
2853+ isStoreStep = false
28502854 |
28512855 localStep ( mid , state0 , node , state , true , _, localCc , label ) and
28522856 t = t0
@@ -2860,25 +2864,28 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
28602864 pn1 = TStagePathNodeMid ( mid , state , cc , summaryCtx , argT , argAp , t0 , ap0 ) and
28612865 fwdFlowStore ( mid , t0 , ap0 , c , t , node , state , cc , summaryCtx , argT , argAp ) and
28622866 ap = apCons ( c , t0 , ap0 ) and
2863- label = ""
2867+ label = "" and
2868+ isStoreStep = true
28642869 )
28652870 or
28662871 // read
28672872 exists ( NodeEx mid , Typ t0 , Ap ap0 , Content c |
28682873 pn1 = TStagePathNodeMid ( mid , state , cc , summaryCtx , argT , argAp , t0 , ap0 ) and
28692874 fwdFlowRead ( t0 , ap0 , c , mid , node , state , cc , summaryCtx , argT , argAp ) and
28702875 fwdFlowConsCand ( t0 , ap0 , c , t , ap ) and
2871- label = ""
2876+ label = "" and
2877+ isStoreStep = false
28722878 )
28732879 }
28742880
28752881 private predicate localStep ( StagePathNodeImpl pn1 , StagePathNodeImpl pn2 , string label ) {
28762882 exists (
28772883 NodeEx node , FlowState state , Cc cc , ParamNodeOption summaryCtx , TypOption argT ,
2878- ApOption argAp , Typ t0 , Ap ap
2884+ ApOption argAp , Typ t0 , Ap ap , boolean isStoreStep
28792885 |
2880- localStep ( pn1 , node , state , cc , summaryCtx , argT , argAp , t0 , ap , label ) and
2881- pn2 = typeStrengthenToStagePathNode ( node , state , cc , summaryCtx , argT , argAp , t0 , ap )
2886+ localStep ( pn1 , node , state , cc , summaryCtx , argT , argAp , t0 , ap , label , isStoreStep ) and
2887+ pn2 = typeStrengthenToStagePathNode ( node , state , cc , summaryCtx , argT , argAp , t0 , ap ) and
2888+ stepFilter ( node , ap , isStoreStep )
28822889 )
28832890 or
28842891 summaryStep ( pn1 , pn2 , label )
@@ -2971,7 +2978,8 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
29712978 ApOption argAp , Typ t0 , Ap ap
29722979 |
29732980 nonLocalStep ( pn1 , node , state , cc , summaryCtx , argT , argAp , t0 , ap , label ) and
2974- pn2 = typeStrengthenToStagePathNode ( node , state , cc , summaryCtx , argT , argAp , t0 , ap )
2981+ pn2 = typeStrengthenToStagePathNode ( node , state , cc , summaryCtx , argT , argAp , t0 , ap ) and
2982+ stepFilter ( node , ap , false )
29752983 )
29762984 }
29772985
@@ -2989,7 +2997,8 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
29892997 ApOption argAp , Typ t0 , Ap ap , StagePathNodeImpl out0
29902998 |
29912999 fwdFlowThroughStep2 ( arg , par , ret , node , cc , state , summaryCtx , argT , argAp , t0 , ap ) and
2992- out0 = typeStrengthenToStagePathNode ( node , state , cc , summaryCtx , argT , argAp , t0 , ap )
3000+ out0 = typeStrengthenToStagePathNode ( node , state , cc , summaryCtx , argT , argAp , t0 , ap ) and
3001+ stepFilter ( node , ap , false )
29933002 |
29943003 out = out0 or out = out0 .( StagePathNodeMid ) .projectToSink ( _)
29953004 )
@@ -3181,6 +3190,9 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
31813190 )
31823191 }
31833192
3193+ bindingset [ node, ap, isStoreStep]
3194+ predicate stepFilter ( NodeEx node , Ap ap , boolean isStoreStep ) { any ( ) }
3195+
31843196 bindingset [ typ, contentType]
31853197 predicate typecheckStore ( Typ typ , DataFlowType contentType ) { any ( ) }
31863198
@@ -3459,6 +3471,9 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
34593471 )
34603472 }
34613473
3474+ bindingset [ node, ap, isStoreStep]
3475+ predicate stepFilter ( NodeEx node , Ap ap , boolean isStoreStep ) { any ( ) }
3476+
34623477 bindingset [ typ, contentType]
34633478 predicate typecheckStore ( Typ typ , DataFlowType contentType ) { any ( ) }
34643479 }
@@ -3543,10 +3558,15 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
35433558 private predicate clear ( NodeEx node , Ap ap ) {
35443559 // When `node` is the target of a store, we interpret `clearsContent` as
35453560 // only pertaining to _earlier_ store steps. In this case, we need to postpone
3546- // checking `clearsContent` to the `pathStep` predicate
3561+ // checking `clearsContent` to the step creation.
35473562 clearContent ( node , ap .getHead ( ) , false )
35483563 }
35493564
3565+ pragma [ nomagic]
3566+ private predicate clearExceptStore ( NodeEx node , Ap ap ) {
3567+ clearContent ( node , ap .getHead ( ) , true )
3568+ }
3569+
35503570 pragma [ nomagic]
35513571 private predicate expectsContentCand ( NodeEx node , Ap ap ) {
35523572 exists ( Content c |
@@ -3569,6 +3589,11 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
35693589 )
35703590 }
35713591
3592+ bindingset [ node, ap, isStoreStep]
3593+ predicate stepFilter ( NodeEx node , Ap ap , boolean isStoreStep ) {
3594+ if clearExceptStore ( node , ap ) then isStoreStep = true else any ( )
3595+ }
3596+
35723597 bindingset [ typ, contentType]
35733598 predicate typecheckStore ( Typ typ , DataFlowType contentType ) {
35743599 // We need to typecheck stores here, since reverse flow through a getter
@@ -3829,6 +3854,16 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
38293854 exists ( ap )
38303855 }
38313856
3857+ pragma [ nomagic]
3858+ private predicate clearExceptStore ( NodeEx node , Ap ap ) {
3859+ Stage4Param:: clearContent ( node , ap .getHead ( ) , true )
3860+ }
3861+
3862+ bindingset [ node, ap, isStoreStep]
3863+ predicate stepFilter ( NodeEx node , Ap ap , boolean isStoreStep ) {
3864+ if clearExceptStore ( node , ap ) then isStoreStep = true else any ( )
3865+ }
3866+
38323867 bindingset [ typ, contentType]
38333868 predicate typecheckStore ( Typ typ , DataFlowType contentType ) {
38343869 compatibleTypesFilter ( typ , contentType )
0 commit comments