-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second partycrashPrefer [crash-on-valid] or [crash-on-invalid]Prefer [crash-on-valid] or [crash-on-invalid]
Description
Given a program foo.cc:
#include <stdio.h>
constexpr size_t kSize = 10;
int main(int argc, char** argv) {
char buf[kSize];
snprintf(buf, kSize, "%c", 0x41);
return 0;
}
compiling with -Wunsafe-buffer-usage-in-libc-call gives
$ third_party/llvm-build/Release+Asserts/bin/clang++ -c -emit-llvm -Xclang -disable-llvm-passes -Wunsafe-buffer-usage-in-libc-call ~/foo.cc
clang++: [redacted]/third_party/llvm/clang/include/clang/AST/APValue.h:468: APSInt &clang::APValue::getInt(): Assertion `isInt() && "Invalid accessor"' failed.
0. Program arguments: third_party/llvm-build/Release+Asserts/bin/clang++ -c -emit-llvm -Xclang -disable-llvm-passes -Wunsafe-buffer-usage-in-libc-call [redacted]foo.cc
1. <eof> parser at end of file
#0 0x0000559fa1931108 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (third_party/llvm-build/Release+Asserts/bin/clang+++0x4fc9108)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
clang version 20.0.0git (https://chromium.googlesource.com/external/github.com/llvm/llvm-project 8cb44859cc31929521c09fc6a8add66d53db44de)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: [redacted]/third_party/llvm-build/Release+Asserts/bin
Build config: +assertions
clang++: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang++: note: diagnostic msg: /tmp/foo-82f592.cpp
clang++: note: diagnostic msg: /tmp/foo-82f592.sh
clang++: note: diagnostic msg:
********************
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second partycrashPrefer [crash-on-valid] or [crash-on-invalid]Prefer [crash-on-valid] or [crash-on-invalid]