Navigation Menu

Skip to content

Commit

Permalink
More carefully handle casts of called functions in the error analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
Tristan Ravitch committed May 22, 2013
1 parent c0867bf commit 2d30d1d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Foreign/Inference/Analysis/ErrorHandling.hs
Expand Up @@ -458,8 +458,7 @@ returnsTransitiveError opts funcLike summ bb
| Just rv <- blockReturn brs bb = do
ics <- analysisEnvironment indirectCallSummary
case ignoreCasts rv of
InstructionC i@CallInst { callFunction = callee } -> do
let callees = callTargets ics callee
InstructionC i@CallInst { callFunction = (callTargets ics -> callees) } -> do
priorFacts <- relevantInducedFacts funcLike bb i
foldM (recordTransitiveError i priorFacts) summ callees
_ -> return summ
Expand Down Expand Up @@ -773,9 +772,11 @@ errRetVals (_:rest) = errRetVals rest

callTargets :: IndirectCallSummary -> Value -> [Value]
callTargets ics callee =
-- Don't re-use callee in case it has some casts in it.
-- Re-convert it back to a value instead.
case valueContent' callee of
FunctionC _ -> [callee]
ExternalFunctionC _ -> [callee]
FunctionC f -> [toValue f]
ExternalFunctionC ef -> [toValue ef]
_ -> indirectCallInitializers ics callee

isErrRetAnnot :: FuncAnnotation -> Bool
Expand Down

0 comments on commit 2d30d1d

Please sign in to comment.