Skip to content

Commit

Permalink
Heapster: Panic instead of calling partial head function (#2096)
Browse files Browse the repository at this point in the history
Really, we should be throwing a proper error message here instead of throwing a
`panic`, and we should document the requirement that the list of mutually
recursive functions must be non-empty. That is left as future work (see #2096).
  • Loading branch information
RyanGlScott committed Aug 21, 2024
1 parent 8335e25 commit 09a49b7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/SAWScript/HeapsterBuiltins.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,15 @@ heapster_typecheck_mut_funs_rename ::
BuiltinContext -> Options -> HeapsterEnv ->
[(String, String, String)] -> TopLevel ()
heapster_typecheck_mut_funs_rename _bic opts henv fn_names_and_perms =
do let (fst_nm, _, _) = head fn_names_and_perms
do let (fst_nm, _, _) =
case fn_names_and_perms of
fn_name_and_perm:_ -> fn_name_and_perm
-- TODO: Give a proper error message here instead of panicking,
-- and document the non-empty list requirement. See #2096.
[] -> panic "heapster_typecheck_mut_funs_rename"
[ "Unexpected empty list of mutually recursive functions"
, "See https://github.com/GaloisInc/saw-script/issues/2096"
]
Some lm <- failOnNothing ("Could not find symbol definition: " ++ fst_nm)
(lookupModDefiningSym henv fst_nm)
let w = llvmModuleArchReprWidth lm
Expand Down

0 comments on commit 09a49b7

Please sign in to comment.