================
@@ -0,0 +1,31 @@
+// RUN: %clangxx_tysan -O0 %s -o %t && %run %t >%t.out 2>&1
+// RUN: FileCheck %s < %t.out
+
+#include <stdio.h>
+
+struct inner {
+       char buffer;
+       int i;
+};
+
+void init_inner(inner *iPtr) {
+       iPtr->i = 0;
+}
+
+struct outer {
+       inner foo;
+    char buffer;
+};
+
+int main(void) {
+    outer *l = new outer();
+
+    init_inner(&l->foo);
+    
+    int access_offsets_with_different_base = l->foo.i;
+    printf("%d\n", access_offsets_with_different_base);
+    
+    return 0;
+}
+
+// CHECK-NOT: ERROR: TypeSanitizer: type-aliasing-violation
----------------
jmorse wrote:

Nit: please also include a test for /something/ in the output to ensure that 
the test is positively checking for something. Otherwise we could replace 
%clangxx_tysan with any program that succeeds , such as `true`, and this test 
would pass.

https://github.com/llvm/llvm-project/pull/108385
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to