Skip to content

[BoundsSafety][NFC] Fix remaining bounds safety test failures in next #9862

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
merged 4 commits into from
Jan 22, 2025

Conversation

rapidsna
Copy link

Most failures are addressed by some textual changes in the text. One was due to a missing cherry-pick.

…l pointers

Previously code like this

```
void receive(int* __counted_by(5));

void test(void) {
  receive((int*) NULL);
}
```

would not emit an error diagnostic despite the fact the `test` function
would unconditionally trap.

The problem was that `Expr::isNullPointerConstant` does not look through
explicit casts and so cases where an explicitly NULL pointer constant
was converted to a `__counted_by` or `__sized_by` pointer with a
constant count were not caught.

To fix this `Expr::isNullPointerConstantIgnoreCastsAndOVEs` is used
instead.

rdar://139748843
@rapidsna
Copy link
Author

@swift-ci test llvm

@rapidsna rapidsna force-pushed the fix-bounds-safety-test-failures-next branch from 43bfd44 to 77cbc4c Compare January 21, 2025 20:34
@benlangmuir
Copy link

@swift-ci please test llvm

@benlangmuir
Copy link

Linux PR test failures that might be relevant:

  Clang :: BoundsSafety/PCH/count-increment-with-pch.c
  Clang :: Sema/builtin-counted-by-ref.c

@rapidsna
Copy link
Author

@swift-ci test llvm

@rapidsna
Copy link
Author

@swift-ci test llvm

@rapidsna rapidsna merged commit b6de36c into next Jan 22, 2025
0 of 2 checks passed
@rapidsna rapidsna deleted the fix-bounds-safety-test-failures-next branch January 22, 2025 17:38
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.

3 participants