https://github.com/gbMattN updated https://github.com/llvm/llvm-project/pull/205577
>From f84a3a373397688a60c705478f682b6415841dbb Mon Sep 17 00:00:00 2001 From: gbMattN <[email protected]> Date: Mon, 14 Sep 2026 10:18:20 +0100 Subject: [PATCH 1/2] [Docs][TySan] Correct optimisation remarks --- clang/docs/TypeSanitizer.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/docs/TypeSanitizer.md b/clang/docs/TypeSanitizer.md index 39f6194dc8e76..f6e8f9686915c 100644 --- a/clang/docs/TypeSanitizer.md +++ b/clang/docs/TypeSanitizer.md @@ -71,8 +71,8 @@ $ cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_ENABLE_ Compile and link your program with `-fsanitize=type` flag. The TypeSanitizer run-time library should be linked to the final executable, so -make sure to use `clang` (not `ld`) for the final link step. To -get a reasonable performance add `-O1` or higher. +make sure to use ``clang`` (not ``ld``) for the final link step. To increase performance, you can optimise with ``-O1``. +Higher levels of optimization may result in false-negatives as incorrect code fragments may get optimized out incorrectly. TypeSanitizer by default doesn't print the full stack trace in error messages. Use `TYSAN_OPTIONS=print_stacktrace=1` to print the full trace. To get nicer stack traces in error messages add `-fno-omit-frame-pointer` and `-g`. To get perfect stack traces you may need to disable inlining (just use `-O1`) and tail call elimination >From 6d4bf8f79643091ddd74bb31ecbf2487f6af8ac1 Mon Sep 17 00:00:00 2001 From: gbMattN <[email protected]> Date: Tue, 15 Sep 2026 10:00:56 +0100 Subject: [PATCH 2/2] review comments --- clang/docs/TypeSanitizer.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/docs/TypeSanitizer.md b/clang/docs/TypeSanitizer.md index f6e8f9686915c..8d0ebb05ea515 100644 --- a/clang/docs/TypeSanitizer.md +++ b/clang/docs/TypeSanitizer.md @@ -72,7 +72,8 @@ $ cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_ENABLE_ Compile and link your program with `-fsanitize=type` flag. The TypeSanitizer run-time library should be linked to the final executable, so make sure to use ``clang`` (not ``ld``) for the final link step. To increase performance, you can optimise with ``-O1``. -Higher levels of optimization may result in false-negatives as incorrect code fragments may get optimized out incorrectly. +Higher levels of optimization may result in certain strict type aliasing violations being optimized away +(perhaps leading to unintended behavior). This results in the instrumentation giving users false-negatives. TypeSanitizer by default doesn't print the full stack trace in error messages. Use `TYSAN_OPTIONS=print_stacktrace=1` to print the full trace. To get nicer stack traces in error messages add `-fno-omit-frame-pointer` and `-g`. To get perfect stack traces you may need to disable inlining (just use `-O1`) and tail call elimination _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
