Conversation
1 task
sim642
commented
Dec 10, 2025
sim642
commented
Dec 10, 2025
There was a problem hiding this comment.
Pull request overview
This PR adds a new castkind type to CIL's AST to distinguish between different types of cast operations. The CastE expression constructor is updated from CastE(typ, exp) to CastE(castkind, typ, exp), allowing the AST to preserve information about why a cast was inserted (e.g., explicit cast, integer promotion, arithmetic conversion, etc.). This addresses issue #179.
Key changes:
- Introduces a new
castkindtype with 9 variants:Explicit,IntegerPromotion,DefaultArgumentPromotion,ArithmeticConversion,ConditionalConversion,PointerConversion,Implicit,Internal, andUnknown - Updates all
CastEpattern matches and constructor calls throughout the codebase to include the cast kind parameter - Modifies
mkCastandmkCastTfunctions to require a~kindparameter, ensuring cast kinds are specified at all call sites
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/cil.mli | Defines the new castkind type and updates CastE, mkCast, mkCastT signatures |
| src/cil.ml | Implements castkind type, updates CastE handling in all expression functions, adds d_castkind pretty-printer |
| src/frontc/cabs2cil.ml | Updates all cast operations to use appropriate cast kinds (Explicit, IntegerPromotion, ArithmeticConversion, etc.) |
| src/mergecil.ml | Updates CastE pattern matches in equality checking to accommodate new parameter |
| src/expcompare.ml | Updates expression comparison to include cast kind in equality checks, updates cast stripping functions |
| src/check.ml | Updates type checking for CastE with TODO for validating cast kinds |
| src/formatparse.mly | Updates parser to use Explicit kind for user casts, Unknown for internal casts |
| src/formatcil.ml | Updates test code to include Unknown cast kind |
| src/ext/pta/ptranal.ml | Updates pointer analysis to handle new CastE structure |
| src/ext/dataslicing/dataslicing.ml | Updates data slicing to preserve cast kinds |
| src/ext/zrapp/rmciltmps.ml | Updates temporary removal to use Unknown cast kind |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
sim642
commented
Dec 22, 2025
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.
Closes #179.
TODO
~kind:Unknown-s? I don't know what they should be, so maybe just leave for now. TheUnknownkind will probably get used in Goblint as well.