brintos

brintos / llvm-project-archived public Read only

0
0
Text · 626 B · 9dfbfac Raw
21 lines · cpp
1// REQUIRES: amdgpu-registered-target2// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -x hip -fcuda-is-device \3// RUN:    -verify -emit-llvm-only %s4 5#define __device__ __attribute__((device))6extern "C" __device__ int printf(const char *format, ...);7 8// Check that we don't crash when asked to printf a non-scalar arg.9struct Struct {10  int x;11  int y;12};13 14__device__ void PrintfNonScalar(const char *fmt) {15  printf(fmt, 1);16  // Ignore the warning about the %d not matching the struct argument17  // expected-warning@+2 {{}}18  // expected-error@+1 {{cannot compile this non-scalar arg to printf}}19  printf("%d", Struct());20}21