Skip to content
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

getBranchVramGeneric should return an unsigned value #49

Merged
merged 3 commits into from
Dec 25, 2023

Conversation

descawed
Copy link
Contributor

Per #48 .

RabbitizerInstruction inst;
RabbitizerInstruction_init(&inst, 0x14600001, 0x80000000); // bnez $v1, . + 4 + (0x1 << 2)
RabbitizerInstruction_processUniqueId(&inst);
if (RabbitizerInstruction_getBranchVramGeneric(&inst) < 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this function returns an unsigned type then this check will always be false. A bit surprising if the compiler doesn't complain about this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had the same thought, but the compiler didn't warn, and I thought it might be good to have some test. I'll remove it if you don't think it's useful.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the compiler to gcc makes it complain

$ make CC=gcc
# ...
: warning: comparison of unsigned expression in ‘< 0’ is always false [-Wtype-limits]

Seems like clang doesn't enable -Wtype-limits as part of -Wextra like gcc does (https://reviews.llvm.org/D142826), which is a bit unfortunate

This reverts commit 55e7bc1.
@AngheloAlf AngheloAlf merged commit b92e43e into Decompollaborate:develop Dec 25, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants