-
-
Notifications
You must be signed in to change notification settings - Fork 393
[RV64_DYNAREC] Fix delta_ip range checks ([LA64_DYNAREC] too) #3386
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
Merged
+4
−4
Conversation
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
(1)“-0xfffffff” is seen as “unsigned int”。Here what is need shoule be INT_MIN。“-0x80000000L” is equal to INT_MIN and "L" is important that seen as long。
the exmaple code(I have tested in RV64(Vision Star2)and arm64(Pi5).
```c
#include <stdio.h>
int main(){
ssize_t a = 0;
if(a < -0xffffffff)
printf("-0xfffffff is seen as positive value \n");
return 0;
}
```
(2)"0xffffffff". Here what is need shoule be INT_MAX that should be "0x7fffffff"。
(3) the same situation is existed in “la64 GETIP_”.
Collaborator
|
Oh thank you for this, but I think changing |
Contributor
Author
} else if (_delta_ip >= -2048 && _delta_ip < 2048) { \
ADDI(xRIP, xRIP, _delta_ip); \
} else if (_delta_ip < 0 && _delta_ip >= -0xffffffff) { \
MOV32w(scratch, -_delta_ip); \
SUB(xRIP, xRIP, scratch); \
} else if (_delta_ip > 0 && _delta_ip <= 0xffffffff) { \
MOV32w(scratch, _delta_ip); \
ADD(xRIP, xRIP, scratch); \
} else { using MOV32w represents that value ranges from INT_MIN to INT_MAX. I thank INT_INT"-80000000L" and INT_MAX 0x7fffffff" may be better. |
Collaborator
|
No, it's an unsigned 32bit int. |
Contributor
Author
|
I see. changing 0xffffffff to 0xffffffffL is Ok. |
Collaborator
|
Can you change LoongArch counterpart too? |
the new code for rv64.
Contributor
Author
|
OK , I have do the work for rv64 and la64. |
ksco
requested changes
Jan 17, 2026
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.
(1)“-0xfffffff” is seen as “unsigned int”。Here what is need shoule be INT_MIN。“-0x80000000L” is equal to INT_MIN and "L" is important that seen as long。 the exmaple code(I have tested in RV64(Vision Star2)and arm64(Pi5).
(2)"0xffffffff". Here what is need shoule be INT_MAX that should be "0x7fffffff"。 (3) the same situation is existed in “la64 GETIP_”.