llvm-project/clang/test/AST/ByteCode/strlen-unknown-size-array.cpp
Osama Abdelkader 004e462682
[clang][bytecode] Fix unknown size arrays crash in clang bytecode (#160015)
Fixes #153948

Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
2025-09-23 13:12:36 +00:00

14 lines
401 B
C++

// RUN: %clang_cc1 -std=c++20 -fexperimental-new-constant-interpreter %s -verify
// RUN: %clang_cc1 -std=c++20 %s -verify=ref
// expected-no-diagnostics
// ref-no-diagnostics
/// Test that __builtin_strlen() on external/unknown declarations doesn't crash the bytecode interpreter.
extern const char s[];
void foo(char *x)
{
unsigned long len = __builtin_strlen(s);
__builtin_strcpy(x, s);
}