[clang] [Clang] Add fake use emission to Clang with -fextend-lifetimes (PR #110102)
Jeremy Morse via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 19 07:29:26 PST 2024
================
@@ -0,0 +1,37 @@
+// RUN: %clang_cc1 %s -O1 -emit-llvm -fextend-lifetimes -fsanitize=null -fsanitize-trap=null -o - | FileCheck --check-prefix TRAP %s
+// RUN: %clang_cc1 %s -O1 -emit-llvm -fextend-lifetimes -o - | FileCheck --check-prefix FAKEUSE %s
+
+// With -fextend-lifetimes the compiler generated a fake.use of a
+// reference variable at the end of the function, in the cleanup block. This prompted the
+// address sanitizer to verify that the variable has been allocated properly, even when
+// the function returns early.
+// We check that sanitizers are disabled for code generated for the benefit of fake.use
+// intrinsics, as well as that the fake.use is no longer generated in the cleanup block.
+// It should be generated in the block preceding the cleanup block instead.
----------------
jmorse wrote:
Despite the filename containing "sanitizer", this test doesn't actually test sanitizer behaviour?
https://github.com/llvm/llvm-project/pull/110102
More information about the cfe-commits
mailing list