Skip to content

Commit 6efbc73

Browse files
author
Justin Lebar
committedSep 15, 2016
[CUDA] Don't try to run sanitizers on NVPTX.
Summary: 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. Reviewers: kcc Subscribers: cfe-commits, tra, jhen Differential Revision: https://reviews.llvm.org/D24640 llvm-svn: 281680
1 parent 4dd6b50 commit 6efbc73

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed
 

‎clang/lib/Driver/SanitizerArgs.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,12 @@ static void addIncludeLinkerOption(const ToolChain &TC,
608608
void SanitizerArgs::addArgs(const ToolChain &TC, const llvm::opt::ArgList &Args,
609609
llvm::opt::ArgStringList &CmdArgs,
610610
types::ID InputType) const {
611+
// NVPTX doesn't currently support sanitizers. Bailing out here means that
612+
// e.g. -fsanitize=address applies only to host code, which is what we want
613+
// for now.
614+
if (TC.getTriple().isNVPTX())
615+
return;
616+
611617
// Translate available CoverageFeatures to corresponding clang-cc1 flags.
612618
// Do it even if Sanitizers.empty() since some forms of coverage don't require
613619
// sanitizers.
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Check that -fsanitize=foo doesn't get passed down to device-side
2+
// compilation.
3+
//
4+
// REQUIRES: clang-driver
5+
//
6+
// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 -fsanitize=address %s 2>&1 | \
7+
// RUN: FileCheck %s
8+
9+
// CHECK-DAG: "-fcuda-is-device"
10+
// CHECK-NOT: "-fsanitize=address"
11+
// CHECK-DAG: "-triple" "x86_64--linux-gnu"
12+
// CHECK: "-fsanitize=address"

0 commit comments

Comments
 (0)
Please sign in to comment.