We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The following code fails with use-of-uninitialized-value:
use-of-uninitialized-value
#include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <stdio.h> int main() { struct stat st; printf("sizeof(struct stat) = %zd\n", sizeof(struct stat)); int fd = open(__FILE__, O_RDONLY); if (fd < 0) { return 1; } if (fstat(fd, &st)) { return 1; } if (st.st_size > 1) { return 2; } close(fd); return 0; }
Output:
$ clang x.c -o x -fsanitize=memory && ./x; echo $? sizeof(struct stat) = 144 ==134123==WARNING: MemorySanitizer: use-of-uninitialized-value #0 0x49d9e5 in main (/home/vstinner/python/main/x+0x49d9e5) #1 0x7f874ea5355f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f) #2 0x7f874ea5360b in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x2d60b) #3 0x41c344 in _start (/home/vstinner/python/main/x+0x41c344) SUMMARY: MemorySanitizer: use-of-uninitialized-value (/home/vstinner/python/main/x+0x49d9e5) in main Exiting 1
I tested on Fedora 35 with versions:
$ clang --version clang version 13.0.0 (Fedora 13.0.0-3.fc35) Target: x86_64-redhat-linux-gnu Thread model: posix InstalledDir: /usr/bin $ rpm -q clang clang-13.0.0-3.fc35.x86_64
Issue discovered in Python: https://bugs.python.org/issue46887
The text was updated successfully, but these errors were encountered:
This looks like a Fedora bug? I can't reproduce with the clang from https://apt.llvm.org/ or with Debian/Ubuntu system packages.
Sorry, something went wrong.
Same on godbolt: https://godbolt.org/z/ovz3de65z @vstinner you should probably report on Fedora's bugzilla then.
No activity for 2 years, I close the issue.
No branches or pull requests
The following code fails with
use-of-uninitialized-value
:Output:
I tested on Fedora 35 with versions:
Issue discovered in Python: https://bugs.python.org/issue46887
The text was updated successfully, but these errors were encountered: