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

UndefinedBehaviorSanitizer: false-positive on arm64 #1644

Closed
lewis6991 opened this issue Apr 20, 2023 · 0 comments
Closed

UndefinedBehaviorSanitizer: false-positive on arm64 #1644

lewis6991 opened this issue Apr 20, 2023 · 0 comments

Comments

@lewis6991
Copy link

I've found when using -fsanitize=undefined on a Macbook M1 Pro machine with the following code, the sanitizer thinks we are indexing the array with a negative value. I do not get this result when running on x86_64

int main(void)
{
  int a[256] = { 0 };
  int b = 0x80;
  int c = a[b & 0xff];
}
clang -g -arch arm64 -fsanitize=undefined test.c -o test
test.c:5:11: runtime error: index -128 out of bounds for type 'int[256]'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior test.c:5:11 in
@lewis6991 lewis6991 changed the title false-positive undefined-behaviour on arm64 UndefinedBehaviorSanitizer: false-positive on arm64 Apr 20, 2023
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

No branches or pull requests

1 participant