Fix FUNCTION_CALL callee type: use code type instead of Empty#659
Merged
tautschnig merged 4 commits intomainfrom Mar 26, 2026
Merged
Fix FUNCTION_CALL callee type: use code type instead of Empty#659tautschnig merged 4 commits intomainfrom
tautschnig merged 4 commits intomainfrom
Conversation
FUNCTION_CALL callees (e.g., print) had Empty type in the symbol table because coreStmtsToGoto created the callee expression with .Empty type. CBMC instrument_preconditions crashed trying to_code_type on Empty. Fix: add Ty.Identifier.code and Ty.mkCode, use it for the callee expression in coreStmtsToGoto. The code type flows through collectSymbolRefs into the symbol table naturally. Fixes 16 Python CBMC tests that use class-related function calls. Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to prevent CBMC crashes during precondition instrumentation by ensuring FUNCTION_CALL callee symbols (e.g., print) are given a code type instead of Empty, so the callee’s type flows into the generated symbol table correctly.
Changes:
- Add a
codeconstructor toCProverGOTO.Ty.Identifierand aTy.mkCodehelper. - Extend GOTO JSON serialization (
tyToJson) to emit acodetype node. - Update
coreStmtsToGototo type the function-call callee symbol usingTy.mkCodederived from argument/return expression types.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Strata/Backends/CBMC/GOTO/Type.lean | Introduces a code type identifier and Ty.mkCode constructor intended for function-call callees. |
| Strata/Backends/CBMC/GOTO/InstToJson.lean | Adds JSON serialization for the new code type. |
| Strata/Backends/CBMC/GOTO/CoreToGOTOPipeline.lean | Uses Ty.mkCode for FUNCTION_CALL callee expressions instead of .Empty. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mkCode previously discarded parameter and return types (subtypes was empty). Now stores them as subtypes = [returnType] ++ paramTypes, and tyToJson serializes them into proper CBMC code type JSON with parameter sub-nodes and return_type. This gives CBMC accurate function signatures for callee symbols rather than hardcoded empty parameters and void return type. Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
joscoh
approved these changes
Mar 25, 2026
MikaelMayer
approved these changes
Mar 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FUNCTION_CALL callees (e.g., print) had Empty type in the symbol table because coreStmtsToGoto created the callee expression with .Empty type. CBMC instrument_preconditions crashed trying to_code_type on Empty.
Fix: add Ty.Identifier.code and Ty.mkCode, use it for the callee expression in coreStmtsToGoto. The code type flows through collectSymbolRefs into the symbol table naturally.
Fixes 16 Python CBMC tests that use class-related function calls. See PRs like #657 for current failures on that.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.