xref: /llvm-project/clang/test/CodeGenCUDA/deferred-diag.cu (revision 2c31aa2de13a23a00ced87123b92e905f2929c7b)
1 // RUN: not %clang_cc1 -std=c++11 -triple x86_64-unknown-linux-gnu \
2 // RUN:   -emit-llvm -o - %s 2>&1 | FileCheck %s
3 // RUN: not %clang_cc1 -std=c++11 -triple x86_64-unknown-linux-gnu \
4 // RUN:   -fcuda-is-device -emit-llvm -o - %s 2>&1 \
5 // RUN:   | FileCheck %s
6 
7 // Check no crash due to deferred diagnostics.
8 
9 #include "Inputs/cuda.h"
10 
11 // CHECK: error: invalid output constraint '=h' in asm
12 // CHECK-NOT: core dump
foo()13 inline __host__ __device__ int foo() {
14   short h;
15   __asm__("dont care" : "=h"(h) : "f"(0.0), "d"(0.0), "h"(0), "r"(0), "l"(0));
16   return 0;
17 }
18 
host_fun()19 void host_fun() {
20   foo();
21 }
22 
kernel()23 __global__ void kernel() {
24   foo();
25 }
26