Commit 426d3dc
Emit explicit
CBMC's DFCC contract instrumentation (`--enforce-contract` /
`--replace-call-with-contract`) expects a dedicated `contract::<fn>`
symbol to exist for any function carrying a contract. For C inputs this
symbol is created by the ANSI-C typechecker, which also moves the
contract clauses (e.g. `c_spec_assigns`) onto it.
Kani builds goto-programs directly and never runs that typechecker, so
the symbol was absent. CBMC used to paper over this by deriving an empty
contract symbol from the function on the fly, but that fallback was
removed for soundness in diffblue/cbmc#8739, turning the missing symbol
into a hard error and breaking every `#[kani::proof_for_contract]`
harness.
Synthesize the companion `contract::<name>` symbol during symbol-table
serialization. It shares the function's contract-bearing type, has no
body, and is marked as a property, reconstructing exactly the symbol
CBMC's typechecker (and its old fallback) produced.
This is a necessary (though not necessarily sufficient) change to enable
upgrading to newer CBMC versions.
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 and MIT licenses.
---------
Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>contract:: symbols for functions with contracts (#4612)1 parent 0e9d205 commit 426d3dc
1 file changed
Lines changed: 62 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
700 | 700 | | |
701 | 701 | | |
702 | 702 | | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
703 | 757 | | |
704 | 758 | | |
705 | 759 | | |
706 | 760 | | |
707 | 761 | | |
708 | | - | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
709 | 770 | | |
710 | 771 | | |
711 | 772 | | |
| |||
0 commit comments