diff options
| author | Justin Lebar <jlebar@google.com> | 2016-02-11 02:00:52 +0000 |
|---|---|---|
| committer | Justin Lebar <jlebar@google.com> | 2016-02-11 02:00:52 +0000 |
| commit | 9a2c0fbaf56af2d03933affa6f5a99c215911231 (patch) | |
| tree | f8e391ccf12ead9418e6e543276693d2eaa750ce /clang/test | |
| parent | 0f3474c1dcd0650696c1a2cdfdf57a3982a25e3c (diff) | |
| download | bcm5719-llvm-9a2c0fbaf56af2d03933affa6f5a99c215911231.tar.gz bcm5719-llvm-9a2c0fbaf56af2d03933affa6f5a99c215911231.zip | |
[CUDA] Don't crash when trying to printf a non-scalar object.
Summary:
We can't do the right thing, since there's no right thing to do, but at
least we can not crash the compiler.
Reviewers: majnemer, rnk
Subscribers: cfe-commits, jhen, tra
Differential Revision: http://reviews.llvm.org/D17103
llvm-svn: 260479
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/CodeGenCUDA/printf-aggregate.cu | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/test/CodeGenCUDA/printf-aggregate.cu b/clang/test/CodeGenCUDA/printf-aggregate.cu new file mode 100644 index 00000000000..2e703b81d09 --- /dev/null +++ b/clang/test/CodeGenCUDA/printf-aggregate.cu @@ -0,0 +1,17 @@ +// REQUIRES: x86-registered-target +// REQUIRES: nvptx-registered-target + +// RUN: not %clang_cc1 -triple nvptx64-nvidia-cuda -fcuda-is-device -emit-llvm \ +// RUN: -o - %s 2>&1 | FileCheck %s + +#include "Inputs/cuda.h" + +// Check that we don't crash when asked to printf a non-scalar arg. +struct Struct { + int x; + int y; +}; +__device__ void PrintfNonScalar() { + // CHECK: cannot compile this non-scalar arg to printf + printf("%d", Struct()); +} |

