summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuba Brecka <kuba.brecka@gmail.com>2016-11-07 19:10:13 +0000
committerKuba Brecka <kuba.brecka@gmail.com>2016-11-07 19:10:13 +0000
commit19679f97ed7c713b914c9d9dc242d215236993c3 (patch)
tree001c1c33802dcd84d0d5c61cc4ef6f81a4488db4
parent44e875ad5b2ce26826dd53f9e7d1a71436c86212 (diff)
downloadbcm5719-llvm-19679f97ed7c713b914c9d9dc242d215236993c3.tar.gz
bcm5719-llvm-19679f97ed7c713b914c9d9dc242d215236993c3.zip
[tsan] Cast floating-point types correctly when instrumenting atomic accesses, compiler-rt part
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
-rw-r--r--compiler-rt/test/tsan/Darwin/objc-double-property.mm21
1 files changed, 21 insertions, 0 deletions
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
index 00000000000..51b10f21c9c
--- /dev/null
+++ b/compiler-rt/test/tsan/Darwin/objc-double-property.mm
@@ -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
OpenPOWER on IntegriCloud