[tsan] Cast floating-point types correctly when instrumenting atomic accesses, compil...
authorKuba Brecka <kuba.brecka@gmail.com>
Mon, 7 Nov 2016 19:10:13 +0000 (19:10 +0000)
committerKuba Brecka <kuba.brecka@gmail.com>
Mon, 7 Nov 2016 19:10:13 +0000 (19:10 +0000)
Although rare, atomic accesses to floating-point types seem to be valid, i.e. `%a = load atomic float ...`. The TSan instrumentation pass however tries to emit inttoptr, which is incorrect, we should use a bitcast here. Anyway, IRBuilder already has a convenient helper function for this.

Differential Revision: https://reviews.llvm.org/D26266

llvm-svn: 286136

compiler-rt/test/tsan/Darwin/objc-double-property.mm [new file with mode: 0644]

diff --git a/compiler-rt/test/tsan/Darwin/objc-double-property.mm b/compiler-rt/test/tsan/Darwin/objc-double-property.mm
new file mode 100644 (file)
index 0000000..51b10f2
--- /dev/null
@@ -0,0 +1,21 @@
+// RUN: %clangxx_tsan -O0 %s -o %t -framework Foundation && %env_tsan_opts=ignore_interceptors_accesses=1 %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_tsan -O1 %s -o %t -framework Foundation && %env_tsan_opts=ignore_interceptors_accesses=1 %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_tsan -O2 %s -o %t -framework Foundation && %env_tsan_opts=ignore_interceptors_accesses=1 %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_tsan -O3 %s -o %t -framework Foundation && %env_tsan_opts=ignore_interceptors_accesses=1 %run %t 2>&1 | FileCheck %s
+
+#import <Foundation/Foundation.h>
+
+@interface MyClass : NSObject
+@property float a;
+@property double b;
+@property long double c;
+@end
+
+@implementation MyClass
+@end
+
+int main() {
+  NSLog(@"Hello world");
+}
+
+// CHECK: Hello world