[PATCH] D24640: [CUDA] Don't try to run sanitizers on NVPTX.
Justin Lebar via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 15 16:49:12 PDT 2016
jlebar created this revision.
jlebar added a reviewer: kcc.
jlebar added subscribers: jhen, tra, cfe-commits.
Sanitizers aren't supported on NVPTX -- don't try to run them.
This lets you e.g. pass -fsanitize=address and get asan on your host
code.
https://reviews.llvm.org/D24640
Files:
clang/lib/Driver/SanitizerArgs.cpp
clang/test/Driver/cuda-no-sanitizers.cu
Index: clang/test/Driver/cuda-no-sanitizers.cu
===================================================================
--- /dev/null
+++ clang/test/Driver/cuda-no-sanitizers.cu
@@ -0,0 +1,12 @@
+// Check that -fsanitize=foo doesn't get passed down to device-side
+// compilation.
+//
+// REQUIRES: clang-driver
+//
+// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 -fsanitize=address %s 2>&1 | \
+// RUN: FileCheck %s
+
+// CHECK-DAG: "-fcuda-is-device"
+// CHECK-NOT: "-fsanitize=address"
+// CHECK-DAG: "-triple" "x86_64--linux-gnu"
+// CHECK: "-fsanitize=address"
Index: clang/lib/Driver/SanitizerArgs.cpp
===================================================================
--- clang/lib/Driver/SanitizerArgs.cpp
+++ clang/lib/Driver/SanitizerArgs.cpp
@@ -608,6 +608,12 @@
void SanitizerArgs::addArgs(const ToolChain &TC, const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs,
types::ID InputType) const {
+ // NVPTX doesn't currently support sanitizers. Bailing out here means that
+ // e.g. -fsanitize=address applies only to host code, which is what we want
+ // for now.
+ if (TC.getTriple().isNVPTX())
+ return;
+
// Translate available CoverageFeatures to corresponding clang-cc1 flags.
// Do it even if Sanitizers.empty() since some forms of coverage don't require
// sanitizers.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24640.71572.patch
Type: text/x-patch
Size: 1397 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160915/52c5ab23/attachment.bin>
More information about the cfe-commits
mailing list