-
Notifications
You must be signed in to change notification settings - Fork 143
Support short type #306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support short type #306
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 7 files
Prompt for AI agents (all 1 issues)
Understand the root cause of the following 1 issues and fix them.
<file name="tests/driver.sh">
<violation number="1" location="tests/driver.sh:5061">
The new cast_tests array is never executed because there is no run_* invocation for it, so these added tests never run. Please add the corresponding runner call so the short casts are actually tested.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Ask questions if you need clarification on any suggestion
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai
to give feedback, ask questions, or re-run the review.
Once you are confident that you have addressed the reviewers’ suggestions, simply click the "Resolve conversation" button in the GitHub web interface. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you missed to change logic in reg-alloc.c
as well, some stack alignment are done there.
Hint: look at OP_allocat
usages in reg-alloc.c
, you should also consider TY_short
cases there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the proposed changes enable shecc to parse short int
?
If so, add some test cases to validate.
This PR doesn't enable It causes "Unexpected token" error when parsing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rebase your branch to keep the git history clean.
f381006
to
0a327fa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check https://cbea.ms/git-commit/ carefully and enforce the rules.
0a327fa
to
c0e08ca
Compare
c0e08ca
to
191e76f
Compare
Previously, shecc only supported int, char, void, and _Bool as basic types. Adding short type enhances C99 compliance and enables proper handling of 16-bit signed integers for memory-efficient data structures. This implementation extends the type system with TY_short, adds halfword load/store instructions to both backends, and fixes OP_sign_ext to encode both source and target type sizes for correct sign extension behavior.
191e76f
to
5cb9b03
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these changes look good.
Thank @hhhh1300 for contributing! |
Add short data type support
This PR implements support for the
short
data type (#282).Changes Made
Testing
Summary by cubic
Add full support for the short (2-byte) type across the parser, type system, and ARM/RISC-V codegen, with correct halfword loads/stores, truncation, and sign extension. Expanded tests cover variables, pointers, arrays, casts, and sizeof.