On 16 bit architectures (where short is same size as int) USHRT_MAX overflows as it is currently defined.
warning: overflow in expression; result is -2 with type 'int' [-Winteger-overflow]
The attached patch fixes this issue.
Details
- Reviewers
aaron.ballman chandlerc cor3ntin - Group Reviewers
Restricted Project
Diff Detail
Event Timeline
Oooh, good catch! The changes, as far as they go, look good to me. But can you add some test coverage for this? Also, this should probably have a release note in clang/docs/ReleaseNotes.rst.
Please include the full context of the patch with -U99999. See https://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-web-interface
>>But can you add some test coverage for this?
In clang\test\Headers\limits.cpp there is:
_Static_assert(USHRT_MAX == (unsigned short)~0ULL, "");
However as I said this needs a 16 bits target. Looking at the RUN commands at the top of the file I think I can solve this by adding a new RUN command with "-triple msp430" (since my RL78 port is not upstream yet) so it can catch this. Would this be OK?
Please include the full context of the patch with -U99999.
Sorry about this, I actually tried this but the patch showed a lot more than what I've changed, not sure what I did wrong. I also installed arcanist and I'm trying to get familiar with it.
That's exactly the solution I'd expect, sounds great!
Please include the full context of the patch with -U99999.
Sorry about this, I actually tried this but the patch showed a lot more than what I've changed, not sure what I did wrong. I also installed arcanist and I'm trying to get familiar with it.
No worries, it takes a while to get used to our systems. I've not use arcanist myself (I generate diff files and upload them manually into Phab), so I'm not much help for debugging what's going on for you. I use git diff -U9999 main > p.patch, FWIW.
arc diff "HEAD^" --update D129689 on the branch you want to push should do what you want, assuming you only have 1 commit on that branch - I usually amend my commits for simplicity.
(in the future, --update XXXX is not necessary if you let arc create the patch initially)
Sorry about this, I actually tried this but the patch showed a lot more than what I've changed, not sure what I did wrong.
You didn't do anything wrong; the -U99999 option will effectively include the entire file for each changed file. That is actually the intent; it is what enables Phabricator to have access to the rest of the file so that reviewers can expand the displayed context to see unchanged code.
This seems to have fallen through the cracks -- @SebastianPerta are you planning to update the patch, or would you be okay if I commandeered it?
>>are you planning to update the patch
Yes, sorry about the delay. I will update the patch before the end of the week.
@aaron.ballman I think we should close this change as it's superseeded by https://reviews.llvm.org/D144218