diff options
author | Timm Baeder <tbaeder@redhat.com> | 2024-12-03 03:36:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-03 03:36:57 +0100 |
commit | fc9052ee258e35c5aaba3dc2c1419870975f3a7a (patch) | |
tree | 8dc915bbee6383595bd100378fcc385349417013 /clang/test/AST/ByteCode/builtin-functions.cpp | |
parent | 95979717e1122d4bb473efef2447ae92c24c9381 (diff) | |
download | llvm-fc9052ee258e35c5aaba3dc2c1419870975f3a7a.zip llvm-fc9052ee258e35c5aaba3dc2c1419870975f3a7a.tar.gz llvm-fc9052ee258e35c5aaba3dc2c1419870975f3a7a.tar.bz2 |
[clang][bytecode] Check __builtin_memcpy for null pointers (#118313)
Diffstat (limited to 'clang/test/AST/ByteCode/builtin-functions.cpp')
-rw-r--r-- | clang/test/AST/ByteCode/builtin-functions.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/AST/ByteCode/builtin-functions.cpp b/clang/test/AST/ByteCode/builtin-functions.cpp index 9a6a31b..dfee35d 100644 --- a/clang/test/AST/ByteCode/builtin-functions.cpp +++ b/clang/test/AST/ByteCode/builtin-functions.cpp @@ -1138,4 +1138,12 @@ namespace BuiltinMemcpy { return b; } static_assert(simple() == 12); + + + extern struct Incomplete incomplete; + constexpr struct Incomplete *null_incomplete = 0; + static_assert(__builtin_memcpy(null_incomplete, null_incomplete, sizeof(wchar_t))); // both-error {{not an integral constant expression}} \ + // both-note {{source of 'memcpy' is nullptr}} + + } |