llvm / llvm/llvm-project

-fsanitize=nullability should trigger on uninitialized pointers

Open
#165,756 0 comments 0 reactions 1 assignee Claimed by @vitalybuka View on GitHub
compiler-rt:ubsan undefined behaviour
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

https://godbolt.org/z/Mfn8f4vYb

```
#include
#include

int main() {
void* a = nullptr;

void* _Nonnull b;

void* _Nonnull c = nullptr; // Only this one is triggered

void* _Nonnull d = &c;
memset(&d, 0, sizeof(d));

fprintf(stderr, "Done");
return 0;
}
```

I can see that memset case can be hard, but uninitialized value with or without -ftrivial-auto-var-init=zero should be easy.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.